You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
[2014-09-01 20:08:31,486][DEBUG][action.admin.indices.mapping.put] [Prototype] failed to put mappings on indices [[my_index]], type [my_type]
java.lang.NullPointerException
at org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFactory.java:137)
at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:113)
at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:101)
at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:181)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:387)
at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:377)
at org.elasticsearch.cluster.metadata.MetaDataMappingService$5.execute(MetaDataMappingService.java:540)
at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:309)
at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:134)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
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.
The text was updated successfully, but these errors were encountered:
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
XContentHelper.convertToMap()
which does not properly check fornull
.https://github.com/elasticsearch/elasticsearch/blob/a059a6574a1c270ccc28ddec1671888fb0cfba28/src/main/java/org/elasticsearch/common/xcontent/XContentHelper.java#L111-L113
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.
The text was updated successfully, but these errors were encountered: