Elasticsearch update node

Hello there!

I am retrieving documents from an index “A” in Elasticsearch (ES), merging it with some additional information, and I want to update all the documents in “A” with the new additional information. The update document in ES only allow to insert a document ID manually. Do you have any idea how can I automatically send all the ids from the following Workflow

Of course Google sheets data has been erased for privacy reasons. At the end, taking all documents ID from the Merge step and send by looping or 1 by one to update in ES. Is there a better way to do it? Thank you very much for your help!

Update: I realize I could split into batches of size 1 and then pass the Document ID. However the following error is appearing:

ERROR: UNKNOWN ERROR - check the detailed error for more information
failed to parse field [_id] of type [_id] in document with id '12345678912345'. Preview of field's value: '12345678912345'

{
"context":
{
},
"name":
"NodeApiError",
"cause":
{
"message":
"400 - {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."}],"type":"mapper_parsing_exception","reason":"failed to parse field [_id] of type [_id] in document with id 'xxxxxxxxxxx'. Preview of field's value: 'xxxxxxxxx'","caused_by":{"type":"mapper_parsing_exception","reason":"Field [_id] is a metadata field and cannot be added inside a document. Use the index API request parameters."}},"status":400}",

Here is my updated workflow:

Hey @jfer,

I would probably use {{$json["_id"]}} in the expression, You should be able to do this without the split in batches node as well. I suspect the issue here will be that the _id is being passed in so it is trying to overwrite it which it can’t do so it could be that you need to add _id to the ignore list in the ES update just under the automap field.

1 Like

Hi @Jon thanks for the reply. The explanation makes totally sense. I followed the guidelines and it worked. you rock! thanks :slight_smile:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.