How to do a phrase search for elasticity?

I use Elastic search and I can’t search for phrases by attributes on which the user analyzer is used.

The custom analyzer is referred to as:

"settings" : { "analysis.analyzer.string_lowercase.type" : "custom", "analysis.analyzer.string_lowercase.tokenizer" : "keyword", "analysis.analyzer.string_lowercase.filter" : "lowercase" } 

The value of the attribute is similar to: "in a puddle, out of a puddle", or it can be any String.

I tried using the following:

 1) **(Not worked)** QueryBuilders.queryString("*into the puddle*").autoGeneratePhraseQueries(true).defaultOperator(Operator.AND); 2) **(Not worked)** QueryBuilders.matchPhraseQuery(attribute, "into the puddle"); 3) **(Not worked)** QueryBuilders.queryString("*into the puddle*").autoGeneratePhraseQueries(true).defaultOperator(Operator.AND).analyzeWildcard(true); 

But, fortunately, try 1, works great with nested objects.

 FilterBuilders.nestedFilter(attribute, queryString("*into the puddle*").field(attribute) .defaultOperator(Operator.AND).analyzeWildcard(true)); 
+4
source share
1 answer

1) - 3), it seems that there is not enough field and therefore is looking for the _all field, which, I believe, is indexed using a standard analyzer.

+2
source

Source: https://habr.com/ru/post/1444311/


All Articles