---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    indices.create:
      index: "test"
      body:
        settings:
          index.number_of_shards: 1
        mappings:
          properties:
            keyword:
              type: "keyword"
    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: "test"
      id: "1"
      refresh: true
      body:
        keyword:
        - "a"
        - "b"
    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"
---
fetch fields:
- requires:
    cluster_features: "gte_v8.15.0"
    reason: "_ignored is returned only from 8.15 on"
- do:
    search:
      index: "test"
      body:
        _source: false
        profile: true
        fields:
        - "keyword"
    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: "hits.hits.0._id"
- match:
    hits.hits.0.fields.keyword.0: "a"
- match:
    hits.hits.0.fields.keyword.1: "b"
- gt:
    profile.shards.0.fetch.time_in_nanos: 0
- gt:
    profile.shards.0.fetch.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.breakdown.next_reader: 0
- gt:
    profile.shards.0.fetch.breakdown.load_stored_fields_count: 0
- gt:
    profile.shards.0.fetch.breakdown.load_stored_fields: 0
- match:
    profile.shards.0.fetch.debug.stored_fields:
    - "_id"
    - "_routing"
    - "_source"
- length:
    profile.shards.0.fetch.children: 2
- match:
    profile.shards.0.fetch.children.0.type: "FetchFieldsPhase"
- gt:
    profile.shards.0.fetch.children.0.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.children.0.breakdown.next_reader: 0
- gt:
    profile.shards.0.fetch.children.0.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.children.0.breakdown.next_reader: 0
- match:
    profile.shards.0.fetch.children.1.type: "StoredFieldsPhase"
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader: 0
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader: 0
---
fetch source:
- requires:
    cluster_features: "gte_v8.15.0"
    reason: "_ignored is returned only from 8.15 on"
- do:
    search:
      index: "test"
      body:
        profile: true
    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: "hits.hits.0._id"
- match:
    hits.hits.0._source.keyword.0: "a"
- match:
    hits.hits.0._source.keyword.1: "b"
- gt:
    profile.shards.0.fetch.time_in_nanos: 0
- gt:
    profile.shards.0.fetch.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.breakdown.next_reader: 0
- gt:
    profile.shards.0.fetch.breakdown.load_stored_fields_count: 0
- gt:
    profile.shards.0.fetch.breakdown.load_stored_fields: 0
- match:
    profile.shards.0.fetch.debug.stored_fields:
    - "_id"
    - "_routing"
    - "_source"
- length:
    profile.shards.0.fetch.children: 3
- match:
    profile.shards.0.fetch.children.0.type: "FetchFieldsPhase"
- match:
    profile.shards.0.fetch.children.1.type: "FetchSourcePhase"
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader: 0
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader: 0
- match:
    profile.shards.0.fetch.children.1.debug.fast_path: 1
- match:
    profile.shards.0.fetch.children.2.type: "StoredFieldsPhase"
---
fetch nested source:
- requires:
    cluster_features: "gte_v8.15.0"
    reason: "_ignored is returned only from 8.15 on"
- do:
    indices.create:
      index: "test_nested"
      body:
        settings:
          index.number_of_shards: 1
        mappings:
          properties:
            keyword:
              type: "keyword"
            nested:
              type: "nested"
              properties:
                text:
                  type: "text"
    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: "test_nested"
      id: "1"
      refresh: true
      body:
        keyword:
        - "a"
        - "b"
        nested:
        - text: "the quick brown fox"
        - text: "jumped over the"
        - text: "lazy dog"
    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:
      index: "test_nested"
      body:
        profile: true
        query:
          nested:
            path: "nested"
            query:
              match_all: {}
            inner_hits: {}
    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: "hits.hits.0._id"
- match:
    hits.hits.0._source.keyword.0: "a"
- match:
    hits.hits.0._source.keyword.1: "b"
- gt:
    profile.shards.0.fetch.time_in_nanos: 0
- gt:
    profile.shards.0.fetch.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.breakdown.next_reader: 0
- gt:
    profile.shards.0.fetch.breakdown.load_stored_fields_count: 0
- gt:
    profile.shards.0.fetch.breakdown.load_stored_fields: 0
- match:
    profile.shards.0.fetch.debug.stored_fields:
    - "_id"
    - "_routing"
    - "_source"
- length:
    profile.shards.0.fetch.children: 4
- match:
    profile.shards.0.fetch.children.0.type: "FetchFieldsPhase"
- match:
    profile.shards.0.fetch.children.1.type: "FetchSourcePhase"
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader: 0
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.children.1.breakdown.next_reader: 0
- match:
    profile.shards.0.fetch.children.2.type: "InnerHitsPhase"
- gt:
    profile.shards.0.fetch.children.2.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.children.2.breakdown.next_reader: 0
