У меня есть следующие требования:
Лат говорит, что мой aggregation
находится на поле - branchOfficeLocations.regTypeDRPCounts.drpType
, а мой filter
находится на поле - branchOfficeLocations.branchAddress.countryCode
Мне нужно поместить фильтр где-то внутри секции агрегации, но, похоже, не могу получить правильный запрос. Фильтр находится на поле второго уровня и отличается от поля агрегации на втором уровне.
Любая помощь будет оценена!
Ниже мой запрос:
{
"from": 0,
"size": 0,
"query": {
"bool": {
"must": [
{
"nested": {
"query": {
"bool": {
"must": [
{
"nested": {
"query": {
"term": {
"branchOfficeLocations.branchAddress.countryCode.keyword": {
"value": "usa",
"boost": 1.0
}
}
},
"path": "branchOfficeLocations.branchAddress",
"ignore_unmapped": false,
"score_mode": "none",
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
"path": "branchOfficeLocations",
"ignore_unmapped": false,
"score_mode": "none",
"boost": 1.0
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
"aggregations": {
"branchOfficeLocations.regTypeDRPCounts.drpType": {
"nested": {
"path": "branchOfficeLocations.regTypeDRPCounts"
},
"aggregations": {
"branchOfficeLocations.regTypeDRPCounts.drpType": {
"terms": {
"field": "branchOfficeLocations.regTypeDRPCounts.drpType.keyword",
"size": 100,
"min_doc_count": 1,
"shard_min_doc_count": 0,
"show_term_doc_count_error": true,
"order": [
{
"_count": "desc"
},
{
"_key": "asc"
}
]
},
"aggregations": {
"parent_count": {
"reverse_nested": {}
}
}
}
}
},
"branchOfficeLocations.regTypeDRPCounts.drpType_missing": {
"nested": {
"path": "branchOfficeLocations.regTypeDRPCounts"
},
"aggregations": {
"branchOfficeLocations.regTypeDRPCounts.drpType": {
"missing": {
"field": "branchOfficeLocations.regTypeDRPCounts.drpType.keyword"
},
"aggregations": {
"parent_count": {
"reverse_nested": {}
}
}
}
}
}
}