# Queries seem to ignore custom analyzer

**URL:** <https://discuss.elastic.co/t/queries-seem-to-ignore-custom-analyzer/17711>\
**Category:** Elasticsearch\
**Created:** [May 24, 2014, 11:15pm UTC](https://discuss.elastic.co/t/queries-seem-to-ignore-custom-analyzer/17711 "2014-05-24T23:15:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Philipp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_philipp/32/1543_2.png) [@Alex\_Philipp](https://discuss.elastic.co/u/Alex_Philipp)\
**Post date:** [May 24, 2014, 11:15pm UTC](https://discuss.elastic.co/t/queries-seem-to-ignore-custom-analyzer/17711/1 "2014-05-24T23:15:15Z")

</div>

I'm using a custom analyzer to stem possessive english. My custom analyzer  
seems to be ignored. As a sample search, we'll use "McDonald's".

What I used to create my analyzer:

{  
"settings": {  
"analysis": {  
"analyzer": {  
"default": {  
"type": "custom",  
"tokenizer": "standard",  
"filter": [  
"standard",  
"lowercase",  
"stop",  
"pos\_english"  
]  
}  
},  
"filter": {  
"pos\_english": {  
"type": "stemmer",  
"name": "possessive\_english"  
}  
}  
}  
}  
}

My mapping:

{  
"item": {  
"\_boost": {  
"name": "custom\_boost",  
"null\_value": 1  
},  
"properties": {  
"servings": {  
"enabled": false,  
"type": "object"  
},  
"brand\_name": {  
"index": "analyzed",  
"type": "string",  
"store": false  
},  
"food\_name": {  
"index": "analyzed",  
"type": "string",  
"store": false  
}  
}  
}  
}

When I test the analyzer for the text 'McDonald's', it seems to work  
properly:

{  
"tokens": [  
{  
"token": "mcdonald",  
"start\_offset": 0,  
"end\_offset": 10,  
"type": "",  
"position": 1  
}  
]  
}

However, if I search for 'McDonald', I get no results. If I search for  
'McDonald's' (with the possessive), I get my expected results. It seems  
like the analyzer is being ignored during the query.

Search query that returns no results:

{  
"query": {  
"match": {  
"\_all": {  
"query": "mcdonalds"  
}  
}  
}  
}

Any idea what I'm doing wrong?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/93e3e3b3-1fc7-443d-970e-47bb43c757e4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/93e3e3b3-1fc7-443d-970e-47bb43c757e4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 24, 2014, 11:16pm UTC](https://discuss.elastic.co/t/queries-seem-to-ignore-custom-analyzer/17711/2 "2014-05-24T23:16:55Z")

</div>

You did not apply this analyzer to \_all field.

The default one is applied.

My 2 cents

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 25 mai 2014 à 01:15, Alex Philipp [alex@snapfiber.com](mailto:alex@snapfiber.com) a écrit :

I'm using a custom analyzer to stem possessive english. My custom analyzer seems to be ignored. As a sample search, we'll use "McDonald's".

What I used to create my analyzer:

{  
"settings": {  
"analysis": {  
"analyzer": {  
"default": {  
"type": "custom",  
"tokenizer": "standard",  
"filter": [  
"standard",  
"lowercase",  
"stop",  
"pos\_english"  
]  
}  
},  
"filter": {  
"pos\_english": {  
"type": "stemmer",  
"name": "possessive\_english"  
}  
}  
}  
}  
}

My mapping:

{  
"item": {  
"\_boost": {  
"name": "custom\_boost",  
"null\_value": 1  
},  
"properties": {  
"servings": {  
"enabled": false,  
"type": "object"  
},  
"brand\_name": {  
"index": "analyzed",  
"type": "string",  
"store": false  
},  
"food\_name": {  
"index": "analyzed",  
"type": "string",  
"store": false  
}  
}  
}  
}

When I test the analyzer for the text 'McDonald's', it seems to work properly:

{  
"tokens": [  
{  
"token": "mcdonald",  
"start\_offset": 0,  
"end\_offset": 10,  
"type": "",  
"position": 1  
}  
]  
}

However, if I search for 'McDonald', I get no results. If I search for 'McDonald's' (with the possessive), I get my expected results. It seems like the analyzer is being ignored during the query.

Search query that returns no results:

{  
"query": {  
"match": {  
"\_all": {  
"query": "mcdonalds"  
}  
}  
}  
}

## Any idea what I'm doing wrong?

You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/93e3e3b3-1fc7-443d-970e-47bb43c757e4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/93e3e3b3-1fc7-443d-970e-47bb43c757e4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6F5ECFF8-F10E-4223-B79A-947CC8255123%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/6F5ECFF8-F10E-4223-B79A-947CC8255123%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:27am UTC](https://discuss.elastic.co/t/queries-seem-to-ignore-custom-analyzer/17711/3 "2017-07-06T01:27:10Z")

</div>


