【发布时间】:2018-05-21 13:42:22
【问题描述】:
我想聚合位于 nested 类型字段内的 keyword 类型字段。嵌套字段的映射如下:
"Nested_field" : {
"type" : "nested",
"properties" : {
"Keyword_field" : {
"type" : "keyword"
}
}
}
我用来聚合的查询部分如下:
"aggregations": {
"Nested_field": {
"aggregations": {
"Keyword_field": {
"terms": {
"field": "Nested_field.Keyword_field"
}
}
},
"filter": {
"bool": {}
}
},
}
但这并没有返回正确的聚合。即使有 Keyword_field 值现有文档,查询返回 0 个桶。所以,我的聚合查询有问题。谁能帮我找出问题所在?
【问题讨论】:
标签: elasticsearch elasticsearch-aggregation elasticsearch-mapping