In the previous section, we learnt how to perform CRUD operations with Elasticsearch. In the process, we saw how indexing the first document to an index which doesn't yet exist results in the creation of the new index and the mapping of the type.
Usually, you wouldn't want to let things happen automatically, as you would want to control how indices are created and also how mapping is created. We will see how you can take control of this process in this section and look at the following:
- Creating an index
- Create a mapping
- Updating a mapping
You can create an index and specify the number of shards and replicas to create:
PUT /catalog { "settings": { "index": { "number_of_shards": 5, "number_of_replicas": 2 } } }
It is possible to specify a mapping for a type at the time of index creation. The following command will create an index called catalog with five shards and two replicas. Additionally, it also defines...