# How to add custom routing ，version or id when index document

**URL:** <https://discuss.elastic.co/t/how-to-add-custom-routing-version-or-id-when-index-document/154951>\
**Category:** Beats\
**Created:** [November 1, 2018, 3:00am UTC](https://discuss.elastic.co/t/how-to-add-custom-routing-version-or-id-when-index-document/154951 "2018-11-01T03:00:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luzhzhsoft](https://avatars.discourse-cdn.com/v4/letter/l/e8c25b/32.png) [@luzhzhsoft](https://discuss.elastic.co/u/luzhzhsoft)\
**Post date:** [November 1, 2018, 3:00am UTC](https://discuss.elastic.co/t/how-to-add-custom-routing-version-or-id-when-index-document/154951/1 "2018-11-01T03:00:48Z")

</div>

i write a s custom beat.And i want to add custom id,routing,version when index document.Because i use join mapping type,and routing must be same with parent routing rather than id

---

<div class="post-metadata">

**Author:** ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)\
**Post date:** [November 1, 2018, 1:39pm UTC](https://discuss.elastic.co/t/how-to-add-custom-routing-version-or-id-when-index-document/154951/2 "2018-11-01T13:39:52Z")

</div>

Hi @luzhzhsoft and welcome 🙂

`elasticsearch` output in libbeat doesn't currently support the `join` datatype.  
You can set the ID of the documents using the `event.SetID(string)` method, and you can also add the fields, but there is no way to set the routing.

I was going to suggest you to create a new issue, but I see that you have already created one 🙂  
Linking it here for reference: [https://github.com/elastic/beats/issues/8865](https://github.com/elastic/beats/issues/8865)

---

<div class="post-metadata">

**Author:** ![luzhzhsoft](https://avatars.discourse-cdn.com/v4/letter/l/e8c25b/32.png) [@luzhzhsoft](https://discuss.elastic.co/u/luzhzhsoft)\
**Post date:** [November 2, 2018, 1:23am UTC](https://discuss.elastic.co/t/how-to-add-custom-routing-version-or-id-when-index-document/154951/3 "2018-11-02T01:23:28Z")

</div>

well,thank u 😀

---

<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:** [November 30, 2018, 3:23am UTC](https://discuss.elastic.co/t/how-to-add-custom-routing-version-or-id-when-index-document/154951/4 "2018-11-30T03:23:32Z")

</div>

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