---
"Metric - blank":
  - do:
      cluster.state: {}

  - set: { master_node: master }

  - do:
      nodes.stats: {}

  - is_true:  nodes.$master.indices.docs
  - is_true:  nodes.$master.indices.store
  - is_true:  nodes.$master.indices.indexing
  - is_true:  nodes.$master.indices.get
  - is_true:  nodes.$master.indices.search
  - is_true:  nodes.$master.indices.merges
  - is_true:  nodes.$master.indices.refresh
  - is_true:  nodes.$master.indices.flush
  - is_true:  nodes.$master.indices.warmer
  - is_true:  nodes.$master.indices.query_cache
  - is_true:  nodes.$master.indices.fielddata
  - is_true:  nodes.$master.indices.completion
  - is_true:  nodes.$master.indices.segments
  - is_true:  nodes.$master.indices.translog
  - is_true:  nodes.$master.indices.recovery

---
"Metric - _all":
  - do:
      cluster.state: {}

  - set: { master_node: master }

  - do:
      nodes.stats: { metric: _all }

  - is_true:  nodes.$master.indices.docs
  - is_true:  nodes.$master.indices.store
  - is_true:  nodes.$master.indices.indexing
  - is_true:  nodes.$master.indices.get
  - is_true:  nodes.$master.indices.search
  - is_true:  nodes.$master.indices.merges
  - is_true:  nodes.$master.indices.refresh
  - is_true:  nodes.$master.indices.flush
  - is_true:  nodes.$master.indices.warmer
  - is_true:  nodes.$master.indices.query_cache
  - is_true:  nodes.$master.indices.fielddata
  - is_true:  nodes.$master.indices.completion
  - is_true:  nodes.$master.indices.segments
  - is_true:  nodes.$master.indices.translog
  - is_true:  nodes.$master.indices.recovery

---
"Metric - indices _all":
  - do:
      cluster.state: {}

  - set: { master_node: master }

  - do:
      nodes.stats: { metric: indices, index_metric: _all }

  - is_true:  nodes.$master.indices.docs
  - is_true:  nodes.$master.indices.store
  - is_true:  nodes.$master.indices.indexing
  - is_true:  nodes.$master.indices.get
  - is_true:  nodes.$master.indices.search
  - is_true:  nodes.$master.indices.merges
  - is_true:  nodes.$master.indices.refresh
  - is_true:  nodes.$master.indices.flush
  - is_true:  nodes.$master.indices.warmer
  - is_true:  nodes.$master.indices.query_cache
  - is_true:  nodes.$master.indices.fielddata
  - is_true:  nodes.$master.indices.completion
  - is_true:  nodes.$master.indices.segments
  - is_true:  nodes.$master.indices.translog
  - is_true:  nodes.$master.indices.recovery

---
"Metric - one":
  - do:
      cluster.state: {}

  - set: { master_node: master }

  - do:
      nodes.stats: { metric: indices, index_metric: docs }

  - is_true:   nodes.$master.indices.docs
  - is_false:  nodes.$master.indices.store
  - is_false:  nodes.$master.indices.indexing
  - is_false:  nodes.$master.indices.get
  - is_false:  nodes.$master.indices.search
  - is_false:  nodes.$master.indices.merges
  - is_false:  nodes.$master.indices.refresh
  - is_false:  nodes.$master.indices.flush
  - is_false:  nodes.$master.indices.warmer
  - is_false:  nodes.$master.indices.query_cache
  - is_false:  nodes.$master.indices.fielddata
  - is_false:  nodes.$master.indices.completion
  - is_false:  nodes.$master.indices.segments
  - is_false:  nodes.$master.indices.translog
  - is_false:  nodes.$master.indices.recovery

