---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    cluster.health:
      wait_for_status: "yellow"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
---
Test Deprecations:
- requires:
    capabilities:
    - method: "GET"
      path: "/_migration/deprecations"
      capabilities:
      - "data_streams"
      - "ilm_policies"
      - "templates"
    test_runner_features:
    - "capabilities"
    - "allowed_warnings"
    reason: "Support for data streams, ILM policies and templates"
- do:
    allowed_warnings:
    - "this request accesses system indices: [.security-7], but in a future major\
      \ version, direct access to system indices will be prevented by default"
    migration.deprecations:
      index: "*"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- length:
    cluster_settings: 0
- length:
    node_settings: 0
- length:
    index_settings: 0
- length:
    ml_settings: 0
- length:
    data_streams: 0
- length:
    templates: 0
- length:
    ilm_policies: 0
---
Test ml:
- skip:
    cluster_features:
    - "gte_v7.0.0"
    reason: "this test needs adjusting to contain syntax deprecated in 7.x and removed\
      \ in 8.0"
- requires:
    test_runner_features:
    - "headers"
    - "warnings"
- do:
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    index:
      index: ".ml-config"
      type: "doc"
      id: "deprecation-datafeed-datafeed"
      body: "{\n  \"datafeed_id\" : \"deprecation-datafeed\",\n  \"config_type\" :\
        \ \"datafeed\",\n  \"job_id\" : \"deprecation-job\",\n  \"indices\" : [\"\
        index-foo\"],\n  \"query\" : {\n    \"query_string\" : {\n      \"query\"\
        \ : \"foo\",\n      \"use_dis_max\" : true\n    }\n  }\n}\n"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    indices.refresh:
      index:
      - ".ml-config"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- do:
    warnings:
    - "Deprecated field [use_dis_max] used, replaced by [Set [tie_breaker] to 1 instead]"
    migration.deprecations:
      index: "*"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - ".*rollup functionality will be removed in Elasticsearch.*"
    - "Index \\[\\.profiling-.*\\] name begins with a dot.* and will not be allowed\
      \ in a future Elasticsearch version."
    - "Parameter \\[default_metric\\] is deprecated and will be removed in a future\
      \ version"
- length:
    ml_settings: 1
- match:
    ml_settings.0.level: "warning"
- match:
    ml_settings.0.message: "Datafeed [deprecation-datafeed] uses deprecated query\
      \ options"
