---
setup:
- requires:
    cluster_features:
    - "gte_v8.4.0"
    reason: "Cluster mappings stats for indexed dense vector was added in 8.4"
- skip:
    features:
    - "headers"
    - "headers"
    - "allowed_warnings_regex"
    - "allowed_warnings_regex"
- do:
    indices.create:
      index: "index2"
      body:
        settings:
          index.number_of_shards: 2
        mappings:
          properties:
            vector1:
              type: "dense_vector"
              dims: 768
              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"
---
Field mapping stats:
- do:
    indices.create:
      index: "index1"
      body:
        settings:
          index.number_of_shards: 2
        mappings:
          properties:
            vector1:
              type: "dense_vector"
              dims: 768
              index: true
              similarity: "l2_norm"
              index_options:
                type: "hnsw"
                m: 16
                ef_construction: 100
            vector2:
              type: "dense_vector"
              dims: 1024
              index: true
              similarity: "dot_product"
            vector3:
              type: "dense_vector"
              dims: 100
              index: 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"
- do:
    cluster.stats: {}
    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"
- length:
    indices.mappings.field_types: 1
- match:
    indices.mappings.field_types.0.name: "dense_vector"
- match:
    indices.mappings.field_types.0.count: 4
- match:
    indices.mappings.field_types.0.index_count: 2
- match:
    indices.mappings.field_types.0.indexed_vector_count: 3
- match:
    indices.mappings.field_types.0.indexed_vector_dim_min: 768
- match:
    indices.mappings.field_types.0.indexed_vector_dim_max: 1024
---
Field mapping stats with field details:
- skip:
    awaits_fix: "default dense vector field mapping has changed"
- requires:
    test_runner_features:
    - "capabilities"
    capabilities:
    - method: "GET"
      path: "/_cluster/stats"
      capabilities:
      - "verbose-dense-vector-mapping-stats"
    reason: "Capability required to run test"
- do:
    indices.create:
      index: "index1"
      body:
        settings:
          index.number_of_shards: 2
        mappings:
          properties:
            vector1:
              type: "dense_vector"
              dims: 768
              index: true
              similarity: "l2_norm"
              element_type: "byte"
              index_options:
                type: "hnsw"
                m: 16
                ef_construction: 100
            vector2:
              type: "dense_vector"
              dims: 1024
              index: true
              similarity: "dot_product"
            vector3:
              type: "dense_vector"
              dims: 100
              index: 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"
- do:
    cluster.stats: {}
    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"
- length:
    indices.mappings.field_types: 1
- match:
    indices.mappings.field_types.0.name: "dense_vector"
- match:
    indices.mappings.field_types.0.count: 4
- match:
    indices.mappings.field_types.0.index_count: 2
- match:
    indices.mappings.field_types.0.indexed_vector_count: 3
- match:
    indices.mappings.field_types.0.indexed_vector_dim_min: 768
- match:
    indices.mappings.field_types.0.indexed_vector_dim_max: 1024
- match:
    indices.mappings.field_types.0.vector_index_type_count.hnsw: 1
- match:
    indices.mappings.field_types.0.vector_index_type_count.int8_hnsw: 2
- match:
    indices.mappings.field_types.0.vector_index_type_count.not_indexed: 1
- match:
    indices.mappings.field_types.0.vector_similarity_type_count.l2_norm: 2
- match:
    indices.mappings.field_types.0.vector_similarity_type_count.dot_product: 1
- match:
    indices.mappings.field_types.0.vector_element_type_count.float: 3
- match:
    indices.mappings.field_types.0.vector_element_type_count.byte: 1
