Skip to content

Unsupported methods on REST endpoints should respond with status code 405 #15335

@jasontedor

Description

@jasontedor

Today, if a request is executed against an endpoint with a method in the request line that that endpoint does not support, Elasticsearch responds with a response like:

{
  "error" : {
    "root_cause" : [ {
      "type" : "illegal_argument_exception",
      "reason" : "No feature for name [_forcemerge]"
    } ],
    "type" : "illegal_argument_exception",
    "reason" : "No feature for name [_forcemerge]"
  },
  "status" : 400
}

This is confusing for users*, semantically wrong, and contrary to the HTTP spec. Instead, Elasticsearch should respond with HTTP status code 405 (Method Not Allowed) and include in the Allow header a list of methods that the endpoint does support.

*: Googling "no feature for name elasticsearch" just leads to pages describing issues when an index is missing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions