Mapping an object
The object is the base structure (analogous to a record in SQL). ElasticSearch extends the traditional use of objects, allowing the use of recursive embedded objects.
Getting ready
You need a working ElasticSearch cluster.
How to do it...
You can rewrite the mapping of the order
type form of the Mapping base types recipe using an array of items:
{ "order" : { "properties" : { "id" : {"type" : "string", "store" : "yes", "index":"not_analyzed"},"date" : {"type" : "date", "store" : "no", "index":"not_analyzed"},"customer_id" : {"type" : "string", "store" : "yes","index":"not_analyzed"},"sent" : {"type" : "boolean", "store" : "no","index":"not_analyzed"}, "item" : { "type" : "object", "properties" : { "name" : {"type" : "string", "store" : "no","index":"analyzed"}, "quantity" : {"type" : "integer", "store" : "no","index":"not_analyzed"}, "vat" : {"type" : "double", "store" : "no","index":"not_analyzed"} } ...