Mapping an object
The object is the base structure (analogous to a record in SQL). Elasticsearch extends the traditional use of objects allowing recursive embedded objects.
Getting ready
You need an up-and-running Elasticsearch installation as we described in the Downloading and installing Elasticsearch recipe in this Chapter 2, Downloading and Setup.
To execute curl
via the command line, you need to install curl
for your operative system.
How to do it...
We can rewrite the mapping of order type form of the mapping the base types recipe using an array of items:
{ "order" : { "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"}, "vat" : {"type" : "double"} ...