Get the counts at each levels in a tree like document structure


(Nikhil Kumar Kadayinti) #1

Example data
{
"userName": "spyderman",
"phoneNumber": "123ertre67890",
"devicegroup": "Globe/India/Delhi/Parkstreet/building0/401B",
"address": "#complete address with postal codes",
},
{
"userName": "batman",
"phoneNumber": "12345fas890",
"devicegroup": "Globe/India/delhi/Parkstreet/building0/402B",
"address": "#complete address with postal codes",
},
{
"userName": "superman",
"phoneNumber": "123456asf0",
"devicegroup": "Globe/India/delhi/gandhistreet/building0/401A",
"address": "#complete address with postal codes",
},

I wish to get the counts at each level:
The documents will not be duplicated (generates one per user registration into the system)
output desired:

countries @global level

cities @ country level

buildings @ street level

users @ street level and # users @ building level

I was thinking to use path tokenizers but then not sure how i can get the counts in the way i desire. can someone guide in this regard.


(Mark Walkom) #2

Please don't post the same question more than once, it makes it harder for people to help.

Let's continue the discussion in Get the count in a tree like structure of items


(Mark Walkom) #3