Skip to content

Commit

Permalink
Hybrid approach
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator committed Jul 7, 2020
1 parent 87b73dd commit eb621b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions metricbeat/module/elasticsearch/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (b *boolStr) UnmarshalJSON(raw []byte) error {
}

type IndexSettings struct {
Hidden boolStr
Hidden bool
}

// GetIndicesSettings returns a map of index names to their settings.
Expand All @@ -394,7 +394,9 @@ func GetIndicesSettings(http *helper.HTTP, resetURI string) (map[string]IndexSet

var resp map[string]struct {
Settings struct {
Index IndexSettings `json:"index"`
Index struct {
Hidden boolStr `json:"hidden"`
} `json:"index"`
} `json:"settings"`
}

Expand All @@ -405,7 +407,9 @@ func GetIndicesSettings(http *helper.HTTP, resetURI string) (map[string]IndexSet

ret := make(map[string]IndexSettings, len(resp))
for index, settings := range resp {
ret[index] = settings.Settings.Index
ret[index] = IndexSettings{
Hidden: bool(settings.Settings.Index.Hidden),
}
}

return ret, nil
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/elasticsearch/index/data_xpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func eventsMappingXPack(r mb.ReporterV2, m *MetricSet, info elasticsearch.Info,

settings, exists := indicesSettings[name]
if exists {
idx.Hidden = bool(settings.Hidden)
idx.Hidden = settings.Hidden
}

err = addClusterStateFields(&idx, clusterState)
Expand Down

0 comments on commit eb621b5

Please sign in to comment.