# Providing id for each document in Index while indexing data from HDFS to elasticsearch index

**URL:** <https://discuss.elastic.co/t/providing-id-for-each-document-in-index-while-indexing-data-from-hdfs-to-elasticsearch-index/22757>\
**Category:** Elasticsearch\
**Created:** [March 19, 2015, 11:00am UTC](https://discuss.elastic.co/t/providing-id-for-each-document-in-index-while-indexing-data-from-hdfs-to-elasticsearch-index/22757 "2015-03-19T11:00:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashit\_pupu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashit_pupu/32/101113_2.png) [@ashit\_pupu](https://discuss.elastic.co/u/ashit_pupu)\
**Post date:** [March 19, 2015, 11:00am UTC](https://discuss.elastic.co/t/providing-id-for-each-document-in-index-while-indexing-data-from-hdfs-to-elasticsearch-index/22757/1 "2015-03-19T11:00:08Z")

</div>

Hi

I am new to elasticsearch- hadoop . Currently trying to index data stored  
in HDFS to elasticsearch index. I am to do that successfully . But while  
doing that my only concern is when we index the data by help of code , then  
each document is provided with an id field , which is randomly generated.  
Is there any way by which we can manually assign the value , which will be  
unique ?  
Currently I am using the below code to index the data :-

JobConf conf = new JobConf();  
conf.set("es.nodes", "es-server:9200");  
conf.set("es.resource", "index\_name/index\_type");  
conf.setOutputFormat(EsOutputFormat.class);

this forms the index in proper manner as shown in the screen shot attached.  
Where the id field is marked in red.  
So as my concern I want that id field to be manually provided.  
Please let me know the solution .

Thanks  
Ashit

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/81042757-b6d7-4b39-8837-03a05ca12a0c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/81042757-b6d7-4b39-8837-03a05ca12a0c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:25am UTC](https://discuss.elastic.co/t/providing-id-for-each-document-in-index-while-indexing-data-from-hdfs-to-elasticsearch-index/22757/2 "2017-07-06T00:25:39Z")

</div>


