---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    indices.create:
      index: "test-0"
      body:
        mappings:
          properties:
            index_start_at:
              type: "integer"
            integer:
              type: "integer"
            float:
              type: "float"
            name:
              type: "keyword"
            title:
              type: "completion"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- do:
    indices.create:
      index: "test-1"
      body:
        mappings:
          properties:
            index_start_at:
              type: "integer"
            integer:
              type: "integer"
            float:
              type: "float"
            name:
              type: "keyword"
            title:
              type: "completion"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- do:
    bulk:
      refresh: true
      body:
      - "{\"index\": {\"_index\": \"test-0\"}}"
      - "{\"row\": 1, \"index_start_at\": 56, \"integer\": 38, \"float\": 12.5713,\
        \ \"name\": \"Ruth\", \"bool\": true, \"title\": \"doctor\"}"
      - "{\"index\": {\"_index\": \"test-0\"}}"
      - "{\"row\": 2, \"index_start_at\": 57, \"integer\": 42, \"float\": 15.3393,\
        \ \"name\": \"Jackie\", \"bool\": false}"
      - "{\"index\": {\"_index\": \"test-1\"}}"
      - "{\"row\": 3, \"index_start_at\": 58, \"integer\": 29, \"float\": 19.0517,\
        \ \"name\": \"Stephanie\", \"bool\": true}"
      - "{\"index\": {\"_index\": \"test-1\"}}"
      - "{\"row\": 4, \"index_start_at\": 59, \"integer\": 19, \"float\": 19.3717,\
        \ \"bool\": true, \"title\": \"commandant\"}"
      - "{\"index\": {\"_index\": \"test-1\"}}"
      - "{\"row\": 5, \"index_start_at\": 60, \"integer\": 0, \"float\": 17.3349,\
        \ \"name\": \"Natalie\", \"bool\": false}"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
---
Multisearch test with typed_keys parameter:
- do:
    msearch:
      rest_total_hits_as_int: true
      typed_keys: true
      body:
      - index: "test-*"
      - query:
          match:
            bool: true
        size: 0
        aggs:
          test_filter:
            filter:
              range:
                integer:
                  gte: 20
      - index: "test-1"
      - query:
          match_all: {}
        size: 0
        aggs:
          test_range:
            range:
              field: "float"
              ranges:
              - to: 19.25
              - from: 19.25
      - index: "test-*"
      - query:
          bool:
            filter:
              range:
                row:
                  lt: 5
        size: 0
        aggs:
          test_percentiles:
            percentiles:
              field: "float"
      - index: "test-*"
      - query:
          match_all: {}
        size: 0
        suggest:
          term_suggester:
            text: "Natalie"
            term:
              field: "name"
      - index: "test-*"
      - query:
          match_all: {}
        size: 0
        suggest:
          completion_suggester:
            prefix: "doc"
            completion:
              field: "title"
      - index: "test-*"
      - query:
          match_all: {}
        size: 0
        suggest:
          phrase_suggester:
            text: "Ruht"
            phrase:
              field: "name"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- match:
    responses.0.hits.total: 3
- match:
    responses.0.aggregations.filter#test_filter.doc_count: 2
- match:
    responses.1.hits.total: 3
- match:
    responses.1.aggregations.range#test_range.buckets.0.key: "*-19.25"
- match:
    responses.1.aggregations.range#test_range.buckets.0.doc_count: 2
- match:
    responses.1.aggregations.range#test_range.buckets.1.key: "19.25-*"
- match:
    responses.1.aggregations.range#test_range.buckets.1.doc_count: 1
- match:
    responses.2.hits.total: 4
- is_true: "responses.2.aggregations.tdigest_percentiles#test_percentiles.values"
- is_true: "responses.3.suggest.term#term_suggester"
- is_true: "responses.4.suggest.completion#completion_suggester"
- is_true: "responses.5.suggest.phrase#phrase_suggester"
---
Multisearch test with typed_keys parameter for sampler and significant terms:
- do:
    msearch:
      rest_total_hits_as_int: true
      typed_keys: true
      body:
      - index: "test-*"
      - query:
          match_all: {}
        size: 0
        aggs:
          test_sampler:
            sampler:
              shard_size: 200
            aggs:
              test_significant_terms:
                significant_terms:
                  field: "name"
      - index: "test-*"
      - query:
          match_all: {}
        size: 0
        aggs:
          test_umterms:
            terms:
              field: "surname"
      - index: "test-*"
      - query:
          match_all: {}
        size: 0
        aggs:
          test_sterms:
            terms:
              field: "name"
            aggs:
              test_umsignificant_terms:
                significant_terms:
                  field: "surname"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- match:
    responses.0.hits.total: 5
- match:
    responses.0.aggregations.sampler#test_sampler.doc_count: 5
- match:
    responses.0.aggregations.sampler#test_sampler.sigsterms#test_significant_terms.doc_count: 5
- match:
    responses.1.hits.total: 5
- match:
    responses.1.aggregations.sterms#test_umterms.doc_count_error_upper_bound: 0
- match:
    responses.2.hits.total: 5
- match:
    responses.2.aggregations.sterms#test_sterms.doc_count_error_upper_bound: 0
- is_true: "responses.2.aggregations.sterms#test_sterms.buckets.0.sigsterms#test_umsignificant_terms"
