# How to phrase search with custom analyzers

**URL:** <https://discuss.elastic.co/t/how-to-phrase-search-with-custom-analyzers/9579>\
**Category:** Elasticsearch\
**Created:** [November 6, 2012, 12:52pm UTC](https://discuss.elastic.co/t/how-to-phrase-search-with-custom-analyzers/9579 "2012-11-06T12:52:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anks\_tom](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@anks\_tom](https://discuss.elastic.co/u/anks_tom)\
**Post date:** [November 6, 2012, 12:52pm UTC](https://discuss.elastic.co/t/how-to-phrase-search-with-custom-analyzers/9579/1 "2012-11-06T12:52:29Z")

</div>

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));

--

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:05am UTC](https://discuss.elastic.co/t/how-to-phrase-search-with-custom-analyzers/9579/2 "2017-07-06T03:05:59Z")

</div>

Closed on July 6, 2017, 3:05am UTC


