Search code examples
spring-bootelasticsearchspring-dataspring-data-elasticsearchfuzzy-search

Is it possible to set up the Fuzzy parameter on all indexes data search as the app parameter when the SpringBoot app is requesting ElasticSearch?


I'd like to have a properties set up to adjust fuzziness of elasticsearch search request as a whole application set up, i.e not changing this per @Query of the individual MyEntitySearchRepository. Is there a way to specify this using 1) some SpringBoot properties to be picked up by the Spring Data ElasticSearch 2) using ElasticsearchTemplate to prepopulate it with the fuzzy value from the homegrown spring boot property, while the other part of the app queries to go to ElasticSearch should go from the Spring data definitions (index names, by/in/like parameters). Is it ever possible, or for now the only way it to set up individual @Query to form the request json, containing fuzzy parameter like is described there and I can only paste the fuzzy value there being taken from the homegrown SpringBoot property?


Solution

  • This is at the moment not possible, and I'm not sure if I understand you right: You want to define a global fuzzy setting that should be applied to all queries? On which fields of your document? All String fields? There is no global fuzzy setting in Elasticsearch itself, so it would be necessary to build custom queries internally.

    At the moment the only way to go is with @Query annotated custom repository methods.