---
"no body fails":
  - do:
      catch: param
      delete_by_query:
        index: _all

---
"no query fails":

  - do:
      catch: /query is missing/
      delete_by_query:
        index: _all
        body: {}

---
"invalid conflicts fails":
  - do:
      index:
        index:   test
        id:      "1"
        body:    { "text": "test" }
  - do:
      catch: /conflicts may only be .* but was \[cat\]/
      delete_by_query:
        index: test
        conflicts: cat
        body:
          query:
            match_all: {}

---
"invalid max_docs fails":
  - requires:
      cluster_features: ["gte_v7.3.0"]
      reason: "max_docs introduced in 7.3.0"

  - do:
      index:
        index:   test
        id:      "1"
        body:    { "text": "test" }
  - do:
      catch: /\[max_docs\] parameter cannot be negative, found \[-4\]/
      delete_by_query:
        index: test
        max_docs: -4
        body:
          query:
            match_all: {}

---
"max_docs shoule be greater than slices":
  - requires:
      cluster_features: ["gte_v7.3.0"]
      reason: "max_docs introduced in 7.3.0"

  - do:
      index:
        index:   test
        id:      "1"
        body:    { "text": "test" }
  - do:
      catch: /\[max_docs\] should be >= \[slices\]/
      delete_by_query:
        index: test
        max_docs: 1
        slices: 2
        body:
          query:
            match_all: {}

---
"invalid scroll_size fails":
  - do:
      index:
        index:   test
        id:      "1"
        body:    { "text": "test" }
  - do:
      catch: /Failed to parse int parameter \[scroll_size\] with value \[asdf\]/
      delete_by_query:
        index: test
        scroll_size: asdf
        body:
          query:
            match_all: {}

---
"source fields may not be modified":
  - do:
      catch: /stored_fields is not supported in this context/
      delete_by_query:
        index: test
        body:
          stored_fields: [_id]

---
"requests_per_second cannot be an empty string":
  - do:
      catch: /\[requests_per_second\] must be a float greater than 0. Use -1 to disable throttling./
      delete_by_query:
        requests_per_second: ""
        index: test
        body:
          query:
            match_all: {}

---
"requests_per_second cannot be negative":
  - do:
      catch: /\[requests_per_second\] must be a float greater than 0. Use -1 to disable throttling./
      delete_by_query:
        requests_per_second: -12
        index: test
        body:
          query:
            match_all: {}

---
"requests_per_second cannot be zero":
  - do:
      catch: /\[requests_per_second\] must be a float greater than 0. Use -1 to disable throttling./
      delete_by_query:
        requests_per_second: 0
        index: test
        body:
          query:
            match_all: {}


---
"requests_per_second cannot be unlimited":
  - do:
      catch: /\[requests_per_second\] must be a float greater than 0. Use -1 to disable throttling./
      delete_by_query:
        requests_per_second: unlimited
        index: test
        body:
          query:
            match_all: {}

---
"junk in slices fails":
  - do:
      catch: /\[slices\] must be a positive integer or the string "auto"/
      delete_by_query:
        slices: junk
        index: test
        body:
          query:
            match_all: {}
---
"zero slices fails":
  - do:
      catch: /\[slices\] must be a positive integer or the string "auto"/
      delete_by_query:
        slices: 0
        index: test
        body:
          query:
            match_all: {}
