Es query mapping and agg

How to realize agg according to dynamic map's key?

PUT aaa/1

{
  "name": {
    "first": "Alice",
    "1": "John"
  },
  "age": 26,
  "joiningDate": "2015-10-15"
}

PUT aaa/2

{
  "name": {
    "second": "Blob",
    "1": "2"
  },
  "age": 26,
  "joiningDate": "2015-10-15"
}

Here is the result i expect

{
  "1":["John","2"],
  "first":"Alice",
  "second":"Blob"
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.