I used to use Logstash to ingest data to Elasticsearch, now I plan to change it to logstash, but there is one functionality I have to rely on, I need to generate a hash to uniquely identify a document
This is the logstash code I have, I how can I have the same functionality in ingesting processor as the following code in logstash
ruby {
code => "require 'digest/md5';
event['@metadata']['computed_id'] = Digest::MD5.hexdigest(event['filed1'].to_s + event['field2'].to_s + event['record_time'].to_s );
end "
}
I have two questions
- Is there any way to have external md5 library to generate hash code based on some fields values?
- In ingesting node, how do I set ['@metadata']['computed_id'] for elasticsearch to pick up the document id for each document