Hi , I have a json structure like this : {
"zip": 67452,
"location": "NY",
"author": {
"book1": {
"price": 12
},
"book2": {
"price": 11
},
"book3": {
"price": 124
},
"book4": {
"price": 122
}
}
} I am trying to group and stats it for nested structure to get the avg price based on the `book*` as key was able to get the counts accurately using | spath output=bp path=author.book1.price | stats avg(bp) as avgPrice by location zip | stats list(zip) list(avgPrice) by location Now the next level grouping is by book* so that the query need not be run multiple times with different book* keys. i tried the rex but the field name is still constant 😞 . Any insights will be really helpful. Also is there a way to get the table lines in the stats result where it is not grouped for better readability? Update: Desired result BookName location zip avg(price) Book1 Newyork 64673 3433 53421 8678 NewJersey 35362 4435 34235 2425 Book2 Newyork 64673 3433 53421 8678 NewJersey 35362 4435 42352 2425 Arizona 25252 2525 I am able to get the table till location using nested stats, but the `book1` being a "key" rather than a value extraction is difficult
... View more