In the previous section, we talked about simple data types. In this section, we will talk about how to set mapping for arrays, objects, and nested objects.
Complex data types
Array
There is no special data type for an array. A field can contain one or more fields of the same data type. Let's look at an example where we have two documents, as shown next:
Document 1:
{ "keyword_field" : "keyword1" }
Document 2:
{
"keyword_field" : ["keyword2", "keyword3"]
}
The mapping for keyword_field is defined as shown next:
{
"properties": {
"keyword_field": {
"type": "keyword"
}
}
}
No special handling is required for arrays...