---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
---
Field usage stats:
- do:
    indices.create:
      index: "testindex"
      body:
        settings:
          routing.rebalance.enable: "none"
          index.number_of_shards: 1
          index.number_of_replicas: 0
        mappings:
          properties:
            name:
              type: "text"
              index_options: "offsets"
              term_vector: "with_positions_offsets"
            price:
              type: "double"
    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:
    index:
      index: "testindex"
      body:
        name: "foo"
        price: 100
        day: "2003/09/06"
    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:
    index:
      index: "testindex"
      body:
        name: "bar"
        price: 120
        day: "2003/09/07"
    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:
    index:
      index: "testindex"
      body:
        name: "baz"
        price: 100
        day: "2003/09/13"
    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:
    index:
      index: "testindex"
      body:
        name: "bar & baz"
        price: 220
    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:
    index:
      index: "testindex"
      id: "testid"
      body:
        name: "foo bar"
        price: 150
        day: "2003/09/07"
    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.refresh: {}
    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
      body:
        query:
          bool:
            must:
            - match_phrase:
                name: "foo bar"
            - range:
                day:
                  gte: "2003/09/07"
        sort:
        - "price"
    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.field_usage_stats:
      index: "testindex"
    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"
- is_true: "testindex"
- length:
    testindex.shards: 1
- is_true: "testindex.shards.0.tracking_id"
- gt:
    testindex.shards.0.tracking_started_at_millis: 0
- is_true: "testindex.shards.0.routing"
- is_true: "testindex.shards.0.routing.state"
- is_true: "testindex.shards.0.routing.primary"
- is_true: "testindex.shards.0.routing.node"
- is_true: "testindex.shards.0.stats"
- gt:
    testindex.shards.0.stats.all_fields.any: 0
- gt:
    testindex.shards.0.stats.all_fields.inverted_index.terms: 0
- gt:
    testindex.shards.0.stats.all_fields.inverted_index.postings: 0
- gt:
    testindex.shards.0.stats.all_fields.inverted_index.proximity: 0
- gt:
    testindex.shards.0.stats.all_fields.stored_fields: 0
- gt:
    testindex.shards.0.stats.all_fields.doc_values: 0
- gt:
    testindex.shards.0.stats.all_fields.points: 0
- match:
    testindex.shards.0.stats.all_fields.norms: 0
- match:
    testindex.shards.0.stats.all_fields.term_vectors: 0
- gt:
    testindex.shards.0.stats.all_fields.inverted_index.term_frequencies: 0
- gt:
    testindex.shards.0.stats.all_fields.inverted_index.positions: 0
- match:
    testindex.shards.0.stats.all_fields.inverted_index.offsets: 0
- match:
    testindex.shards.0.stats.all_fields.inverted_index.payloads: 0
- gt:
    testindex.shards.0.stats.fields.name.any: 0
- gt:
    testindex.shards.0.stats.fields.name.inverted_index.terms: 0
- gt:
    testindex.shards.0.stats.fields.name.inverted_index.postings: 0
- gt:
    testindex.shards.0.stats.fields.name.inverted_index.proximity: 0
- match:
    testindex.shards.0.stats.fields.name.stored_fields: 0
- match:
    testindex.shards.0.stats.fields.name.doc_values: 0
- match:
    testindex.shards.0.stats.fields.name.points: 0
- match:
    testindex.shards.0.stats.fields.name.norms: 0
- match:
    testindex.shards.0.stats.fields.name.term_vectors: 0
- gt:
    testindex.shards.0.stats.fields.name.inverted_index.term_frequencies: 0
- gt:
    testindex.shards.0.stats.fields.name.inverted_index.positions: 0
- match:
    testindex.shards.0.stats.fields.name.inverted_index.offsets: 0
- match:
    testindex.shards.0.stats.fields.name.inverted_index.payloads: 0
- gt:
    testindex.shards.0.stats.fields.price.any: 0
- match:
    testindex.shards.0.stats.fields.price.inverted_index.terms: 0
- match:
    testindex.shards.0.stats.fields.price.inverted_index.postings: 0
- match:
    testindex.shards.0.stats.fields.price.inverted_index.proximity: 0
- match:
    testindex.shards.0.stats.fields.price.stored_fields: 0
- gt:
    testindex.shards.0.stats.fields.price.doc_values: 0
- gte:
    testindex.shards.0.stats.fields.price.points: 0
- match:
    testindex.shards.0.stats.fields.price.norms: 0
