How to do it...

We can rewrite the mapping code found in the previous example recipe using an array of items:

PUT test/_doc/_mapping
{
"properties" : {
"id" : {"type" : "keyword"},
"date" : {"type" : "date"},
"customer_id" : {"type" : "keyword", "store" : "yes"},
"sent" : {"type" : "boolean"},
"item" : {
"type" : "object",
"properties" : {
"name" : {"type" : "text"},
"quantity" : {"type" : "integer"},
"price" : {"type" : "double"},
"vat" : {"type" : "double"}
}
}
}
}