gpt4 book ai didi

elasticsearch - Elasticsearch 5.6聚合平均而言并非所有存储桶都返回

转载 作者:行者123 更新时间:2023-12-03 02:13:15 30 4
gpt4 key购买 nike

我在ES 5.6上有以下查询:

{
"size": 0,
"query": {
"exists": {
"field": "description.keyword"
}
},
"aggs": {
"group_by_source": {
"terms": {
"field": "flux.source.idname.keyword",
"size": 1000
},
"aggs": {
"description_avg": {
"avg": {
"script": {
"lang": "painless",
"source": "doc['description.keyword'].toString().length()"
}
}
}
}
}
}
}
这对我想做的事情有效(按源显示描述长度平均),但结果只能看到6个存储桶:
enter image description here
知道为什么吗?
提前致谢,
朱利安

最佳答案

{ "size": 0, "query": {"exists": {"field": "description.keyword"} }, "aggs": {"group_by_source": {"terms": {"field": "flux.source.name.keyword","size": 1000},"aggs": {"description_avg": {"avg": {"script": {"lang": "painless","source": "doc['description.keyword'].toString().length()"}}}}} } }

关于elasticsearch - Elasticsearch 5.6聚合平均而言并非所有存储桶都返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64157853/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com