This does not work:
UpdateRequest updateRequest = new UpdateRequest();
updateRequest.index(index);
updateRequest.type(type);
updateRequest.id("1");
updateRequest.doc(jsonBuilder().startObject()
.field("subcat", object)
.endObject());
Client.update(updateRequest).actionGet();
Error:
MapperParsingException[object mapping for [subcat] tried to parse field [null] as object, but found a concrete value]
Please format code snippets with ```, they are much easier to read that way.
It looks like you are using the transport client - it has actionGet. We're moving away from that, slowly but surely. We haven't actually deprecated it, but it is deprecated in our hearts. Stick with the high level rest client.
What is object in your code? If it is a map or a list we'll try and unroll it. It looks like the error message is caused by you doing something like
POST /index/type/1/_update
{
"doc": {
"subcat": null
}
}
Or maybe "subcat": [null]. We're a little tricky about lists so I can't tell from the exception message.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.