How to write following request from java
POST index/type/1/_update
{
"doc" : {
"subcat" : [
{
"name": "Test",
"id": [
{
"value": "IP/IP1",
"type": "key"
},
{
"value": "0000151",
"type": "value"
}
],
"role": [
"role"
]
},
{
"name": "Test",
"identifier": [
{
"value": "11/MNP",
"type": "key"
},
{
"value": "0677427",
"type": "value"
}
]
}
]
}
}
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]