Skip to content

Invalid JSON request bodies result in 500 response #49428

Closed
@pugnascotia

Description

@pugnascotia

Elasticsearch version: v7.3.1
OS version: Linux 4.4.0-1098-aws
JVM: OpenJDK 1.8.0_201 / 25.201-b09

Current behaviour:

If I execute a search with an invalid JSON request body, e.g. missing a double-quote:

GET blogs/_search
{"query":{"match":{"title":{"query":"open source software,"minimum_should_match":2}}}}

Then ES rejects the query with a 500, which indicates a server-side problem.

Expected behaviour:

The server should respond with "400 Bad Request", to indicate a client problem.

Impact:

The 500 is problematic because it indicates to clients that they can retry the request, but of course it will always fail. See also #48308, which concerns the Bulk API.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions