---
"Validate query api":
  - do:
      indices.create:
        index: testing
        body:
          settings:
            number_of_replicas: 0

  - do:
      cluster.health:
        wait_for_status: yellow

  - do:
      indices.validate_query:
        q: query string

  - is_true: valid

  - do:
      indices.validate_query:
        body:
          query:
            invalid_query: {}

  - is_false: valid

  - do:
      indices.validate_query:
        explain: true

  - is_true: valid
  - match: {_shards.failed: 0}
  - match: {explanations.0.index: 'testing'}
  - match: {explanations.0.explanation: 'ConstantScore(*:*)'}


---
"Validate query api":
  - do:
      indices.create:
        index: testing
        body:
          settings:
            number_of_replicas: 0

  - do:
      cluster.health:
        wait_for_status: yellow

  - do:
      indices.validate_query:
        q: query string

  - is_true: valid

  - do:
      indices.validate_query:
        body:
          query:
            invalid_query: {}

  - is_false: valid

  - do:
      indices.validate_query:
        explain: true

  - is_true: valid
  - match: {_shards.failed: 0}
  - match: {explanations.0.index: 'testing'}
  - match: {explanations.0.explanation: '*:*'}


Revert "Test: fix removal of e validate_query rewrite YAML test"
Revert "Test: fix removal of e validate_query rewrite YAML test"

This reverts commit e461852548b6ee1cbb18031989af4790f4922f48.
