Skip to content

Commit

Permalink
update object enabled:false index pattern attribs (#9644)
Browse files Browse the repository at this point in the history
* update object enabled:false index pattern attribs
  • Loading branch information
graphaelli authored and simitt committed Dec 19, 2018
1 parent 1ed8e32 commit a615441
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha1...master[Check the HEAD d
- When collecting swap metrics for beats telemetry or system metricbeat module handle cases of free swap being bigger than total swap by assuming no swap is being used. {issue}6271[6271] {pull}9383[9383]
- Adding logging traces at debug level when the pipeline client receives the following events: onFilteredOut, onDroppedOnPublish. {pull}9016[9016]
- Ignore non index fields in default_field for Elasticsearch. {pull}9549[9549]
- Update Kibana index pattern attributes for objects that are disabled. {pull}9644[9644]
- Enforce validation for the Central Management access token. {issue}9621[9621]

*Auditbeat*
Expand Down
10 changes: 9 additions & 1 deletion libbeat/kibana/fields_transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,15 @@ func transformField(version *common.Version, f common.Field) (common.MapStr, com
}

if f.Type == "object" && f.Enabled != nil {
field["enabled"] = getVal(f.Enabled, true)
enabled := getVal(f.Enabled, true)
field["enabled"] = enabled
if !enabled {
field["aggregatable"] = false
field["analyzed"] = false
field["doc_values"] = false
field["indexed"] = false
field["searchable"] = false
}
}

if f.Type == "text" {
Expand Down
1 change: 1 addition & 0 deletions libbeat/kibana/fields_transformer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ func TestTransformMisc(t *testing.T) {
{commonField: common.Field{Type: "binary", Enabled: &truthy}, expected: nil, attr: "enabled"},
{commonField: common.Field{Type: "object", Enabled: &truthy}, expected: true, attr: "enabled"},
{commonField: common.Field{Type: "object", Enabled: &falsy}, expected: false, attr: "enabled"},
{commonField: common.Field{Type: "object", Enabled: &falsy}, expected: false, attr: "doc_values"},

// indexed
{commonField: common.Field{Type: "binary"}, expected: false, attr: "indexed"},
Expand Down

0 comments on commit a615441

Please sign in to comment.