Skip to content

Allocation explain should accept query-string parameters #127028

Open
@DaveCTurner

Description

@DaveCTurner

Today allocation explain takes its parameters in the request body:

GET _cluster/allocation/explain
{
  "index": "my-index-000001",
  "shard": 0,
  "primary": false,
  "current_node": "my-node"
}

Leaving aside the question of the validity of GET-with-body (you can use POST here) it's also just kinda awkward to pass in a flat map of 4 somewhat-optional parameters in the body. We could just as well make the API accept the same parameters in the query-part of the URI1:

GET _cluster/allocation/explain?index=my-index-000001&shard=0&primary=false&current_node=my-node

Note that we probably shouldn't accept a mix of these two styles: if there are any parameters, they must all be in the body or all in the query string. We might even want to deprecate the use of the body for these arguments and remove it in the next major?

Footnotes

  1. Technically ok you can already do this using the source and source_content_type params:

    GET _cluster/allocation/explain?source_content_type=application/json&source=%7B%22index%22%3A%22my-index-000001%22%2C%22shard%22%3A0%2C%22primary%22%3Afalse%2C%22current_node%22%3A%22my-node%22%7D
    

    But eh that's not all that nice is it?

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)>enhancementSupportabilityImprove our (devs, SREs, support eng, users) ability to troubleshoot/self-service product better.Team:Distributed CoordinationMeta label for Distributed Coordination team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions