Problem with sort with polish(POLAND) words!

Please, help me people with my problem.

I've got that mapping:

"some_field: {type: 'string', store: 'true', analyzer: 'keyword'}"
in this field i've got words "Śrem" "Żnin" with polish sign.

When i do sort on this data, elastic returned sorted data:
a,b,c,d,...,z, ś, ł, ż

What's wrong with my sort?

Anybody can help me ? ?

Hi,

Maybe you can try to add the asciifolding filter to normalize all char and have the good sort ?

https://www.elastic.co/guide/en/elasticsearch/reference/5.2/analysis-asciifolding-tokenfilter.html

1 Like

Thanks it's good point. But a I have some question.. I must change mapping for that field in my elastic ?

Yes, you have have to change the analyser in the index mapping, then create a new index and re-index your data ...

Something like that:

{
    "template" : "your-next-index-name-*",
    "order" : 0,
    "settings" : {
	"analysis": {
	    "analyzer": {
		"polish_asciied": {
		    "type": "custom",
		    "tokenizer": "standard",
		    "filter": [ "lowercase", "asciifolding", "trim" ]
		}
	    }
      }
    },
    "mappings" : {
	"your_type": {
	    "properties": {
		"your_polish_field" : {
		  "type": "string",
		  "analyzer": "polish_asciied"
		    }
	    }
      }
  }
}

You're right. It's working :slight_smile: Thanks for help.

1 Like

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