kibana/x-pack/plugins/monitoring/public
Shaunak Kashyap 84d4b0dc73
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"
   }
}
```
2018-10-03 11:49:38 -07:00
..
components [Monitoring] APM Monitoring UI (#22975) 2018-09-24 12:59:18 -04:00
directives Relax check to account for metricbeat-indexed doc format (#23730) 2018-10-03 11:49:38 -07:00
filters Migrate x-pack-kibana source to kibana 2018-04-24 13:48:10 -07:00
hacks Migrate x-pack-kibana source to kibana 2018-04-24 13:48:10 -07:00
icons Migrate x-pack-kibana source to kibana 2018-04-24 13:48:10 -07:00
lib Replace timefilter angular service with singleton (#19852) 2018-06-26 10:29:41 -06:00
services Add K7 header navigation (#23300) 2018-10-02 14:09:47 -05:00
views [Monitoring] APM Monitoring UI (#22975) 2018-09-24 12:59:18 -04:00
_hacks.scss Moves styleSheetPath to uiExports (#23007) 2018-09-20 19:01:06 -07:00
index.scss [build] Include X-Pack plugins and use aliases (#22325) 2018-08-26 14:34:08 -07:00
monitoring.js Move timezone settings into autoload file (#22623) 2018-09-05 08:55:39 +02:00
register_feature.js remove application icon assets in kibana that ship with EUI (#18570) 2018-05-07 10:59:39 -06:00