# Filters with analyzers

**URL:** <https://discuss.elastic.co/t/filters-with-analyzers/6520>\
**Category:** Elasticsearch\
**Created:** [January 27, 2012, 6:09am UTC](https://discuss.elastic.co/t/filters-with-analyzers/6520 "2012-01-27T06:09:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![narinder\_izap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/narinder_izap/32/803_2.png) [@narinder\_izap](https://discuss.elastic.co/u/narinder_izap)\
**Post date:** [January 27, 2012, 6:09am UTC](https://discuss.elastic.co/t/filters-with-analyzers/6520/1 "2012-01-27T06:09:12Z")

</div>

```
 Hi Guys,

               I am having doubt if the filters by default use the 

```

analyzers and if they use, then which one and if i need to change it, how  
to change the analyzer of the filter.

Actually I have a query as follows:

{  
"query": {  
"filtered": {  
"query": {  
"bool": {  
"should": [  
[  
{  
"text": {  
"searchable.title": {  
"type": "phrase\_prefix",  
"query": "ys: bay",  
"analyzer": "simple"  
}  
}  
}  
]  
]  
}  
},  
"filter": {  
"or": [  
{  
"prefix": {  
"searchable.title": "ys: bay"  
}  
}  
]  
}  
}  
}  
}

It is not giving results, but if i use the following query, it giving the  
result:

{  
"query": {  
"filtered": {  
"query": {  
"bool": {  
"should": [  
[  
{  
"text": {  
"searchable.title": {  
"type": "phrase\_prefix",  
"query": "ys: bay",  
"analyzer": "simple"  
}  
}  
}  
]  
]  
}  
},  
"filter": {  
"or": [  
{  
"prefix": {  
"searchable.title": "ys"  
}  
}  
]  
}  
}  
}  
}

I think the \*":" \*is the reason, but i did not get any documentation  
regarding the filters and analyzers together. So can you give me the way??

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 27, 2012, 9:18pm UTC](https://discuss.elastic.co/t/filters-with-analyzers/6520/2 "2012-01-27T21:18:38Z")

</div>

Filters don't use analyzers at all.

On Friday, January 27, 2012 at 8:09 AM, Narinder Kaur wrote:

> ```
> Hi Guys,
> 
> I am having doubt if the filters by default use the analyzers and if they use, then which one and if i need to change it, how to change the analyzer of the filter.
> 
> ```
> 
> Actually I have a query as follows:
> 
> {  
> "query": {  
> "filtered": {  
> "query": {  
> "bool": {  
> "should": [  
> [  
> {  
> "text": {  
> "searchable.title": {  
> "type": "phrase\_prefix",  
> "query": "ys: bay",  
> "analyzer": "simple"  
> }  
> }  
> }  
> ]  
> ]  
> }  
> },  
> "filter": {  
> "or": [  
> {  
> "prefix": {  
> "searchable.title": "ys: bay"  
> }  
> }  
> ]  
> }  
> }  
> }  
> }
> 
> It is not giving results, but if i use the following query, it giving the result:
> 
> {  
> "query": {  
> "filtered": {  
> "query": {  
> "bool": {  
> "should": [  
> [  
> {  
> "text": {  
> "searchable.title": {  
> "type": "phrase\_prefix",  
> "query": "ys: bay",  
> "analyzer": "simple"  
> }  
> }  
> }  
> ]  
> ]  
> }  
> },  
> "filter": {  
> "or": [  
> {  
> "prefix": {  
> "searchable.title": "ys"  
> }  
> }  
> ]  
> }  
> }  
> }  
> }
> 
> I think the ":" is the reason, but i did not get any documentation regarding the filters and analyzers together. So can you give me the way??

---

<div class="post-metadata">

**Author:** ![narinder\_izap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/narinder_izap/32/803_2.png) [@narinder\_izap](https://discuss.elastic.co/u/narinder_izap)\
**Post date:** [January 28, 2012, 10:30am UTC](https://discuss.elastic.co/t/filters-with-analyzers/6520/3 "2012-01-28T10:30:14Z")

</div>

then can you please explain the behaviour and suggest some solution for the  
above problem??

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 29, 2012, 6:23pm UTC](https://discuss.elastic.co/t/filters-with-analyzers/6520/4 "2012-01-29T18:23:48Z")

</div>

Hard to tell without understanding the data you index, and the analyzer used for each one, but maybe the title is analyzed?

On Saturday, January 28, 2012 at 12:30 PM, Narinder Kaur wrote:

> then can you please explain the behaviour and suggest some solution for the above problem??

---

<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:41am UTC](https://discuss.elastic.co/t/filters-with-analyzers/6520/5 "2017-07-06T03:41:07Z")

</div>


