Unexpected (case-insensitive) string sorting in Elasticsearch

老子叫甜甜 提交于 2019-12-05 18:05:49

Okay so I discovered the reason wasn't anything to do with the /. ES will sort by capital letters then lower case letters.

I added a custom analyzer to the settings of the index creation:

{
    "analysis": {
        "analyzer": {
            "sortable": {
                "tokenizer": "keyword",
                "filter": [
                    "lowercase"
                ]
            }
        }
    }
}

Then in the field mapping I added 'analyzer': 'sortable' to the sort_name multi field.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!