Skip to content

Cluster health returns 500 when wait_for_active_shards is set to 'all' #31151

Closed
@javanna

Description

@javanna

Steps to reproduce (6.2, 6.x and master):

  1. create an index
curl -XPUT localhost:9200/index
  1. call cluster health with wait_for_active_shards set to all
curl 'localhost:9200/_cluster/health?wait_for_active_shards=all&pretty'

An IllegalStateException is returned as part of the response, the status code is 500:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_state_exception",
        "reason" : "not enough information to resolve to shard count"
      }
    ],
    "type" : "illegal_state_exception",
    "reason" : "not enough information to resolve to shard count"
  },
  "status" : 500
}

The error comes from https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/action/support/ActiveShardCount.java#L131 , reading from its javadocs "This method should only be invoked with ActiveShardCount objects created from from(int), or NONE or ONE". We are calling it though with ALL .

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Distributed Coordination/AllocationAll issues relating to the decision making around placing a shard (both master logic & on the nodes)>bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions