es查询排序的写法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiejunna/article/details/87720274

sort字段指定排序,倒序:"sort": { "tftxtime": { "order": "desc" }}
查询条件格式如下:

{
	"query": {
		"bool": {
			"must": [],
			"must_not": [{
					"term": {
						"flow_yh_yh_location": ""
					}
				},
				{
					"term": {
						"routemcc": "1111"
					}
				},
				{
					"term": {
						"routemcc": "2222"
					}
				}
			],
			"should": [{
				"match_all": {}
			}]
		}
	},
	"from": 0,
	"size": 10,
	"sort": {
		"tftxtime": {
			"order": "desc"
		}
	},
	"aggs": {}
}

json压缩后:

{"query":{"bool":{"must":[],"must_not":[{"term":{"flow_yh_yh_location":""}},{"term":{"routemcc":"1111"}},{"term":{"routemcc":"2222"}}],"should":[{"match_all":{}}]}},"from":0,"size":10,"sort":{"tftxtime":{"order":"desc"}},"aggs":{}}

猜你喜欢

转载自blog.csdn.net/xiejunna/article/details/87720274