Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Putting a mapping with an empty request body throws a NullPointerException #7536
I have been struggling with an issue lately caused by my own fault of providing a valid request body when attempting to add a mapping to an existing index. Attempting to do so will yield a NullPointerException:
The issues is caused by https://github.com/elasticsearch/elasticsearch/blob/a059a6574a1c270ccc28ddec1671888fb0cfba28/src/main/java/org/elasticsearch/common/xcontent/XContentFactory.java#L213 which returns null if the input stream is empty. While this is fine, the real problem lies in
To be fair, this isn't really a bug and I'm more like asking to yield a proper exception in case a developer is as dumb as me and fails to provide a proper request body.