我有一个按预期工作的查询:
{
"query": {
"bool": {
"must": [
{
"term": {
"valueType": {
"value": "VARIABLE",
"boost": 1
}
}
},
{
"term": {
"intent": {
"value": "CREATED",
"boost": 1
}
}
},
{
"term": {
"value.name": {
"value": "item",
"boost": 1
}
}
},
{
"term": {
"recordType": {
"value": "EVENT",
"boost": 1
}
}
},
{
"query_string": {
"query": "*\\\"N_POLIZZA\\\"\\:\\\"2264798\\\"*",
"fields": [
"value.value"
]
}
}
]
}
},
"size": 10,
"from": 0,
"_source": true
}
这里是映射:
我想做的是按 processInstanceKey 聚合(分组依据),因此我在查询 {} 之后添加此内容:
{
"query": {
"bool": {
...
}
},
"aggs": {
"groupby_processInstanceKey": {
"terms": {
"field": "value.processInstanceKey"
}
}
},
"size": 10,
"from": 0,
"_source": true
}
但它不起作用,结果仍然相同,似乎没有进行聚合。我是新手,可能会错过一些东西。
聚合结果出现在点击之后,您需要滚动到底部才能看到聚合结果。
如果您对点击率不感兴趣,您也可以设置
"size": 0
只获得聚合结果。更新:
如果您想对存储桶进行分页,则需要使用带有源的
composite
聚合terms
。