# How to set the id in elasticsearch

**URL:** <https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944>\
**Category:** Elasticsearch\
**Created:** [June 25, 2016, 3:33pm UTC](https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944 "2016-06-25T15:33:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![chagara](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chagara](https://discuss.elastic.co/u/chagara)\
**Post date:** [June 25, 2016, 3:33pm UTC](https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944/1 "2016-06-25T15:33:51Z")

</div>

helo,

How you set the id when sending files to elasticsearch? I'm using filebeat to send the logs, then to logstash then to elasticsearch. I'm using Kibana and the fields for \_id show up but, I'm not sure how to change this. I'm also trying to use nifi to sends file to elasticsearch and it requires to know the id before it can successfully send to elasticsearch.

[https://nifi.apache.org/docs.html](https://nifi.apache.org/docs.html) the putelasticsearch processor. Identifier Attribute The name of the attribute containing the identifier for each FlowFile which is where the id part goes in.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 25, 2016, 8:45pm UTC](https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944/2 "2016-06-25T20:45:34Z")

</div>

You cannot do this with filebeat.  
You would need to do it with Logstash and then set [https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-document\_id](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html#plugins-outputs-elasticsearch-document_id) yourself.

---

<div class="post-metadata">

**Author:** ![chagara](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chagara](https://discuss.elastic.co/u/chagara)\
**Post date:** [June 25, 2016, 10:39pm UTC](https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944/3 "2016-06-25T22:39:19Z")

</div>

What if i'm using something else as the transport of data and not logstash? How do I do that?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 26, 2016, 1:25am UTC](https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944/4 "2016-06-26T01:25:03Z")

</div>

Then pass in an `_id` when you send the doc.

---

<div class="post-metadata">

**Author:** ![chagara](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chagara](https://discuss.elastic.co/u/chagara)\
**Post date:** [June 26, 2016, 2:24am UTC](https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944/5 "2016-06-26T02:24:40Z")

</div>

how I do that? I been trying to google some info but, not easy to find.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 26, 2016, 2:26am UTC](https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944/6 "2016-06-26T02:26:41Z")

</div>

That depends entirely on whatever you are pushing the data to ES with.

---

<div class="post-metadata">

**Author:** ![streamn](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@streamn](https://discuss.elastic.co/u/streamn)\
**Post date:** [June 27, 2016, 3:33am UTC](https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944/7 "2016-06-27T03:33:13Z")

</div>

your document should have a top level '\_id' field with the value you want.

---

<div class="post-metadata">

**Author:** ![NoName](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/noname/32/16743_2.png) [@NoName](https://discuss.elastic.co/u/NoName)\
**Post date:** [March 27, 2017, 12:32am UTC](https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944/8 "2017-03-27T00:32:37Z")

</div>

Set the "Identifier Attribute" under Procces details for PutElasticsearchHttp. Please note that this should be flowfile attribute. Custom Flow file attributes can be added using Process UpdateAttribute.

---

<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:** [July 5, 2017, 10:01pm UTC](https://discuss.elastic.co/t/how-to-set-the-id-in-elasticsearch/53944/9 "2017-07-05T22:01:52Z")

</div>


