Skip to content

Commit

Permalink
Do not require template if index change and template disabled (elasti…
Browse files Browse the repository at this point in the history
…c#5319) (elastic#5334)

* Do not require template if index change and template disabled

If the elasticsearch index name is changed, its required to set a template. The error message was also shown when template itself are disabled. This is now changed that if templates are disabled, no error is returned.

Closes elastic#5308

* Add Changelog

(cherry picked from commit ce9e47b)
  • Loading branch information
ruflin authored and tsg committed Oct 6, 2017
1 parent 6b20266 commit 316417a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ https://github.com/elastic/beats/compare/v6.0.0-rc1...master[Check the HEAD diff
*Affecting all Beats*

- Fix data race accessing watched containers. {issue}5147[5147]
- Do not require template if index change and template disabled {pull}5319[5319]

*Auditbeat*

Expand Down
2 changes: 1 addition & 1 deletion libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ func (b *Beat) registerTemplateLoading() error {
return err
}

if esCfg.Index != "" && (cfg.Name == "" || cfg.Pattern == "") {
if esCfg.Index != "" && (cfg.Name == "" || cfg.Pattern == "") && (b.Config.Template == nil || b.Config.Template.Enabled()) {
return fmt.Errorf("setup.template.name and setup.template.pattern have to be set if index name is modified.")
}

Expand Down

0 comments on commit 316417a

Please sign in to comment.