- match:
    testindex.shards.0.stats.fields.price.term_vectors: 0
- match:
    testindex.shards.0.stats.fields.price.inverted_index.term_frequencies: 0
- match:
    testindex.shards.0.stats.fields.price.inverted_index.positions: 0
- match:
    testindex.shards.0.stats.fields.price.inverted_index.offsets: 0
- match:
    testindex.shards.0.stats.fields.price.inverted_index.payloads: 0
- gt:
    testindex.shards.0.stats.fields.day.any: 0
- match:
    testindex.shards.0.stats.fields.day.inverted_index.terms: 0
- match:
    testindex.shards.0.stats.fields.day.inverted_index.postings: 0
- match:
    testindex.shards.0.stats.fields.day.inverted_index.proximity: 0
- match:
    testindex.shards.0.stats.fields.day.stored_fields: 0
- gt:
    testindex.shards.0.stats.fields.day.doc_values: 0
- gt:
    testindex.shards.0.stats.fields.day.points: 0
- match:
    testindex.shards.0.stats.fields.day.norms: 0
- match:
    testindex.shards.0.stats.fields.day.term_vectors: 0
- match:
    testindex.shards.0.stats.fields.day.inverted_index.term_frequencies: 0
- match:
    testindex.shards.0.stats.fields.day.inverted_index.positions: 0
- match:
    testindex.shards.0.stats.fields.day.inverted_index.offsets: 0
- match:
    testindex.shards.0.stats.fields.day.inverted_index.payloads: 0
- gt:
    testindex.shards.0.stats.fields._source.any: 0
- match:
    testindex.shards.0.stats.fields._source.inverted_index.terms: 0
- match:
    testindex.shards.0.stats.fields._source.inverted_index.postings: 0
- match:
    testindex.shards.0.stats.fields._source.inverted_index.proximity: 0
- gt:
    testindex.shards.0.stats.fields._source.stored_fields: 0
- match:
    testindex.shards.0.stats.fields._source.doc_values: 0
- match:
    testindex.shards.0.stats.fields._source.points: 0
- match:
    testindex.shards.0.stats.fields._source.norms: 0
- match:
    testindex.shards.0.stats.fields._source.term_vectors: 0
- match:
    testindex.shards.0.stats.fields._source.inverted_index.term_frequencies: 0
- match:
    testindex.shards.0.stats.fields._source.inverted_index.positions: 0
- match:
    testindex.shards.0.stats.fields._source.inverted_index.offsets: 0
- match:
    testindex.shards.0.stats.fields._source.inverted_index.payloads: 0
- gt:
    testindex.shards.0.stats.fields._id.any: 0
- match:
    testindex.shards.0.stats.fields._id.inverted_index.terms: 0
- match:
    testindex.shards.0.stats.fields._id.inverted_index.postings: 0
- match:
    testindex.shards.0.stats.fields._id.inverted_index.proximity: 0
- gt:
    testindex.shards.0.stats.fields._id.stored_fields: 0
- match:
    testindex.shards.0.stats.fields._id.doc_values: 0
- match:
    testindex.shards.0.stats.fields._id.points: 0
- match:
    testindex.shards.0.stats.fields._id.norms: 0
- match:
    testindex.shards.0.stats.fields._id.term_vectors: 0
- match:
    testindex.shards.0.stats.fields._id.inverted_index.term_frequencies: 0
- match:
    testindex.shards.0.stats.fields._id.inverted_index.positions: 0
- match:
    testindex.shards.0.stats.fields._id.inverted_index.offsets: 0
- match:
    testindex.shards.0.stats.fields._id.inverted_index.payloads: 0
- do:
    termvectors:
      index: "testindex"
      id: "testid"
      term_statistics: true
      fields: "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"
- do:
    indices.field_usage_stats:
      index: "testindex"
    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"
- gt:
    testindex.shards.0.stats.fields.name.term_vectors: 0
- do:
    search:
      rest_total_hits_as_int: true
      body:
        query:
          match_phrase:
            name: "foo bar"
    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.field_usage_stats:
      index: "testindex"
    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"
- gt:
    testindex.shards.0.stats.fields.name.norms: 0
- do:
    search:
      body:
        query:
          match_phrase:
            name: "foo bar"
        highlight:
          type: "unified"
          fields:
            '*': {}
    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.field_usage_stats:
      index: "testindex"
    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"
- gt:
    testindex.shards.0.stats.fields.name.inverted_index.offsets: 0
