# Prefix query is case sensitive despite both index and search analyzers using lowercase filter?

**URL:** <https://discuss.elastic.co/t/prefix-query-is-case-sensitive-despite-both-index-and-search-analyzers-using-lowercase-filter/132118>\
**Category:** Elasticsearch\
**Created:** [May 16, 2018, 12:10pm UTC](https://discuss.elastic.co/t/prefix-query-is-case-sensitive-despite-both-index-and-search-analyzers-using-lowercase-filter/132118 "2018-05-16T12:10:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ifo20](https://avatars.discourse-cdn.com/v4/letter/i/e47c2d/32.png) [@ifo20](https://discuss.elastic.co/u/ifo20)\
**Post date:** [May 16, 2018, 12:10pm UTC](https://discuss.elastic.co/t/prefix-query-is-case-sensitive-despite-both-index-and-search-analyzers-using-lowercase-filter/132118/1 "2018-05-16T12:10:35Z")

</div>

Full question can also be found here [https://stackoverflow.com/questions/50368459/why-is-my-elastic-search-prefix-query-case-sensitive-despite-using-lowercase-fil](https://stackoverflow.com/questions/50368459/why-is-my-elastic-search-prefix-query-case-sensitive-despite-using-lowercase-fil)

Essentially I am using a prefix query on the Name.raw field (which is indexed using the keyword tokenizer with a lowercase token filter) and searching for 'harry' gets my result 'Harry Potter' but 'Harry' doesn't.

The search\_analyzer I am using is also using the lowercase filter, so shouldn't the query for 'Harry' be the same as the query for 'harry'?

Mapping:

{  
"autocomplete\_tenant\_1": {  
"mappings": {  
"pages": {  
"properties": {  
"Id": { "type": "keyword" },  
"Name": {  
"type": "text",  
"fields": {  
"raw": {  
"type": "text",  
"analyzer": "keywordAnalyzer",  
"search\_analyzer": "pageSearchAnalyzer"  
}  
},  
"analyzer": "pageSearchAnalyzer"  
},  
"Routes": {  
"properties": {  
"CultureCode": {  
"type": "keyword"  
},  
"Domain": {  
"type": "long"  
},  
"Path": {  
"type": "keyword"  
},  
"PointOfSale": {  
"type": "long"  
}  
}  
},  
"Tokens": {  
"type": "text",  
"analyzer": "pageIndexAnalyzer",  
"search\_analyzer": "pageSearchAnalyzer"  
},  
"Type": {  
"type": "long"  
}  
}  
}  
}  
}  
}

{  
"autocomplete\_tenant\_1": {  
"settings": {  
"index": {  
"number\_of\_shards": "5",  
"provided\_name": "autocomplete\_tenant\_1",  
"creation\_date": "1526462564455",  
"analysis": {  
"filter": {  
"ngram": {  
"type": "edgeNGram",  
"min\_gram": "2",  
"max\_gram": "15"  
}  
},  
"analyzer": {  
"keywordAnalyzer": {  
"filter": [  
"trim",  
"lowercase",  
"asciifolding"  
],  
"type": "custom",  
"tokenizer": "keyword"  
},  
"pageSearchAnalyzer": {  
"filter": [  
"trim",  
"lowercase",  
"asciifolding"  
],  
"type": "custom",  
"tokenizer": "standard"  
},  
"pageIndexAnalyzer": {  
"filter": [  
"trim",  
"lowercase",  
"asciifolding",  
"ngram"  
],  
"type": "custom",  
"tokenizer": "standard"  
}  
}  
},  
"number\_of\_replicas": "1",  
"uuid": "l2AXoFNGRqafm42OSWWTAg",  
"version": {  
"created": "6020399"  
}  
}  
}  
}  
}```

---

<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:** [June 13, 2018, 12:10pm UTC](https://discuss.elastic.co/t/prefix-query-is-case-sensitive-despite-both-index-and-search-analyzers-using-lowercase-filter/132118/2 "2018-06-13T12:10:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
