# Creating the document\_id in logstash by combining the two columns coming from the input jdbc filter

**URL:** <https://discuss.elastic.co/t/creating-the-document-id-in-logstash-by-combining-the-two-columns-coming-from-the-input-jdbc-filter/39580>\
**Category:** Logstash\
**Created:** [January 19, 2016, 6:26pm UTC](https://discuss.elastic.co/t/creating-the-document-id-in-logstash-by-combining-the-two-columns-coming-from-the-input-jdbc-filter/39580 "2016-01-19T18:26:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandeep\_Venkatesh](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@Sandeep\_Venkatesh](https://discuss.elastic.co/u/Sandeep_Venkatesh)\
**Post date:** [January 19, 2016, 6:26pm UTC](https://discuss.elastic.co/t/creating-the-document-id-in-logstash-by-combining-the-two-columns-coming-from-the-input-jdbc-filter/39580/1 "2016-01-19T18:26:42Z")

</div>

Right now this is how it looks,

elasticsearch {  
user =\> "admin"  
password =\> "elastic"  
index =\> "customs"  
manage\_template =\> false  
template\_name =\> "template1"  
document\_type =\> "test"  
document\_id =\> "%{item\_id}"  
hosts =\> "[https://localhost:9200/](https://localhost:9200/)"  
flush\_size =\> 1000  
}

There is one more field with class\_Id, how can combine item\_id and class\_id to form one single document\_id in logstash

Thank You

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [January 19, 2016, 6:42pm UTC](https://discuss.elastic.co/t/creating-the-document-id-in-logstash-by-combining-the-two-columns-coming-from-the-input-jdbc-filter/39580/2 "2016-01-19T18:42:54Z")

</div>

I suppose that depends on what you mean by "combine." Elasticsearch only cares that `document_id` is unique within an index and type (though it should be unique across the index regardless of type).

In that sense, you can concatenate your `item_id` and `class_id` fields as follows:

```auto
document_id => "%{class_id}%{item_id}"

```

If you wanted to do some kind of fingerprint of the two combined, look into the fingerprint plugin. You could use the resulting field as the id.

---

<div class="post-metadata">

**Author:** ![Sandeep\_Venkatesh](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@Sandeep\_Venkatesh](https://discuss.elastic.co/u/Sandeep_Venkatesh)\
**Post date:** [February 17, 2016, 5:54am UTC](https://discuss.elastic.co/t/creating-the-document-id-in-logstash-by-combining-the-two-columns-coming-from-the-input-jdbc-filter/39580/3 "2016-02-17T05:54:46Z")

</div>

Thanks theuntergeek 😃

---

<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, 5:11am UTC](https://discuss.elastic.co/t/creating-the-document-id-in-logstash-by-combining-the-two-columns-coming-from-the-input-jdbc-filter/39580/4 "2017-07-06T05:11:04Z")

</div>


