Templates and dynamic templates
In the Mappings configuration section of Chapter 2, Indexing Your Data, we discussed mappings, how they are created, and how the type-determining mechanism works. Now we will get into more advanced topics. We will show you how to dynamically create mappings for new indices and how to apply some logic to the templates, so that new indices are already created with predefined mappings.
Templates
In various parts of the book, when discussing index configuration and its structure, we've seen that this can become complicated, especially when we have sophisticated data structures that we want to index, search, and aggregate. Especially if you have a lot of similar indices, taking care of the mappings in each of them can be a very painful process – each new index has to be created with appropriate mappings. Elasticsearch creators predicted this and implemented a feature called index templates. Each template defines a pattern, which is compared to a newly created index...