Skip to content

Commit

Permalink
es: use ignore_above setting for flattened mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
lebauce committed Mar 30, 2021
1 parent 88812a7 commit e6368cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion analyzer/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ func newGraphBackendFromConfig(etcdClient *etcd.Client) (graph.PersistentBackend
var mapping map[string]interface{}
if useFlattened {
mapping = map[string]interface{}{
"type": "flattened",
"type": "flattened",
"ignore_above": config.GetInt(configPath + ".flattened_ignore_above"),
}
} else {
mapping = map[string]interface{}{
Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ func init() {
cfg.SetDefault("storage.elasticsearch.indices_to_keep", 0)
cfg.SetDefault("storage.elasticsearch.index_prefix", "skydive_")
cfg.SetDefault("storage.elasticsearch.use_flattened", true)
cfg.SetDefault("storage.elasticsearch.flattened_ignore_above", 32768)
cfg.SetDefault("storage.elasticsearch.exclude_from_mapping", []string{
"Metadata.*.Extra",
"Metadata.Container.Labels",
Expand Down
6 changes: 6 additions & 0 deletions etc/skydive.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ storage:
# - Metadata.OVN.Options
# - Metadata.OVN.IPv6RAConfigs

# Use flatten mapping type for fields specified by 'exclude_from_mapping'
# use_flattened: true

# Ignore flattened fields whose length is above the specified value
# flattened_ignore_above: 32768

# Snif Nodes Info API to get all the nodes in the cluster
# See https://pkg.go.dev/gopkg.in/olivere/elastic.v2?tab=doc#NewClient
# Default: false
Expand Down

0 comments on commit e6368cd

Please sign in to comment.