Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for templates index_patternsfield in ES >= 6.0 #4056

Merged
merged 1 commit into from
Apr 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]
- Updated to Go 1.8.1. {pull}4033[4033]
- Add kubernetes processor {pull}3888[3888]
- Add support for include_labels and include_annotations in kubernetes processor {pull}4043[4043]
- Support new `index_patterns` field when loading templates for Elasticsearch >= 6.0 {pull}4056[4056]

*Filebeat*

Expand Down
8 changes: 7 additions & 1 deletion libbeat/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ func (t *Template) generate(properties common.MapStr, dynamicTemplates []common.
"settings": common.MapStr{
"index.refresh_interval": "5s",
},
"template": t.GetName() + "-*",
}

// ES 6 moved from template to index_patterns: https://github.com/elastic/elasticsearch/pull/21009
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to have the link to the github issue here. makes it easy to track the change later again.

if t.esVersion.major >= 6 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably enhance version in the future to also support GreaterThenfunctions or similar. This will do for the moment.

basicStructure.Put("index_patterns", []string{t.GetName() + "-*"})
} else {
basicStructure.Put("template", t.GetName()+"-*")
}

if t.esVersion.IsMajor(2) {
Expand Down