---
"Metric - multi":
  - do:
      cluster.state: {}

  - set: { master_node: master }

  - do:
      nodes.stats: { metric: indices, index_metric: [ store, get, merge ] }

  - is_false:  nodes.$master.indices.docs
  - is_true:   nodes.$master.indices.store
  - is_false:  nodes.$master.indices.indexing
  - is_true:   nodes.$master.indices.get
  - is_false:  nodes.$master.indices.search
  - is_true:   nodes.$master.indices.merges
  - is_false:  nodes.$master.indices.refresh
  - is_false:  nodes.$master.indices.flush
  - is_false:  nodes.$master.indices.warmer
  - is_false:  nodes.$master.indices.query_cache
  - is_false:  nodes.$master.indices.fielddata
  - is_false:  nodes.$master.indices.completion
  - is_false:  nodes.$master.indices.segments
  - is_false:  nodes.$master.indices.translog
  - is_false:  nodes.$master.indices.recovery


---
"Metric - recovery":
  - do:
      cluster.state: {}

  - set: { master_node: master }

  - do:
      nodes.stats: { metric: indices, index_metric: [ recovery ] }

  - is_false:  nodes.$master.indices.docs
  - is_false:  nodes.$master.indices.store
  - is_false:  nodes.$master.indices.indexing
  - is_false:  nodes.$master.indices.get
  - is_false:  nodes.$master.indices.search
  - is_false:  nodes.$master.indices.merges
  - is_false:  nodes.$master.indices.refresh
  - is_false:  nodes.$master.indices.flush
  - is_false:  nodes.$master.indices.warmer
  - is_false:  nodes.$master.indices.query_cache
  - is_false:  nodes.$master.indices.fielddata
  - is_false:  nodes.$master.indices.completion
  - is_false:  nodes.$master.indices.segments
  - is_false:  nodes.$master.indices.translog
  - is_true:   nodes.$master.indices.recovery

---
"Metric - _all include_segment_file_sizes":
  - skip:
      version: " - 5.1.1"
      reason: including segment file sizes triggered an unrecognized parameter in <= 5.1.1
  - do:
      cluster.state: {}

  - set: { master_node: master }

  - do:
      nodes.stats: { metric: indices, index_metric: _all, include_segment_file_sizes: true }

  - is_true:   nodes.$master.indices.docs
  - is_true:   nodes.$master.indices.store
  - is_true:   nodes.$master.indices.indexing
  - is_true:   nodes.$master.indices.get
  - is_true:   nodes.$master.indices.search
  - is_true:   nodes.$master.indices.merges
  - is_true:   nodes.$master.indices.refresh
  - is_true:   nodes.$master.indices.flush
  - is_true:   nodes.$master.indices.warmer
  - is_true:   nodes.$master.indices.query_cache
  - is_true:   nodes.$master.indices.fielddata
  - is_true:   nodes.$master.indices.completion
  - is_true:   nodes.$master.indices.segments
  - is_true:   nodes.$master.indices.translog
  - is_true:   nodes.$master.indices.recovery
  - is_true:   nodes.$master.indices.segments.file_sizes

---
"Metric - segments include_segment_file_sizes":
  - skip:
      version: " - 5.1.1"
      reason: including segment file sizes triggered an unrecognized parameter in <= 5.1.1
  - do:
      cluster.state: {}

  - set: { master_node: master }

  - do:
      nodes.stats: { metric: indices, index_metric: segments, include_segment_file_sizes: true }

  - is_false:  nodes.$master.indices.docs
  - is_false:  nodes.$master.indices.store
  - is_false:  nodes.$master.indices.indexing
  - is_false:  nodes.$master.indices.get
  - is_false:  nodes.$master.indices.search
  - is_false:  nodes.$master.indices.merges
  - is_false:  nodes.$master.indices.refresh
  - is_false:  nodes.$master.indices.flush
  - is_false:  nodes.$master.indices.warmer
  - is_false:  nodes.$master.indices.query_cache
  - is_false:  nodes.$master.indices.fielddata
  - is_false:  nodes.$master.indices.completion
  - is_true:   nodes.$master.indices.segments
  - is_false:  nodes.$master.indices.translog
  - is_false:  nodes.$master.indices.recovery
  - is_true:   nodes.$master.indices.segments.file_sizes

