Elasticsearch错误语法:在[桶]中找到两个聚合类型定义:[composite]和[sum_bucket]
我使用Elasticsearch 6.1并在聚合中使用复合和sum_bucket时会出现错误。
这给我带来了一个错误:
原因:在[my_buckets_sale]中找到两个聚合类型定义]:[composite]和[sum_monthly_sales] 这是我想做的示例:
{
...
"size": 0,
"aggs" : {
"my_buckets_sale" : {
composite: {
size : 4,
sources : [
{
date : {
date_histogram : {
field : '@timestamp',
interval : 'day',
},
},
},
},
],
}
"date_histogram" : {
"field" : "date",
"interval" : "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
"sum_monthly_sales": {
"sum_bucket": {
"buckets_path": "my_buckets_sale>sales"
}
}
}
},
}
有人知道如何完成所有桶的总和,以保持我的复合材料?
I use ElasticSearch 6.1 and get an error when I try to use composite and sum_bucket together in my aggregation.
It get me an error:
Reason: Found two aggregation type definitions in [my_buckets_sale]: [composite] and [sum_monthly_sales]",
Here is a example of what I want to do :
{
...
"size": 0,
"aggs" : {
"my_buckets_sale" : {
composite: {
size : 4,
sources : [
{
date : {
date_histogram : {
field : '@timestamp',
interval : 'day',
},
},
},
},
],
}
"date_histogram" : {
"field" : "date",
"interval" : "month"
},
"aggs": {
"sales": {
"sum": {
"field": "price"
}
}
}
"sum_monthly_sales": {
"sum_bucket": {
"buckets_path": "my_buckets_sale>sales"
}
}
}
},
}
Does anyone know how to do the sum of all the buckets, with keeping my composite ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想做的是保持复合汇总,同时仍然每月获得所有销售的总和?
这样的结构:
只需在日期直方图上创建一个子聚集,就可以根据需要为您提供总和。无需将其与复合加剧混合。
谢谢。
What you want to do is keep the composite aggregation as it is while still getting the sum of all the sales in every month?
Structure like this:
Just create a subaggregation on the date histogram to give you the sum as you required. There is no need to mix this with the composite aggrgation.
THanks.