---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
---
Score should match explanation in rescore:
- do:
    indices.create:
      index: "test_index"
      body:
        settings:
          number_of_shards: 1
    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_index\", \"_id\": \"1\"}}"
      - "{\"f1\": \"1\"}"
      - "{\"index\": {\"_index\": \"test_index\", \"_id\": \"2\"}}"
      - "{\"f1\": \"2\"}"
      - "{\"index\": {\"_index\": \"test_index\", \"_id\": \"3\"}}"
      - "{\"f1\": \"3\"}"
    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:
    search:
      rest_total_hits_as_int: true
      index: "test_index"
      body:
        explain: true
        query:
          match_all: {}
        rescore:
          window_size: 2
          query:
            rescore_query:
              match_all: {}
            query_weight: 5
            rescore_query_weight: 10
    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:
    hits.max_score: 15
- match:
    hits.hits.0._score: 15
- match:
    hits.hits.0._explanation.value: 15
- match:
    hits.hits.1._score: 15
- match:
    hits.hits.1._explanation.value: 15
- match:
    hits.hits.2._score: 5
- match:
    hits.hits.2._explanation.value: 5
