Problem with sort with polish(POLAND) words!


(Mateusz) #1

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 ? ?


Problem with sorting polish words(ES 2.4.6)
(Xavier Facq) #2

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


(Mateusz) #3

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


(Xavier Facq) #4

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"
		    }
	    }
      }
  }
}

(Mateusz) #5

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


(system) #6

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