Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix duplication of dynamic fields on reconnect
If `setup.template.overwrite: true` is set the template is overwritten each time the Beat reconnects. The `dynamicTemplates` are a global variable that keeps state. This had the side effect that each time the template was generated for loading, the dynamic fields were append again. The logic in the code is changed now that each time when the template is generated first the dynamicFields array is reset. This also works with the new `append_fields` config option because it is read during the load process to also potentially add dynamic fields. The same applies to the default fields which are global. Also this array is reset. As default_fields were only used for Elasticsearch 7.0 is does not need an entry in the changelog. If possible in the future both variables should be part of the template object instead of being global. Unfortunately this would required major changes.
- Loading branch information