无法通过管道聚合在Elastic Search中排序

时间:2020-01-09 07:58:32

标签: amazon-web-services elasticsearch amazon-elasticsearch

我正在尝试对ES查询中的某些数据进行排序。我尝试了很多事情,花了很多时间,但是找不到解决方案。下面是查询。 在此先感谢您的帮助。

"size":0,
"aggs":{ 
"abc":{ 
"composite":{ 
"sources":[ 
{ 
"abc_id":{ 
"terms":{ 
"field":"l1.id"
}
}
}
],
"size":"100"
},
"aggs":{ 
"impressions":{ 
"filters":{ 
"filters":[ 
{ 
"bool":{ 
"must":[ 
{ 
"exists":{ 
"field":"l3.imp"
}
}
]
}
}
]
},
"aggs":{ 
"kpi":{ 
"bucket_script":{ 
"buckets_path":{ 
"imp":"sum_of_imp"
},
"script":"params.imp"
}
},
"sum_of_imp":{ 
"sum":{ 
"field":"l3.imp"
}
},
"sorting_sum_of_imp":{
  "bucket_sort": {
    "sort": [{
      "sum_of_imp":{
        "order":"desc"
      }
    }]
  }
}
}
}
}
}
},
"query":{ 
"bool":{ 
"filter":{ 
"bool":{ 
"must":[ 
{ 
"term":{ 
"ar.type":"search"
}
},
{ 
"range":{ 
"as_on":{ 
"gte":"2018-12",
"lte":"2019-12"
}
}
}
],
"must_not":[ 
]
}
}
}
}
}

0 个答案:

没有答案
相关问题