How to phrase search with custom analyzers


(anks tom) #1

I am using Elastic search, and not able to do phrase search on the
attributes on which custom analyzer is applied.

Custom analyzer is mentioned as:

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

Attribute value is like : "into the puddle, out of the puddle", and could
be of any String.

I have tried using 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, unfortunately try 1, works fine with the nested objects.

FilterBuilders.nestedFilter(attribute, queryString("into the puddle").field(attribute)
.defaultOperator(Operator.AND).analyzeWildcard(true));

--


(system) #2