- gt:
    profile.shards.0.fetch.children.2.breakdown.next_reader_count: 0
- gt:
    profile.shards.0.fetch.children.2.breakdown.next_reader: 0
- match:
    profile.shards.0.fetch.children.3.type: "StoredFieldsPhase"
---
disabling stored fields removes fetch sub phases:
- requires:
    cluster_features: "gte_v7.16.0"
    reason: "fetch profiling implemented in 7.16.0"
- do:
    search:
      index: "test"
      body:
        stored_fields: "_none_"
        profile: true
    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.hits.0._index: "test"
- match:
    profile.shards.0.fetch.debug.stored_fields: []
- is_false: "profile.shards.0.fetch.children"
---
dfs knn vector profiling:
- requires:
    cluster_features: "gte_v8.7.0"
    reason: "multi-knn dfs profiling implemented in 8.7.0"
- do:
    indices.create:
      index: "images"
      body:
        settings:
          index.number_of_shards: 1
        mappings:
          properties:
            image:
              type: "dense_vector"
              dims: 3
              index: true
              similarity: "l2_norm"
    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: "images"
      id: "1"
      refresh: true
      body:
        image:
        - 1
        - 5
        - -20
    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:
      index: "images"
      body:
        profile: true
        knn:
          field: "image"
          query_vector:
          - -5
          - 9
          - -12
          k: 1
          num_candidates: 100
    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.total.value: 1
- gt:
    profile.shards.0.dfs.knn.0.query.0.time_in_nanos: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.set_min_competitive_score_count: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.set_min_competitive_score: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.match_count: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.match: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.shallow_advance_count: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.shallow_advance: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.next_doc_count: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.next_doc: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.score_count: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.score: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.compute_max_score_count: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.compute_max_score: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.build_scorer_count: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.build_scorer: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.create_weight: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.create_weight_count: 0
- gt:
    profile.shards.0.dfs.knn.0.rewrite_time: 0
- match:
    profile.shards.0.dfs.knn.0.collector.0.name: "TopScoreDocCollector"
- match:
    profile.shards.0.dfs.knn.0.collector.0.reason: "search_top_hits"
- gt:
    profile.shards.0.dfs.knn.0.collector.0.time_in_nanos: 0
---
dfs knn vector profiling with vector_operations_count:
- requires:
    cluster_features: "gte_v8.12.0"
    reason: "vector_operations_count in dfs profiling added in 8.12.0"
- do:
    indices.create:
      index: "images"
      body:
        settings:
          index.number_of_shards: 1
        mappings:
          properties:
            image:
              type: "dense_vector"
              dims: 3
              index: true
              similarity: "l2_norm"
    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: "images"
      id: "1"
      refresh: true
      body:
        image:
        - 1
        - 5
        - -20
    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:
      index: "images"
      body:
        profile: true
        knn:
          field: "image"
          query_vector:
          - -5
          - 9
          - -12
          k: 1
          num_candidates: 100
    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.total.value: 1
- match:
    profile.shards.0.dfs.knn.0.vector_operations_count: 1
- gt:
    profile.shards.0.dfs.knn.0.query.0.time_in_nanos: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.set_min_competitive_score_count: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.set_min_competitive_score: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.match_count: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.match: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.shallow_advance_count: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.shallow_advance: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.next_doc_count: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.next_doc: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.score_count: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.score: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.compute_max_score_count: 0
- match:
    profile.shards.0.dfs.knn.0.query.0.breakdown.compute_max_score: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.build_scorer_count: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.build_scorer: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.create_weight: 0
- gt:
    profile.shards.0.dfs.knn.0.query.0.breakdown.create_weight_count: 0
- gt:
    profile.shards.0.dfs.knn.0.rewrite_time: 0
- match:
    profile.shards.0.dfs.knn.0.collector.0.name: "TopScoreDocCollector"
- match:
    profile.shards.0.dfs.knn.0.collector.0.reason: "search_top_hits"
- gt:
    profile.shards.0.dfs.knn.0.collector.0.time_in_nanos: 0
---
dfs profile for search with dfs_query_then_fetch:
- requires:
    cluster_features: "gte_v8.6.0"
    reason: "dfs profiling implemented in 8.6.0"
- do:
    indices.create:
      index: "keywords"
      body:
        settings:
          index.number_of_shards: 2
        mappings:
          properties:
            keyword:
              type: "keyword"
    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:
      index: "keywords"
      search_type: "dfs_query_then_fetch"
      body:
        profile: true
        query:
          term:
            keyword: "a"
    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.total.value: 0
- match:
    profile.shards.0.dfs.statistics.type: "statistics"
- match:
    profile.shards.0.dfs.statistics.description: "collect term statistics"
- gte:
    profile.shards.0.dfs.statistics.time_in_nanos: 0
