Hey dear Elasticsearch community,
I would like to send an UpdateRequest with the Java REST Client (7.13) to Elasticsearch using the .routing()
request parameter, because I am updating a join field. It seems, using this parameter does not take effect, as I still get a failure response with this error message:
Elasticsearch exception [type=illegal_argument_exception, reason=[routing] is missing for join field [email-attachment]]
The Java code I'm using for sending the request is as follows:
BulkRequest request = new BulkRequest();
// creating update object...
request.add(
new UpdateRequest("index-002", id)
.doc(updateObject.toString(), XContentType.JSON)
.routing("1")
);
// creating action listener...
request.routing("routing").timeout("1m");
client.client.bulkAsync(request, RequestOptions.DEFAULT, listener);
As you can see, I'm applying routing both to the update request and to the bulk request, but neither seems to do anything.
Note that running this request in the DevTools on the same index and data works, so the routing parameter should be correct:
POST index-002/_update/AXtZAYipjpoOf5DsXeDv?routing=1
{
"doc": {
"email-attachment": {
"name": "attachment",
"parent": "RtgEWXsBbfUU64dFU_Ei"
}
}
}
What am I doing wrong? Could the error message be inaccurate and the missing routing parameter is not the problem?
Thanks for any help, even with tips on where I could start debugging this. I'm at my wit's end.