Skip to content

Elasticsearch does not handle some http methods properly #31017

@Tim-Brooks

Description

@Tim-Brooks

Currently when we convert a low-level netty http method to an elasticsearch http method we consider an unknown request type to be a GET request.

    public Method method() {
        HttpMethod httpMethod = request.method();
        if (httpMethod == HttpMethod.GET)
            return Method.GET;

        if (httpMethod == HttpMethod.POST)
            return Method.POST;

        if (httpMethod == HttpMethod.PUT)
            return Method.PUT;

        if (httpMethod == HttpMethod.DELETE)
            return Method.DELETE;

        if (httpMethod == HttpMethod.HEAD) {
            return Method.HEAD;
        }

        if (httpMethod == HttpMethod.OPTIONS) {
            return Method.OPTIONS;
        }

        return Method.GET;
    }

Currently that means that PATCH, TRACE, and CONNECT methods are treated as GET methods by elasticsearch. If we do not plan on supporting these methods, we should just return a 405 instead of silently pretending that these are GET requests.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions