我有如下所示的ES查询:
{"query":{"bool":{"must":[{"bool":{"should":[{"bool":{"must":[{"bool":{"should":[{"match":{"*login*":{"query":"jyo","operator":"and"}}}]}}],"boost":1.34}}]}}]}},"sort":[{"_uid":"desc"}]}
The output is :
{
"took": 77,
"timed_out": false,
"_shards": {
"total": 33,
"successful": 33,
"failed": 0
},
"hits": {
"total": 4,
"max_score": null,
"hits": [
{
"_index": "hobbes1.qa_en_19_2",
"_type": "esuser",
"_id": "6",
"_score": null,
"sort": [
"esuser#6"
]
},
{
"_index": "hobbes1.qa_en_19_2",
"_type": "esuser",
"_id": "5",
"_score": null,
"sort": [
"esuser#5"
]
},
{
"_index": "hobbes1.qa_en_19_2",
"_type": "esuser",
"_id": "4",
"_score": null,
"sort": [
"esuser#4"
]
},
{
"_index": "hobbes1.qa_en_19_2",
"_type": "esuser",
"_id": "10003",
"_score": null,
"sort": [
"esuser#10003"
]
}
]
}
}
如果按_id排序,那么10003不应位于顶部吗?我正在使用Elasticsearch 1.7版。请帮忙。
答案 0 :(得分:0)
因为_id
不是number
,而是string
,所以字符串比较中的“ 10003”小于“ 4”,“ 5”或“ 6”。