我正在尝试聚合动态字段,类似于以下问题: How to aggregate over dynamic fields in elasticsearch?
以下评论帮我做到了, https://stackoverflow.com/a/32065070/5129194
现在我很难选择动态字段
“水桶”:[ { “key”:“color_family”, “doc_count”:2, “价值”:{ “doc_count_error_upper_bound”:0, “sum_other_doc_count”:0, “水桶”:[ { “关键”:“白色”, “doc_count”:1 },{ “关键”:“黑色”, “doc_count”:1 } ] } { “关键”:“纸张颜色”, “doc_count”:2, “价值”:{ “doc_count_error_upper_bound”:0, “sum_other_doc_count”:0, “水桶”:[ { “关键”:“白色”, “doc_count”:3 },{ “关键”:“绿色”, “doc_count”:1 } ] } },
当我做下面的事情时:我得到所有color_family和所有白色,因为它应该只是color_family中的白色。
{
"filter": {
"bool": {
"must": [
{
"match": {
"attributes.key": "color_family"
}
},
{
"match": {
"attributes.value": "white"
}
}
]
}
}
}
我正在寻找更像普通方面的工作,如果有任何问题在解决之前请告诉我。