How to do it...

A nested object is defined as the standard object with the nested type.

From the example in the Mapping an object recipe, we can change the type from object to nested as follows:

PUT test/_mapping
{
"properties" : {
"id" : {"type" : "keyword"},
"date" : {"type" : "date"},
"customer_id" : {"type" : "keyword"},
"sent" : {"type" : "boolean"},
"item" : {"type" : "nested",
"properties" : {
"name" : {"type" : "keyword"},
"quantity" : {"type" : "long"},
"price" : {"type" : "double"},
"vat" : {"type" : "double"}
}
}
}
}