I first write data directly to the specified index, and then create an index template,
After the index template is created, I continue to write data into the specified index. At this time, I write the new properties of the object, and I feel that the index template does not take effect for it.
An index template is a way to tell Elasticsearch how to configure an index when it is created. For data streams, the index template configures the stream’s backing indices as they are created. Templates are configured prior to index creation. When an index is created - either manually or through indexing a document - the template settings are used as a basis for creating the index.
I do not think a newly added or changed template gets applied after creation, but could be wrong.
If I create a template first and then add data, why does the dynamic template take effect at this time? After all, the fields in the data added at the beginning are not necessarily complete?
Check the mappings of the index after it has been created and you will see the index template has been applied. including the dynamic section. This determines how future fields are mapped.
You are right, I looked at the mapping of the index and found that when the index was created, the mapping in the template was directly inherited to the mapping of its own index.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.