我是一名有用的助手,可以为您翻译以下内容:
但我在写相等的DSL查询时遇到了问题:
我正在尝试在Elasticsearch中创建聚合结果,但筛选选项对我无效。
我可以在没有筛选器的情况下聚合数据,例如
select name , material ,sum(price)
from products group by name , material
curl -XGET 'http://localhost:9200/products/_search?pretty=true' -d'
{
"aggs" : {
"product" : {
"terms" : {
"field" : "name"
},
"aggs" : {
"material" : {
"terms" : {
"field" : "material"
},
"aggs" : {
"sum_price" : {
"sum" : {
"field" : "price"
}
}
}
}
}
}
},
"size" : 0
}'
但我在写相等的DSL查询时遇到了问题:
select name , material ,sum(price)
from products
where material = "wood"
group by name , material
query
子句,并在其中包含术语查询。 - Konstantin V. Salikhov