Mapping a Product/Category Tree

Hello together,
i am new to elastic and just creating a new index for my webshop.
In this shop i have n categories with n products.
Each product can have n categories and the categories can have parent categories.



Now I am searching for the best solution to create my index. After indexing my products i want to filter by category and level.

At the moment the best solution for me is:
create a Index with all category-IDs and parentcategoryIDs in which this product is listed. So i can filter the products.
product1 => cat1,cat2,cat3,cat4,cat5
product2 => cat1, cat6

now i am searching the solution for how to index the categories in my products, so i can show a aggregation of category-tree-name and category-tree-ids.
So i can show them in json and filter again for the categories.

Perhaps somebody can help me to find the best solution. I searched the web, but cant find a solution which seems to be perfect.

THANKS in advance!!!

Did you find any solution?

i found GitHub - jprante/elasticsearch-aggregations: More aggregations for Elasticsearch but is not working with es 5.x

Best regards