---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    indices.create:
      index: "red_index"
      body:
        settings:
          number_of_shards: 1
          number_of_replicas: 0
          index.routing.allocation.enable: "none"
    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:
    health_report: {}
    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:
    health_report:
      feature: "disk"
    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"
---
Usage stats on the health API:
- requires:
    cluster_features: "gte_v8.7.0"
    reason: "the health api stats were only added to the usage api in 8.7"
- do:
    xpack.usage: {}
    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"
- match:
    health_api.available: true
- match:
    health_api.enabled: true
- match:
    health_api.invocations.total: 2
- match:
    health_api.invocations.verbose_true: 2
- match:
    health_api.statuses.red: 1
- match:
    health_api.statuses.green: 1
- match:
    health_api.statuses.values:
    - "green"
    - "red"
- match:
    health_api.indicators.red.values:
    - "shards_availability"
- match:
    health_api.indicators.red.shards_availability: 1
- match:
    health_api.diagnoses.red.elasticsearch:health:shards_availability:diagnosis:enable_index_allocations: 1
- match:
    health_api.diagnoses.red.values:
    - "elasticsearch:health:shards_availability:diagnosis:enable_index_allocations"
