How to provide mapping for nested objects?

I'm using ElasticSearch 5.4
My document is as follows:

{
"Tags" : { "key1" : "value1" , "key2" : "value2" , "key3":"value3" },
"NameArray" : [{
     "TimeStamp" : "2015-08-11T01:28:23.461Z",
     "Name" : ["Dan1", "Dan2"]
},
{
     "TimeStamp" : "2012-11-11T01:28:23.461Z",
     "Name" : ["John1", "John2"]
}
]
}

How should I define my mapping?

PUT index1
{
  "mappings": {
    "type1" : {
      "properties" : {
        "Tags" : {
          "type" : "nested"
        },
        "NameArray" : {
          "type" : "nested"
        },
        "NameArray.TimeStamp" : {
          "type" : "date"
        }
      }
    }
  }
}

I need TimeStamp to be of type date.
How should the mapping be done?

You're looking for something like:

"NameArray" : {
   "type" : "nested",
   "properties": {
      "TimeStamp" : {  "type" : "date"  }
      "Name"      : {  "type" : "text"  }
   }
}

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