我想按countryCode,州,countrySubdivisionCode,product_category进行汇总。这是我的数据,
{
"_index": "test",
"_type": "test",
"_id": "im5SGGwBgEDfo4bgDauP",
"_score": 1,
"_source": {
"data": {
"dimensions": {
"countryCode": "434",
"state":"maharashtra",
"subdivision": {
"countrySubdivisionCode": "KZ-KUS",
"category": {
"product_category": 1
}
}
}
},
"status": "activated"
}
}
我尝试按国家/地区代码和州进行汇总
{
"size": 0,
"aggs": {
"header": {
"nested": {
"path": "data.dimensions"
},
"aggs": {
"keysResult": {
"terms": {
"script":"'countryCode:'+doc['data.dimensions.countryCode.keyword'].value+'|'+'state:'+doc['data.dimensions.state.keyword'].value"
}
}
}
}
}
}
上面的查询正常工作。
如果要在数据内部的任何字段(深度级别)上聚合,应该查询什么。
有什么方法可以在路径中使用通配符(例如:data。*)查询嵌套字段?