Elasticsearch sorting on string not returning expected results

前端 未结 2 1096
一生所求
一生所求 2021-02-13 14:43

When sorting on a string field with multiple words, Elasticsearch is splitting the string value and using the min or max as the sort value. I.E.: when sorting on a field with th

2条回答
  •  猫巷女王i
    2021-02-13 15:17

    As mconlin mentioned if you want to sort on the unanalyzed doc field you need to specify "index": "not_analyzed" to sort as you described. But if you're looking to be able to keep this field tokenized to search on, this post by sloan shows a great example. Using multi-field to keep two different mappings for a field is very common in Elasticsearch.

    Hope this helps, let me know if I can offer more explanation.

提交回复
热议问题