Skip to content

Commit

Permalink
Cherry-pick #20218 to 7.x: Increase index.max_docvalue_fields_search …
Browse files Browse the repository at this point in the history
…to 200 (#20222)

* Increase index.max_docvalue_fields_search to 200 (#20218)

The number of docvalue fields in Filebeat went beyond 100 and Discover was not loading.
I added settings.index.max_docvalue_fields_search=200 to the default index template.
In Filebeat there are about 117 fields now.

Fixes #20215

(cherry picked from commit e95a905)
  • Loading branch information
andrewkroh authored Aug 4, 2020
1 parent 9615f41 commit f91089f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ field. You can revert this change by configuring tags for the module and omittin
- Add the `overwrite_keys` configuration option to the dissect processor. {pull}19464[19464]
- Add support to trim captured values in the dissect processor. {pull}19464[19464]
- Added the `max_cached_sessions` option to the script processor. {pull}19562[19562]
- Set index.max_docvalue_fields_search in index template to increase value to 200 fields. {issue}20215[20215]
- Add capability of enriching process metadata with contianer id also for non-privileged containers in `add_process_metadata` processor. {pull}19767[19767]

*Auditbeat*
Expand Down
11 changes: 8 additions & 3 deletions libbeat/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ import (

var (
// Defaults used in the template
defaultDateDetection = false
defaultTotalFieldsLimit = 10000
defaultNumberOfRoutingShards = 30
defaultDateDetection = false
defaultTotalFieldsLimit = 10000
defaultNumberOfRoutingShards = 30
defaultMaxDocvalueFieldsSearch = 200

// Array to store dynamicTemplate parts in
dynamicTemplates []common.MapStr
Expand Down Expand Up @@ -325,6 +326,10 @@ func buildIdxSettings(ver common.Version, userSettings common.MapStr) common.Map
indexSettings.Put("query.default_field", fields)
}

if ver.Major >= 6 {
indexSettings.Put("max_docvalue_fields_search", defaultMaxDocvalueFieldsSearch)
}

indexSettings.DeepUpdate(userSettings)
return indexSettings
}
Expand Down
3 changes: 3 additions & 0 deletions libbeat/template/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,23 @@ func TestTemplate(t *testing.T) {
template.Assert("index_patterns", []string{"testbeat-" + currentVersion + "-*"})
template.Assert("order", 1)
template.Assert("mappings.doc._meta", common.MapStr{"beat": "testbeat", "version": currentVersion})
template.Assert("settings.index.max_docvalue_fields_search", 200)
})

t.Run("for ES 7.x", func(t *testing.T) {
template := createTestTemplate(t, currentVersion, "7.2.0", DefaultConfig())
template.Assert("index_patterns", []string{"testbeat-" + currentVersion + "-*"})
template.Assert("order", 1)
template.Assert("mappings._meta", common.MapStr{"beat": "testbeat", "version": currentVersion})
template.Assert("settings.index.max_docvalue_fields_search", 200)
})

t.Run("for ES 8.x", func(t *testing.T) {
template := createTestTemplate(t, currentVersion, "8.0.0", DefaultConfig())
template.Assert("index_patterns", []string{"testbeat-" + currentVersion + "-*"})
template.Assert("order", 1)
template.Assert("mappings._meta", common.MapStr{"beat": "testbeat", "version": currentVersion})
template.Assert("settings.index.max_docvalue_fields_search", 200)
})
}

Expand Down

0 comments on commit f91089f

Please sign in to comment.