Is it possible to aggregate the keys of fields of Elastic documents? I read through the Elastic aggregation documentation and tried some coding, but didn't succeed.
Existing documents:
{
"analysis": {
"v1": {"a":1, "b":2}
}
}
{
"analysis": {
"v1": {"a":3, "b":4}
}
}
{
"analysis": {
"v2": {"a":5, "b":6}
}
}
{
"analysis": {
"v1": {"a":7, "b":8},
"v2": {"a":9, "b":10},
}
}
Expected outcome of the aggregation is the count of keys:
{
"v1": 3,
"v2": 2
}
Updated source JSON