# Need to send query in my data view on 2 separate document

**URL:** <https://discuss.elastic.co/t/need-to-send-query-in-my-data-view-on-2-separate-document/373792>\
**Category:** Elasticsearch\
**Created:** [January 28, 2025, 8:22pm UTC](https://discuss.elastic.co/t/need-to-send-query-in-my-data-view-on-2-separate-document/373792 "2025-01-28T20:22:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ermisma](https://avatars.discourse-cdn.com/v4/letter/e/48db29/32.png) [@ermisma](https://discuss.elastic.co/u/ermisma)\
**Post date:** [January 28, 2025, 8:22pm UTC](https://discuss.elastic.co/t/need-to-send-query-in-my-data-view-on-2-separate-document/373792/1 "2025-01-28T20:22:12Z")

</div>

Hi,  
I’m working with a Dataview where I’m querying to extract specific information from raw data for my use case. The issue I’m facing is that I have multiple documents, and some of the fields I need to query are not in the same document. Is it possible to send a query that targets two different documents within the same index in the Dataview?

---

<div class="post-metadata">

**Author:** ![jessgarson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jessgarson/32/129841_2.png) [@jessgarson](https://discuss.elastic.co/u/jessgarson)\
**Post date:** [January 28, 2025, 11:09pm UTC](https://discuss.elastic.co/t/need-to-send-query-in-my-data-view-on-2-separate-document/373792/2 "2025-01-28T23:09:20Z")

</div>

Thanks for reaching out, @ermisma. Can you provide more context on how your index and documents are structured? I'd also like to hear more about the results you are looking for from your data view.

---

<div class="post-metadata">

**Author:** ![ermisma](https://avatars.discourse-cdn.com/v4/letter/e/48db29/32.png) [@ermisma](https://discuss.elastic.co/u/ermisma)\
**Post date:** [January 29, 2025, 1:58am UTC](https://discuss.elastic.co/t/need-to-send-query-in-my-data-view-on-2-separate-document/373792/3 "2025-01-29T01:58:28Z")

</div>

Thank you  
I have a single data view on top of a single index, but the output I need from my query requires fields that are spread across separate documents/events. In traditional databases, you’d perform a join between tables, but I’m not sure how to handle this in ELK. Do I need to create a new index using a transform, or is there another approach you’d recommend?

For example, I have one document (the raw data in my data view) with fields like `[Job_id, Job_status]` , and another document with fields like `[Job_id, Job_name]` . My query needs to use both `Job_status` and `Job_name` , but since these fields are in different documents, I’m getting zero results. Is there a way to query fields from different documents in ELK?

---

<div class="post-metadata">

**Author:** ![RainTown](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raintown/32/140206_2.png) [@RainTown](https://discuss.elastic.co/u/RainTown)\
**Post date:** [January 29, 2025, 10:05am UTC](https://discuss.elastic.co/t/need-to-send-query-in-my-data-view-on-2-separate-document/373792/4 "2025-01-29T10:05:45Z")

</div>

This should be a FAQ.

The answer to “how to do what you want” here is very dependent on _precisely_ what you want. There’s no overall join equivalent that matches SQL JOIN, but a lot of problems are solvable with different techniques , maybe correctly formatted ES|QL query, or a transform, or adjusting input pipeline with some sort of enrichment.

As always, a few sample documents help a lot, as well as clear and complete explanation of the requirements.
