Elasticsearch 如何根据数字大小对id进行排序
在Elasticsearch中,可以使用"sort"参数来根据数字大小对id进行排序。以下是一些示例代码:
- 使用"_search" API进行搜索并根据数字大小对id进行升序排序:
GET /your_index/_search
{
"sort": [
{
"id": {
"order": "asc"
}
}
]
}
- 使用"_search" API进行搜索并根据数字大小对id进行降序排序:
GET /your_index/_search
{
"sort": [
{
"id": {
"order": "desc"
}
}
]
}
请将"your_index"替换为你的索引名称,然后发送相应的请求即可。
原文地址: http://www.cveoy.top/t/topic/is74 著作权归作者所有。请勿转载和采集!