https://www.elastic.co/guide/cn/elasticsearch/guide/current/_Sorting.html
{
"query": {
"bool": {
"must": [
{
"match": {
"title": "第一"
}
}
],
"must_not": [],
"should": []
}
},
"sort": {
"id": {
"order": "asc"
}
},
"from": 0,
"size": 10
}
假定我们想要结合使用 date 和 _score 进行查询,并且匹配的结果首先按照日期排序,然后按照相关性排序:
{
"query": {
"bool": {
"must": [
{
"match": {
"title": "第一"
}
}
],
"must_not": [],
"should": []
}
},
"sort": [
{
"id": {
"order": "desc"
}
},
{
"_score": {
"order": "desc"
}
}
],
"from": 0,
"size": 10
}