Setting up index templates
One important step while setting up your index is defining the mapping for the types, number of shards, replica, and other configurations. Depending upon the complexity of the types within your index, this step can involve a substantial amount of configuration.
Index templates allow you to create indexes based on a given template, rather than creating each index manually beforehand. Index templates allow you to specify settings and mappings for the index to be created. Let's understand this by going through the following points:
- Defining an index template
- Creating indexes on the fly
Let's say we want to store sensor data from various devices and we would like to create one index per day. At the beginning of every day, we want a new index to be created whenever the first sensor reading is indexed for that day. We will look into the details as to why we should use such time-based indices in the next section.
Defining an index template
We start by defining an index template...