Skip to content

[BUG] 408 response with incorrect information returned from GET _cluster/health/<index> given nonexistent index #19022

@br0nstein

Description

@br0nstein

Describe the bug

Request:
curl -X GET "https://localhost:9200/_cluster/health/fake-index-doesnt-exist?level=shards&pretty" -u admin:admin -k

408 response with body:

{
  "cluster_name" : "opensearch-cluster",
  "status" : "red",
  "timed_out" : true,
  "number_of_nodes" : 3,
  "number_of_data_nodes" : 3,
  "discovered_master" : true,
  "discovered_cluster_manager" : true,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0,
  "indices" : { }
}

This is misleading as the cluster is actually green status, the problem is just no index with that name exists. If the index does not exist, I would expect it to return a 404 error response.

Related component

Other

To Reproduce

  1. GET _cluster/health/fake-index-doesnt-exist
  2. Observe request timeout (408 error) with response body indicating the cluster is not healthy

Expected behavior

404 response indicating the index does not exist, no mis-indication that the cluster health is red

Additional Details

"version" : {
"distribution" : "opensearch",
"number" : "3.1.0",
"build_type" : "tar",
"build_hash" : "8ff7c6ee924a49f0f59f80a6e1c73073c8904214",
"build_date" : "2025-06-21T08:05:43.345081313Z",
"build_snapshot" : false,
"lucene_version" : "10.2.1",
"minimum_wire_compatibility_version" : "2.19.0",
"minimum_index_compatibility_version" : "2.0.0"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    OtherbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions