# Maintain \_id while Filtering from ES to ES via Logstash

**URL:** https://discuss.elastic.co/t/maintain-id-while-filtering-from-es-to-es-via-logstash/131687
**Category:** Logstash
**Created:** [May 14, 2018, 8:00am UTC](https://discuss.elastic.co/t/maintain-id-while-filtering-from-es-to-es-via-logstash/131687 "2018-05-14T08:00:28Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![yckoh](https://avatars.discourse-cdn.com/v4/letter/y/b19c9b/32.png) [@yckoh](https://discuss.elastic.co/u/yckoh)
#### Post date: [May 14, 2018, 8:00am UTC](https://discuss.elastic.co/t/maintain-id-while-filtering-from-es-to-es-via-logstash/131687/1 "2018-05-14T08:00:28Z")

</div>

Hi, I would like to filter an ES index to another ES index via logstash but currently the \_id isn't maintained. How an I get this done?  
input {  
elasticsearch {  
hosts =\> "someip"  
user =\>  
password =\> ""  
index =\> "someindex"

}  
}  
filter{  
mutate {  
convert =\> {  
"verified" =\> "integer"  
"number\_of\_employee" =\> "integer"  
"number\_of\_connections" =\> "integer"  
"years\_in\_operation" =\> "integer"  
}  
}  
}

output {  
#stdout { codec =\> json\_lines }  
elasticsearch {  
#protocol =\> http  
hosts =\> "someip"  
user =\>  
password =\> ""  
index =\> "someindex2"  
document\_type =\> "company"  
document\_id =\> "%{[document\_id]}"

```
}

```

}

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [May 14, 2018, 8:09am UTC](https://discuss.elastic.co/t/maintain-id-while-filtering-from-es-to-es-via-logstash/131687/2 "2018-05-14T08:09:59Z")

</div>

The documentation of the `docinfo` option of the elasticsearch input contains an example of this.

---

<div class="post-metadata">

### Author: ![yckoh](https://avatars.discourse-cdn.com/v4/letter/y/b19c9b/32.png) [@yckoh](https://discuss.elastic.co/u/yckoh)
#### Post date: [May 14, 2018, 8:17am UTC](https://discuss.elastic.co/t/maintain-id-while-filtering-from-es-to-es-via-logstash/131687/3 "2018-05-14T08:17:16Z")

</div>

found it. thanks!

---

<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: [June 11, 2018, 8:17am UTC](https://discuss.elastic.co/t/maintain-id-while-filtering-from-es-to-es-via-logstash/131687/4 "2018-06-11T08:17:23Z")

</div>

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