Relax check to account for metricbeat-indexed doc format (#23730)
With Metricbeat shipping Elasticsearch monitoring data (instead of internal collection by Elasticsearch), there are some subtle changes to the format of monitoring docs that are indexed into `.monitoring-es-6-*`. One such change is that metricbeat won't index fields with `null` values; instead it simply doesn't index such fields at all. As a result, in the context of Elasticsearch monitoring docs, when it comes to docs with `type` = `shards` representing unassigned shards, the `shard.node` field was being indexed as `null` by internal Elasticearch collection, whereas the field was absent when the doc was indexed by Metricbeat. Since both cases represent the same case — the shard being unassigned — this PR relaxes the check in the UI code to look for either case. ### Sample `shards` document indexed by internal ES collection ```js { "_index":".monitoring-es-6-2018.10.02", "_type":"doc", "_id":"WUf_htOeSXOJQmiesyF5Bw:_na:metricbeat-7.0.0-alpha1-2018.10.01:0:r", "_source":{ "cluster_uuid":"zXO1GjA6SJGsrPnCPkOoyA", "timestamp":"2018-10-02T03:54:43.364Z", "interval_ms":10000, "type":"shards", "source_node":null, "state_uuid":"WUf_htOeSXOJQmiesyF5Bw", "shard":{ "state":"UNASSIGNED", "primary":false, "node":null, "relocating_node":null, "shard":0, "index":"metricbeat-7.0.0-alpha1-2018.10.01" } } } ``` ### Sample `shards` document indexed by Metricbeat collection ```js { "_index":".monitoring-es-6-mb-2018.10.02", "_type":"doc", "_id":"FhDRTPjkQJqsgawYbxjQzw:_na:metricbeat-7.0.0-alpha1-2018.10.01:0:r", "_source":{ "@timestamp":"2018-10-02T04:00:03.361Z", "interval_ms":10000, "shard":{ "state":"UNASSIGNED", "primary":false, "index":"metricbeat-7.0.0-alpha1-2018.10.01", "shard":0 }, "state_uuid":"FhDRTPjkQJqsgawYbxjQzw", "beat":{ "hostname":"Shaunaks-MBP-2", "version":"7.0.0-alpha1", "name":"Shaunaks-MBP-2" }, "timestamp":"2018-10-02T04:00:03.375Z", "type":"shards", "metricset":{ "name":"shard", "module":"elasticsearch", "host":"localhost:9200", "rtt":14254, "namespace":"elasticsearch.shard" }, "host":{ "name":"Shaunaks-MBP-2" }, "cluster_uuid":"zXO1GjA6SJGsrPnCPkOoyA" } } ```
This commit is contained in:
parent
e7290b90aa
commit
84d4b0dc73
|
@ -33,7 +33,7 @@ export function indicesByNodes() {
|
||||||
|
|
||||||
// If the node is null then it's an unassigned shard and we need to
|
// If the node is null then it's an unassigned shard and we need to
|
||||||
// add it to the unassigned array.
|
// add it to the unassigned array.
|
||||||
if (shard.node === null) {
|
if (!shard.node || (shard.node === null)) {
|
||||||
obj[index].unassigned.push(shard);
|
obj[index].unassigned.push(shard);
|
||||||
// if the shard is a primary we need to set the unassignedPrimaries flag
|
// if the shard is a primary we need to set the unassignedPrimaries flag
|
||||||
if (shard.primary) {
|
if (shard.primary) {
|
||||||
|
|
Loading…
Reference in a new issue