---
setup:

  - do:
      index:
          index: test1
          type:  bar
          id:    1
          body:  { "bar": "bar", "baz": "baz" }

  - do:
      search:
          body:
              stats:  [ bar, baz ]

---
"Groups - blank":
  - do:
      indices.stats: {}

  - gt:       { _all.total.search.query_total: 0 }
  - is_false:   _all.total.search.groups

---
"Groups - one":
  - do:
      indices.stats: { groups: bar }

  - gt:       { _all.total.search.groups.bar.query_total: 0 }
  - is_false:   _all.total.search.groups.baz

---
"Groups - multi":
  - do:
      indices.stats: { groups: "bar,baz" }

  - gt:       { _all.total.search.groups.bar.query_total: 0 }
  - gt:       { _all.total.search.groups.baz.query_total: 0 }

---
"Groups - star":
  - do:
      indices.stats: { groups: "*" }

  - gt:       { _all.total.search.groups.bar.query_total: 0 }
  - gt:       { _all.total.search.groups.baz.query_total: 0 }

---
"Groups - pattern":
  - do:
      indices.stats: { groups: "*r" }

  - gt:       { _all.total.search.groups.bar.query_total: 0 }
  - is_false:   _all.total.search.groups.baz

---
"Groups - _all metric":
  - do:
      indices.stats: { groups: bar, metric: _all }

  - gt:       { _all.total.search.groups.bar.query_total: 0 }
  - is_false:   _all.total.search.groups.baz

---
"Groups - search metric":
  - do:
      indices.stats: { groups: bar, metric: search }

  - gt:       { _all.total.search.groups.bar.query_total: 0 }
  - is_false:   _all.total.search.groups.baz

---
"Groups - multi metric":
  - do:
      indices.stats: { groups: bar, metric: [ indexing, search] }

  - gt:       { _all.total.search.groups.bar.query_total: 0 }
  - is_false:   _all.total.search.groups.baz