疲劳是最舒适的枕头,努力工作吧。

es排序asc时,怎么把空值放在前面

Elasticsearch | 作者 liuliuliu | 发布于2018年11月12日 | 阅读数:6737

对某个字段进行sort排序时,不管升序还是降序,空值都是排在最后面,可不可以asc的时候排在最前面,desc的时候排在最后面
已邀请:

rochy - rochy_he

赞同来自: liuliuliu

GET /_search
{
"sort" : [
{ "price" : {"missing" : "_last"} }
],
"query" : {
"term" : { "product" : "chocolate" }
}
}
 
具体可参考:https://www.elastic.co/guide/e ... .html

要回复问题请先登录注册