---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- requires:
    cluster_features:
    - "gte_v8.13.0"
    reason: "resolve cluster introduced in 8.13"
    test_runner_features: "allowed_warnings"
- do:
    indices.create:
      index: "index1"
      body:
        aliases:
          my_alias1: {}
          my_alias2: {}
    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: "index2"
    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.close:
      index: "index2"
    allowed_warnings:
    - "the default value for the ?wait_for_active_shards parameter will change from\
      \ '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting'\
      \ to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve\
      \ today's behaviour"
    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"
---
Resolve cluster with indices and aliases:
- requires:
    cluster_features:
    - "gte_v8.13.0"
    reason: "resolve cluster introduced in 8.13"
- do:
    indices.resolve_cluster:
      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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- match:
    (local).matching_indices: true
- exists: "(local).version.number"
- do:
    indices.resolve_cluster:
      name: "*"
      expand_wildcards: "closed"
    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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- match:
    (local).matching_indices: true
- exists: "(local).version.number"
---
Resolve cluster with closed index:
- requires:
    cluster_features:
    - "gte_v8.13.0"
    reason: "resolve cluster introduced in 8.13"
- do:
    indices.resolve_cluster:
      name: "index2"
    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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- match:
    (local).matching_indices: false
- exists: "(local).version.number"
- do:
    indices.resolve_cluster:
      name: "index2*"
      expand_wildcards: "open,closed"
    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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- match:
    (local).matching_indices: false
- exists: "(local).version.number"
- do:
    indices.resolve_cluster:
      name: "index2*"
      expand_wildcards: "closed"
    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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- match:
    (local).matching_indices: false
- exists: "(local).version.number"
---
Resolve cluster using alias:
- requires:
    cluster_features:
    - "gte_v8.13.0"
    reason: "resolve cluster introduced in 8.13"
- do:
    indices.resolve_cluster:
      name: "my_alias2"
    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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- match:
    (local).matching_indices: true
- exists: "(local).version.number"
- do:
    indices.resolve_cluster:
      name: "my_ali*"
    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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- match:
    (local).matching_indices: true
- exists: "(local).version.number"
---
Resolve cluster using alias and index that does not exist:
- requires:
    cluster_features:
    - "gte_v8.13.0"
    reason: "resolve cluster introduced in 8.13"
- do:
    indices.resolve_cluster:
      name: "my_alias2,doesnotexist*"
      expand_wildcards: "all"
    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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- match:
    (local).matching_indices: true
- exists: "(local).version.number"
- do:
    indices.resolve_cluster:
      name: "my_alias2,doesnotexist"
    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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- is_false: "(local).matching_indices"
- is_false: "(local).version"
- match:
    (local).error: "no such index [doesnotexist]"
---
Test resolve cluster optional params are accepted:
- requires:
    cluster_features:
    - "gte_v8.13.0"
    reason: "resolve cluster introduced in 8.13"
- do:
    indices.resolve_cluster:
      name: "*"
      expand_wildcards: "all"
      ignore_unavailable: true
      ignore_throttled: true
      allow_no_indices: true
    allowed_warnings:
    - "[ignore_throttled] parameter is deprecated because frozen indices have been\
      \ deprecated. Consider cold or frozen tiers in place of frozen indices."
    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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- match:
    (local).matching_indices: true
- is_false: "(local).error"
- exists: "(local).version.number"
- do:
    indices.resolve_cluster:
      name: "*"
      expand_wildcards: "open"
      ignore_unavailable: false
      ignore_throttled: false
      allow_no_indices: false
    allowed_warnings:
    - "[ignore_throttled] parameter is deprecated because frozen indices have been\
      \ deprecated. Consider cold or frozen tiers in place of frozen indices."
    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:
    (local).connected: true
- match:
    (local).skip_unavailable: false
- match:
    (local).matching_indices: true
- is_false: "(local).error"
- exists: "(local).version.number"
---
Resolve cluster with no index expression:
- requires:
    cluster_features:
    - "gte_v8.18.0"
    reason: "resolve cluster with no index expression introduced in 8.18"
- do:
    indices.resolve_cluster:
      timeout: "400s"
    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_false: "(local).error"
