setup:
  - do:
      indices.create:
        index: test_index1
  - do:
      indices.create:
        index: test_index2
  - do:
      indices.create:
        index: test_index3
  - do:
      cluster.health:
        wait_for_status: yellow

---
"All indices":
  - do:
      indices.close:
        index: _all

  - do:
      catch: forbidden
      search:
        index: test_index2

  - do:
      indices.open:
        index: _all

  - do:
      cluster.health:
        wait_for_status: yellow

  - do:
      search:
        index: test_index2

---
"Trailing wildcard":
  - do:
      indices.close:
        index: test_*

  - do:
      catch: forbidden
      search:
        index: test_index2

  - do:
      indices.open:
        index: test_*

  - do:
      cluster.health:
        wait_for_status: yellow

  - do:
      search:
        index: test_index2

---
"Only wildcard":
  - do:
      indices.close:
        index: '*'

  - do:
      catch: forbidden
      search:
        index: test_index3

  - do:
      indices.open:
        index: '*'

  - do:
      cluster.health:
        wait_for_status: yellow

  - do:
      search:
        index: test_index3

