# Case insensitive sorting problem

**URL:** <https://discuss.elastic.co/t/case-insensitive-sorting-problem/96792>\
**Category:** Elasticsearch\
**Created:** [August 11, 2017, 3:16pm UTC](https://discuss.elastic.co/t/case-insensitive-sorting-problem/96792 "2017-08-11T15:16:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![djmcgreal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djmcgreal/32/52956_2.png) [@djmcgreal](https://discuss.elastic.co/u/djmcgreal)\
**Post date:** [August 11, 2017, 3:16pm UTC](https://discuss.elastic.co/t/case-insensitive-sorting-problem/96792/1 "2017-08-11T15:16:30Z")

</div>

Hi,  
I'd like to use the ducet sorting available from the icu plugin but am finding it difficult. Is there a definitive example somewhere? There's problematic differences between the examples in the definitive guide (2.x), the documentation of 5.2 (the version I'm using) and the latest thinking.

I'm using the following mapping  
{  
"template": "itemit-state-_",  
"mappings": {  
"default" : {  
"dynamic\_templates" : [  
{  
"not\_analyzed" : {  
"match" : "_",  
"match\_mapping\_type" : "string",  
"mapping" : {  
"type" : "text",  
"fields" : {  
"keyword" : {  
"type" : "keyword",  
"ignore\_above": 256  
},  
"ducet\_sort" : {  
"type" : "keyword",  
"analyzer" : "ducet\_sort"  
}  
}  
}  
}  
}  
]  
}  
},  
"settings": {  
"index.mapping.ignore\_malformed": true,  
"analysis": {  
"analyzer": {  
"ducet\_sort": {  
"tokenizer": "keyword",  
"filter": ["icu\_collation"]  
}  
}  
}  
}  
}

But I get: java.lang.IllegalArgumentException: Custom Analyzer [ducet\_sort] failed to find filter under name [icu\_collation]

Something to do with normalisers?

Thanks, Dan.

---

<div class="post-metadata">

**Author:** ![djmcgreal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djmcgreal/32/52956_2.png) [@djmcgreal](https://discuss.elastic.co/u/djmcgreal)\
**Post date:** [August 14, 2017, 10:32am UTC](https://discuss.elastic.co/t/case-insensitive-sorting-problem/96792/2 "2017-08-14T10:32:32Z")

</div>

Ok so I'm now in a position to better phrase the problem!

Following [https://www.elastic.co/guide/en/elasticsearch/plugins/5.2/analysis-icu-collation.html](https://www.elastic.co/guide/en/elasticsearch/plugins/5.2/analysis-icu-collation.html) works, but involves enabling field data for the field. I was hoping to avoid this and use keyword instead, but as soon as I do that I get an error at index time:

Mapping definition for [fields] has unsupported parameters: [analyzer : ducet\_sort]

Any help appreciated.  
Best, Dan.

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [August 18, 2017, 2:10pm UTC](https://discuss.elastic.co/t/case-insensitive-sorting-problem/96792/3 "2017-08-18T14:10:18Z")

</div>

You cannot apply an analyzer to a field of type `keyword`. Only `text` fields are analyzed. You have to use an normalizer instead. Unfortunately, I don't think you can use the `icu_collation` filter in a normalizer.

The best solution is to upgrade to version 5.5, which has a brand new `icu_collation_keyword` field type. The docs have more info: [https://www.elastic.co/guide/en/elasticsearch/plugins/5.5/analysis-icu-collation-keyword-field.html](https://www.elastic.co/guide/en/elasticsearch/plugins/5.5/analysis-icu-collation-keyword-field.html)

If you cannot upgrade to 5.5, the only solution is to use a text field instead of a keyword field and apply your analyzer to that text field. The downside is that you will have to enable fielddata if you decide to go that way.

---

<div class="post-metadata">

**Author:** ![djmcgreal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djmcgreal/32/52956_2.png) [@djmcgreal](https://discuss.elastic.co/u/djmcgreal)\
**Post date:** [August 18, 2017, 10:27pm UTC](https://discuss.elastic.co/t/case-insensitive-sorting-problem/96792/4 "2017-08-18T22:27:11Z")

</div>

Thanks for the clarification! This is indeed the realisation we reached…. We’ll bite the fielddata until such time as we can upgrade…  
Thanks, Dan.

---

<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:** [September 15, 2017, 10:27pm UTC](https://discuss.elastic.co/t/case-insensitive-sorting-problem/96792/5 "2017-09-15T22:27:18Z")

</div>

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