Hi,
I have a use-case which I can't seem to resolve.
I have in a document a map of animals, the key is the animal name, the values is an object with information on that animal, for example:
{
"animals": {
"cats": {
"count": 8,
"maxAge": 12,
"minAge": 1
},
"elephants": {
"count": 5,
"maxAge": 120,
"minAge": 30
}
}
}
Now, I want to aggregate all such documents, but because the name of the animal, is the field name, I don't know how to do it. For example:
- Piecharts of all animal names, where the slice size is the sum of counts of all that animal's entries.
- Table showing the animal name, min of min age, max of max age, sum of count
Hope the example is clear.
I have no problem with changing how this information is represented, BUT, it's important that a single document can hold the information on several animals, not just one animal at a time.
If I split a single document into multiple documents, one document for each animal, with a "animalName" field, the solution is clear and trivial. But do I HAVE to do it, because that's how ES/kibana works?
Thanks in advance,
Tal