相关疑难解决方法(0)

如何在不返回Elasticsearch中的所有存储区的情况下执行管道聚合

我正在使用Elasticsearch 2.3,我正在尝试使用管道聚合执行两步计算.我只对管道聚合的最终结果感兴趣,但Elasticsearch返回所有桶信息.

由于我有大量的桶(数十或数亿),这是令人望而却步的.不幸的是,我找不到告诉Es不要返回所有这些信息的方法.

这是一个玩具的例子.我有test-index一个文档类型的索引obj.obj有两个字段,keyvalues.

curl -XPOST 'http://10.10.0.7:9200/test-index/obj' -d '{
  "value": 100,
  "key": "foo"
}'

curl -XPOST 'http://10.10.0.7:9200/test-index/obj' -d '{
  "value": 20,
  "key": "foo"
}'

curl -XPOST 'http://10.10.0.7:9200/test-index/obj' -d '{
  "value": 50,
  "key": "bar"
}'

curl -XPOST 'http://10.10.0.7:9200/test-index/obj' -d '{
  "value": 60,
  "key": "bar"
}'

curl -XPOST 'http://10.10.0.7:9200/test-index/obj' -d '{
  "value": 70,
  "key": "bar"
}'
Run Code Online (Sandbox Code Playgroud)

我想得到具有相同s 的s key的最小值的平均值(在所有s上).平均最小值.valueobjkey

Elasticsearch允许我这样做:

curl -XPOST 'http://10.10.0.7:9200/test-index/obj/_search' -d '{
  "size": 0,
  "query": …
Run Code Online (Sandbox Code Playgroud)

elasticsearch elasticsearch-aggregation

9
推荐指数
1
解决办法
2927
查看次数