- is_true: "profile.shards.0.dfs.statistics.breakdown"
- match:
    profile.shards.1.dfs.statistics.type: "statistics"
- match:
    profile.shards.1.dfs.statistics.description: "collect term statistics"
- gte:
    profile.shards.1.dfs.statistics.time_in_nanos: 0
- is_true: "profile.shards.1.dfs.statistics.breakdown"
- do:
    search:
      index: "keywords"
      search_type: "query_then_fetch"
      body:
        profile: true
        query:
          term:
            keyword: "a"
    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.total.value: 0
- is_false: "profile.shards.0.dfs"
- do:
    index:
      index: "keywords"
      id: "1"
      refresh: true
      body:
        keyword: "a"
    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: "keywords"
      id: "2"
      refresh: true
      body:
        keyword: "b"
    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:
      index: "keywords"
      search_type: "dfs_query_then_fetch"
      body:
        profile: true
        query:
          term:
            keyword: "a"
    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.total.value: 1
- match:
    profile.shards.0.dfs.statistics.type: "statistics"
- match:
    profile.shards.0.dfs.statistics.description: "collect term statistics"
- gte:
    profile.shards.0.dfs.statistics.time_in_nanos: 0
- is_true: "profile.shards.0.dfs.statistics.breakdown"
- match:
    profile.shards.1.dfs.statistics.type: "statistics"
- match:
    profile.shards.1.dfs.statistics.description: "collect term statistics"
- gte:
    profile.shards.1.dfs.statistics.time_in_nanos: 0
- is_true: "profile.shards.1.dfs.statistics.breakdown"
- do:
    search:
      index: "keywords"
      search_type: "dfs_query_then_fetch"
      body:
        profile: true
        query:
          term:
            keyword: "b"
    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.total.value: 1
- match:
    profile.shards.0.dfs.statistics.type: "statistics"
- match:
    profile.shards.0.dfs.statistics.description: "collect term statistics"
- gte:
    profile.shards.0.dfs.statistics.time_in_nanos: 0
- is_true: "profile.shards.0.dfs.statistics.breakdown"
- match:
    profile.shards.1.dfs.statistics.type: "statistics"
- match:
    profile.shards.1.dfs.statistics.description: "collect term statistics"
- gte:
    profile.shards.1.dfs.statistics.time_in_nanos: 0
- is_true: "profile.shards.1.dfs.statistics.breakdown"
- do:
    search:
      index: "keywords"
      search_type: "dfs_query_then_fetch"
      body:
        profile: true
        query:
          term:
            keyword: "c"
    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.total.value: 0
- match:
    profile.shards.0.dfs.statistics.type: "statistics"
- match:
    profile.shards.0.dfs.statistics.description: "collect term statistics"
- gte:
    profile.shards.0.dfs.statistics.time_in_nanos: 0
- is_true: "profile.shards.0.dfs.statistics.breakdown"
- match:
    profile.shards.1.dfs.statistics.type: "statistics"
- match:
    profile.shards.1.dfs.statistics.description: "collect term statistics"
- gte:
    profile.shards.1.dfs.statistics.time_in_nanos: 0
- is_true: "profile.shards.1.dfs.statistics.breakdown"
- do:
    search:
      index: "keywords"
      search_type: "query_then_fetch"
      body:
        profile: true
        query:
          term:
            keyword: "a"
    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.total.value: 1
- is_false: "profile.shards.0.dfs"
- do:
    search:
      index: "keywords"
      search_type: "query_then_fetch"
      body:
        profile: true
        query:
          term:
            keyword: "b"
    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.total.value: 1
- is_false: "profile.shards.0.dfs"
- do:
    search:
      index: "keywords"
      search_type: "query_then_fetch"
      body:
        profile: true
        query:
          term:
            keyword: "c"
    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.total.value: 0
- is_false: "profile.shards.0.dfs"
---
composite_id_parsed:
- requires:
    cluster_features:
    - "gte_v8.10.0"
    reason: "node_id, shard_id, index and cluster fields added in 8.10.0"
    test_runner_features: "contains"
- do:
    search:
      index: "test"
      body:
        _source: false
        profile: true
        fields:
        - "keyword"
    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"
- set:
    profile.shards.0.id: "composite_id"
    profile.shards.0.node_id: "first_node_id"
    profile.shards.0.index: "first_index"
- is_true: "profile.shards.0.id"
- is_true: "profile.shards.0.node_id"
- length:
    profile.shards.0.node_id: 22
- gte:
    profile.shards.0.shard_id: 0
- match:
    profile.shards.0.index: "test"
- is_true: "profile.shards.0.cluster"
- contains:
    $composite_id: "$first_node_id"
- contains:
    $composite_id: "$first_index"
