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' 替换为你的索引名称,然后发送相应的请求即可。
原文地址: https://www.cveoy.top/t/topic/qaHF 著作权归作者所有。请勿转载和采集!