Elasticsearch aggregation with hierarchical category, subcategory; limit the levels
问题 I have products with categories field. Using the aggregation I can get the full categories with all subcategories. I want to limit the levels in the facet. e.g. I have the facets like: auto, tools & travel (115) auto, tools & travel > luggage tags (90) auto, tools & travel > luggage tags > luggage spotters (40) auto, tools & travel > luggage tags > something else (50) auto, tools & travel > car organizers (25) Using aggregation like "aggs": { "cat_groups": { "terms": { "field": "categories