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.
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 ...