# How to join two stream data sources and find matches

**URL:** https://discuss.elastic.co/t/how-to-join-two-stream-data-sources-and-find-matches/346097
**Category:** Logstash
**Created:** [October 31, 2023, 8:22am UTC](https://discuss.elastic.co/t/how-to-join-two-stream-data-sources-and-find-matches/346097 "2023-10-31T08:22:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![fim01](https://avatars.discourse-cdn.com/v4/letter/f/b4bc9f/32.png) [@fim01](https://discuss.elastic.co/u/fim01)
#### Post date: [October 31, 2023, 8:22am UTC](https://discuss.elastic.co/t/how-to-join-two-stream-data-sources-and-find-matches/346097/1 "2023-10-31T08:22:08Z")

</div>

I'm asking for an idea or approach to solve the following business problem:

Two stream data sources (A and B) continuously ingesting events into two separate indices (A and B) in Elasticsearch. Each of them has a unique \_id.

My goal is to merge Index A with Index B based on the unique \_id field of the document and split the result into three buckets:

Bucket 1: All documents from Index A without a matching \_id from Index B  
Bucket 2: All documents from Index B without a matching \_id from Index A  
Bucket 3: All documents which has been matched but shall only stored as a single document.

Keep in mind, the data might be incomplete at a certain time but documents may match in a later stage due to continuous document ingestion.

May I implement the explained scenario with Logstash (how?) or do I need other components like kafka and/or message queueing? What is the most convenient approach? Any experiences?

Thanks for you help.

---

<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 28, 2023, 8:22am UTC](https://discuss.elastic.co/t/how-to-join-two-stream-data-sources-and-find-matches/346097/2 "2023-11-28T08:22:51Z")

</div>

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