Indexing Nested Dynamic Map in Elastisearch and build a facet out of it

I am stuck where I want to index Map>> in elastic search efficiently and build a facet/aggregation out of it.

Use case is consider the below data structure ( a general case of category and subcategory)

Data is of the form

"data" :
{
"name" : "foo",
"categoryInfo":{
"cat1": {
subcat1,
subcat2
},
"cat2" : {
subcat3,
subcat4,
subcat1
}
}
}