我正在尝试像下面那样运行过滤后的聚合但是会收到错误。 “[关联]中START_OBJECT的未知密钥:[disabledDate] 。任何人都可以查看该查询并建议所需的任何更改。
查询中的步骤: 1.查询版本日期小于或等于给定的所有文档 日期。 2.在Id上汇总。 3.运行subaggregation top hits查询,缺少disabledDate过滤器。 4.对缺少的disabledDate应用post过滤器。
{
"query": {
"bool": {
"must": [
{
"range": {
"versionDate": {
"from": null,
"to": "2016-05-25T20:53:22.742Z",
"include_lower": false,
"include_upper": true
}
}
},
{
"terms": {
"domainId": [
"yy"
]
}
},
{
"terms": {
"termId": [
"rr"
]
}
}
]
}
},
"aggregations": {
"associations": {
"terms": {
"field": "id",
"size": 0,
"execution_hint": "global_ordinals_low_cardinality",
"order": {
"_term": "asc"
},
"disabledDate": {
"filters": {
"missing": {
"field": "disbaledDate"
}
},
"aggregations": {
"top": {
"top_hits": {
"size": 1,
"_source": {
"includes": [],
"excludes": []
},
"sort": [
{
"versionDate": {
"order": "desc"
}
}
]
}
}
}
}
}
}
},
"post_filter": {
"missing": {
"field": "disabledDate"
}
}
}