'In Elasticsearch, how can I retrieve only the documents that contains an exact field name?

I am working with java spring boot and Elasticsearch, and trying to retrieve only the documents that have a specific field name. Right now it retrieves not only documents with the exact field name, but also documents with field names that are similar to it. for example, if the field name I search is "flow", it will also retrieve documents with the field name "re-flow". How can I fix it?

This is the repository class I use:

public interface AlternativesRepository extends ElasticsearchRepository<AlternativesDocument,String> {
    List<AlternativesDocument> findAllBySomeFieldName(String someFieldName);

}

and this is the field as it's defined in the code:

@Field(type = FieldType.Keyword)
    private String someFieldName= "";

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source