Mapping example

Let's re-create another index, second_index, which is similar to our first_index with static mapping, where we will define the data type of each field separately:

curl -XPUT localhost:9200/second_index -d '{"mappings": {"customer": {"_source": {"enabled": false},"properties": {"name": {"type": "string", "store": true},"birthdate": {"type": "string"},"street": {"type": "string"},"city": {"type": "date"},"state": {"type": "string", "index": "no", "store": true}"zip": {"type": "string", "index": "no", "store": true}}}}}

Let's understand the preceding mapping. We disable the _source field for the customer type. It means, we get rid of the default behavior, where Elasticsearch stores and indexes the document by default. Now, since ...

Get Modern Big Data Processing with Hadoop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.