Can we add pattern matching in document_id while updating?

I want to add a new field to a document with document_id like "{id}-{word}" by using logstash.
I just know {id} part while updating. Is there a way can I do it either by update_by_query in script and how should I define document_id in elasticsearch output plugin.

I'm trying to do:
elasticsearch {
index => "ib-node_parsed-v1"
document_type => "parsed_node"
document_id => {
#not sure about this part, is there any way to achieve this. I want to do "Update all documents where document_id is like {456789}-{word}
grok {
match => { "message" => "event.get('uniqueCollectionId')-%{GREEDYDATA}"
} }
action => "update"
hosts => "ip:9200"
script_lang => "painless"
script_type => "inline"
script => '
ctx._source.brandingName = params.event.get("brandingName");
ctx._source.globalCustomerId = params.event.get("globalCustomerId");
'
}

1 Like

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