Search code examples
c#elasticsearchnestaws-elasticsearch

Deleting a template after indexing documents


I have one index i elastic search and it is created using a template. I am thinking to stop using templates moving forward and convert to attributes in class using NEST.

Is it OK to delete the template from server and continue indexing documents in the same index?

I know that an index is tied to a template which started, not sure where to find information if deleting the template consequent documents indexed will adhere to the new rules via attributes.


Solution

  • Yes, its okay to delete a template once done. But why would you want to delete it? Index templates can stay there and be applied to indices based on index_patterns so it doesnt affect any other index schema.

    " I am thinking to stop using templates moving forward and convert to attributes in class using NEST"

    I dont think you should stop using index templates. Its easier to maintain and to define analyzers, synonyms, etc.

    Also, index templates are only applied when an index is created to define the schema. Here's a note from the documentation

    Templates are only applied at index creation time. Changing a template will have no impact on existing indices. When using the create index API, the settings/mappings defined as part of the create index call will take precedence over any matching settings/mappings defined in the template.