Dynamic template vs Index template with explicit mapping in terms of performance

Considering both search response speed and indexing rate (in my case the latter is more important ), which is more efficient? Dynamic template or Index template with explicit mapping ? It depends on my environment?

It has no impact on query performance. When it comes to indexing dynamic mappings allows new fields to be added over time. Each time a new field is added the cluster state need to be updated. Adding a lot of new fields can therefore slow down indexing. If you however are not adding new fields there should not be any performance difference at all.

@Christian_Dahlqvist Does dynamic "template" need more resource when indexing like dynamic mapping does? I thought dynamic template defines match_mapping_type or matching prefix of field before indexing so it is more efficient than dynamic "mapping"

there are no difference between them?

Technically yes, dynamic needs more resources as Elasticsearch needs to parse the field the first time it sees it and then tries to match it to one of the field types, so there's a computational cost there.

In practise, the overhead isn't worth worrying about and I don't even think we've measured it.

Only for the first time. Once the field is dynamically selected, it'll be fixed to that type in _mappings forever (life time of that index).
So indexing performance downside will be negligible per @warkolm.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.