The generation of this map is not a problem for me as I can change the structure of the field to whatever I want. The problem is the query with script which ran over a very big dataset can be too expensive.
I could also create this field with information structured like:
{ "room": 2, "restroom": 1 }
or
{"topic": "room", "count": 2}, {"topic": "restroom", "count": 1 }
Thanks for helping!