# Ingesting node

**URL:** <https://discuss.elastic.co/t/ingesting-node/76111>\
**Category:** Logstash\
**Created:** [February 22, 2017, 9:20pm UTC](https://discuss.elastic.co/t/ingesting-node/76111 "2017-02-22T21:20:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharon.c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharon.c/32/16076_2.png) [@sharon.c](https://discuss.elastic.co/u/sharon.c)\
**Post date:** [February 22, 2017, 9:20pm UTC](https://discuss.elastic.co/t/ingesting-node/76111/1 "2017-02-22T21:20:22Z")

</div>

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

1. Is there any way to have external md5 library to generate hash code based on some fields values?
2. In ingesting node, how do I set ['@metadata']['computed\_id'] for elasticsearch to pick up the document id for each document

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [February 23, 2017, 12:14am UTC](https://discuss.elastic.co/t/ingesting-node/76111/2 "2017-02-23T00:14:03Z")

</div>

Oddly, I was fiddling around this past weekend with the ingest node and made a processor to do this. It does MD5, SHA1, and SHA256. [https://github.com/eskibars/elasticsearch-ingest-hashfields](https://github.com/eskibars/elasticsearch-ingest-hashfields) . It only works on string data currently, but should be easy enough to extend if you need others.

---

<div class="post-metadata">

**Author:** ![sharon.c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharon.c/32/16076_2.png) [@sharon.c](https://discuss.elastic.co/u/sharon.c)\
**Post date:** [February 23, 2017, 1:58pm UTC](https://discuss.elastic.co/t/ingesting-node/76111/3 "2017-02-23T13:58:34Z")

</div>

Thank you so much for your answer.  
I also need to make this hash as \_id field. Can you provide an example how to do it?  
\_id field is important for duplication in our elasticsearch index, it makes sure we do not have repeated documents.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 23, 2017, 1:58pm UTC](https://discuss.elastic.co/t/ingesting-node/76111/4 "2017-03-23T13:58:47Z")

</div>

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