Mapping arrays
Arrays or multi-value fields are very common in data models, but not natively supported in traditional SQL solutions.
In SQL, multi-value fields require the creation of accessory tables that must be joined to gather all the values, resulting in poor performance when the cardinality of records is huge.
Getting ready
You need a working ElasticSearch cluster.
How to do it...
Every field is automatically managed as an array. For example, to store tags for a document, the mapping will be as shown in the following code snippet:
{ "document" : { "properties" : { "name" : {"type" : "string", "index":"analyzed"}, "tag" : {"type" : "string", "store" : "yes" , "index":"not_analyzed"}, } } }
This mapping is valid for indexing the following documents:
{"name": "document1", "tag": "awesome"...