如果您想获取该ID的类别名称,
{ "size": 0, "aggs": { "category": { "terms": { "field": "categoryId" }, "aggs":{ "categoryName" :{ "terms" :{ "field" :"categoryName" } } } } }}因此,子聚合(嵌套在上面)为您提供了id的categoryName。



