# Logstash document\_id for 3 joined tables

**URL:** <https://discuss.elastic.co/t/logstash-document-id-for-3-joined-tables/318896>\
**Category:** Logstash\
**Created:** [November 14, 2022, 6:58pm UTC](https://discuss.elastic.co/t/logstash-document-id-for-3-joined-tables/318896 "2022-11-14T18:58:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swati\_Kanade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swati_kanade/32/113343_2.png) [@Swati\_Kanade](https://discuss.elastic.co/u/Swati_Kanade)\
**Post date:** [November 14, 2022, 6:58pm UTC](https://discuss.elastic.co/t/logstash-document-id-for-3-joined-tables/318896/1 "2022-11-14T18:58:32Z")

</div>

Hi, I am new to ELK stack search. I have created an index by joining 3 tables - message, message\_recipient and message\_attachments - using inner join on message and message\_recipient and left outer join on message\_attachment since message may or may not have attachments. Now I want to get combined output of these joins in one index and also avoid duplicates.

```auto
elasticsearch {
  hosts => ..
  index => ..
  document_id => "%{message_id}%{recipient_id}%{attachment_id}"
}

```

With this document\_id, only those messages will be ingested for which there is one or more attachments but there are recipients of messages for which there are no attachments, I want those records as well. How to ingest those records ?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [November 14, 2022, 8:34pm UTC](https://discuss.elastic.co/t/logstash-document-id-for-3-joined-tables/318896/2 "2022-11-14T20:34:27Z")

</div>

You could try using a [fingerprint](https://www.elastic.co/guide/en/logstash/current/plugins-filters-fingerprint.html) filter, that will create a hash of whichever fields exist, and you can use that as the document id.

---

<div class="post-metadata">

**Author:** ![Swati\_Kanade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swati_kanade/32/113343_2.png) [@Swati\_Kanade](https://discuss.elastic.co/u/Swati_Kanade)\
**Post date:** [November 15, 2022, 11:58am UTC](https://discuss.elastic.co/t/logstash-document-id-for-3-joined-tables/318896/3 "2022-11-15T11:58:15Z")

</div>

Thank you for your suggestion, I will check fingerprint filter.

---

<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:** [December 13, 2022, 11:58am UTC](https://discuss.elastic.co/t/logstash-document-id-for-3-joined-tables/318896/4 "2022-12-13T11:58:59Z")

</div>

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