# Problem with sorting polish words(ES 2.4.6)

**URL:** <https://discuss.elastic.co/t/problem-with-sorting-polish-words-es-2-4-6/116673>\
**Category:** Elasticsearch\
**Created:** [January 23, 2018, 1:16pm UTC](https://discuss.elastic.co/t/problem-with-sorting-polish-words-es-2-4-6/116673 "2018-01-23T13:16:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmalerowicz](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@pmalerowicz](https://discuss.elastic.co/u/pmalerowicz)\
**Post date:** [January 23, 2018, 1:16pm UTC](https://discuss.elastic.co/t/problem-with-sorting-polish-words-es-2-4-6/116673/1 "2018-01-23T13:16:34Z")

</div>

Hello.  
Wrong sorting result for product name with polish characters.

ElasticSearch Version: 2.4.6, Build: 5376dca/2017-07-18T12:17:44Z, JVM: 1.7.0\_151  
"version" : {  
"number" : "2.4.6",  
"build\_hash" : "5376dca9f70f3abef96a77f4bb22720ace8240fd",  
"build\_timestamp" : "2017-07-18T12:17:44Z",  
"build\_snapshot" : false,  
"lucene\_version" : "5.5.4"  
},

Plugins: Installed plugins in /usr/share/elasticsearch/plugins:  
- analysis-stempel  
- analysis-phonetic  
- analysis-icu

Steps to reproduce  
I added 4 rows with names:  
Łatwa naz  
Latwa naz  
Łatwa naa  
Latwa naa

I search by "latwa" and sorting by "name" DESC

Expected result  
Łatwa naz  
Łatwa naa  
Latwa naz  
Latwa naa

"Ł" should be before "L"

Actual result  
Łatwa naz  
Latwa naz  
Łatwa naa  
Latwa naa

Configuration:  
"pl\_ascii\_folding": {  
"type": "asciifolding",  
"preserve\_original": "1"  
},

"sortable": {  
"type": "custom",  
"filter": [  
"pl\_ascii\_folding",  
"lowercase"  
],  
"tokenizer": "keyword"  
}  
Query:  
?q=name:latwa&sort=name.sortable:DESC'

Problem from [Problem with sort with polish(POLAND) words!](https://discuss.elastic.co/t/problem-with-sort-with-polish-poland-words/73417) is not the same.

For ElasticSearch version 6.1 is ok.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [January 23, 2018, 6:02pm UTC](https://discuss.elastic.co/t/problem-with-sorting-polish-words-es-2-4-6/116673/2 "2018-01-23T18:02:10Z")

</div>

This behaviour is surprising to me, can you share a full recreation including mappings?

---

<div class="post-metadata">

**Author:** ![pmalerowicz](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@pmalerowicz](https://discuss.elastic.co/u/pmalerowicz)\
**Post date:** [January 24, 2018, 10:34am UTC](https://discuss.elastic.co/t/problem-with-sorting-polish-words-es-2-4-6/116673/3 "2018-01-24T10:34:22Z")

</div>

```auto
{
  "magento2_default_catalog_product_20180124_102302": {
    "mappings": {
      "product": {
        "_all": {
          "enabled": false
        },
        "properties": {
          "name": {
            "type": "string",
            "norms": {
              "enabled": false
            },
            "fielddata": {
              "format": "disabled"
            },
            "fields": {
              "shingle": {
                "type": "string",
                "norms": {
                  "enabled": false
                },
                "index_options": "docs",
                "fielddata": {
                  "format": "disabled"
                },
                "analyzer": "shingle"
              },
              "sortable": {
                "type": "string",
                "norms": {
                  "enabled": false
                },
                "index_options": "docs",
                "analyzer": "sortable"
              },
              "whitespace": {
                "type": "string",
                "norms": {
                  "enabled": false
                },
                "fielddata": {
                  "format": "disabled"
                },
                "analyzer": "whitespace"
              }
            },
            "copy_to": [
              "search",
              "spelling",
              "autocomplete"
            ],
            "analyzer": "standard"
          }
        }
      }
    }
  }
}

```

```auto
{
  "magento2_default_catalog_product_20180124_102302": {
    "settings": {
      "index": {
        "creation_date": "1516789382129",
        "requests": {
          "cache": {
            "enable": "true"
          }
        },
        "number_of_replicas": "0",
        "translog": {
          "durability": "request",
          "disable_flush": "false"
        },
        "merge": {
          "scheduler": {
            "max_thread_count": "1"
          }
        },
        "uuid": "Pf9-vm2ZRqGoupq-KsUgtg",
        "analysis": {
          "char_filter": {
            "html_strip": {
              "type": "html_strip"
            }
          },
          "filter": {
            "phonetic": {
              "type": "phonetic",
              "encoder": "metaphone"
            },
            "word_delimiter": {
              "split_on_numerics": "1",
              "preserve_original": "1",
              "catenate_all": "1",
              "type": "word_delimiter",
              "catenate_words": "1",
              "catenate_numbers": "1",
              "split_on_case_change": "1",
              "generate_word_parts": "1"
            },
            "lowercase": {
              "type": "lowercase"
            },
            "pl_ascii_folding": {
              "type": "asciifolding",
              "preserve_original": "1"
            },
            "shingle": {
              "type": "shingle",
              "min_shingle_size": "2",
              "max_shingle_size": "2",
              "output_unigrams": "0"
            },
            "trim": {
              "type": "trim"
            },
            "ascii_folding": {
              "type": "asciifolding",
              "preserve_original": "0"
            }
          },
          "analyzer": {
            "whitespace": {
              "type": "custom",
              "char_filter": [
                "html_strip"
              ],
              "filter": [
                "word_delimiter",
                "lowercase",
                "ascii_folding",
                "trim"
              ],
              "tokenizer": "whitespace"
            },
            "shingle": {
              "type": "custom",
              "char_filter": [
                "html_strip"
              ],
              "filter": [
                "word_delimiter",
                "lowercase",
                "ascii_folding",
                "trim",
                "shingle"
              ],
              "tokenizer": "whitespace"
            },
            "phonetic": {
              "type": "custom",
              "char_filter": [
                "html_strip"
              ],
              "filter": [
                "word_delimiter",
                "lowercase",
                "ascii_folding",
                "trim",
                "phonetic"
              ],
              "tokenizer": "whitespace"
            },
            "standard": {
              "type": "custom",
              "char_filter": [
                "html_strip"
              ],
              "filter": [
                "word_delimiter",
                "lowercase",
                "ascii_folding",
                "trim"
              ],
              "tokenizer": "whitespace"
            },
            "sortable": {
              "type": "custom",
              "char_filter": [
                "html_strip"
              ],
              "filter": [
                "lowercase",
                "pl_ascii_folding",
                "trim"
              ],
              "tokenizer": "keyword"
            }
          }
        },
        "number_of_shards": "1",
        "refresh_interval": "1s",
        "version": {
          "created": "2040699"
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![pmalerowicz](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@pmalerowicz](https://discuss.elastic.co/u/pmalerowicz)\
**Post date:** [January 29, 2018, 9:32am UTC](https://discuss.elastic.co/t/problem-with-sorting-polish-words-es-2-4-6/116673/4 "2018-01-29T09:32:43Z")

</div>

whoever has any idea how to improve it?

---

<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:** [February 26, 2018, 9:32am UTC](https://discuss.elastic.co/t/problem-with-sorting-polish-words-es-2-4-6/116673/5 "2018-02-26T09:32:56Z")

</div>

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