# Select records from first index which are not present in another index

**URL:** <https://discuss.elastic.co/t/select-records-from-first-index-which-are-not-present-in-another-index/202510>\
**Category:** Elasticsearch\
**Created:** [October 7, 2019, 9:29am UTC](https://discuss.elastic.co/t/select-records-from-first-index-which-are-not-present-in-another-index/202510 "2019-10-07T09:29:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sonu\_Pajai\_Save](https://avatars.discourse-cdn.com/v4/letter/s/e9bcb4/32.png) [@Sonu\_Pajai\_Save](https://discuss.elastic.co/u/Sonu_Pajai_Save)\
**Post date:** [October 7, 2019, 9:29am UTC](https://discuss.elastic.co/t/select-records-from-first-index-which-are-not-present-in-another-index/202510/1 "2019-10-07T09:29:56Z")

</div>

i wish select those records from products index which are not in shop\_inventory index  
is there any way to achieve this in elasticsearch. product\_id is the common field in both indexes

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 7, 2019, 12:37pm UTC](https://discuss.elastic.co/t/select-records-from-first-index-which-are-not-present-in-another-index/202510/2 "2019-10-07T12:37:53Z")

</div>

you cannot join the data from two indices together.

Data modeling question: Is there a chance that you could merge the two indices into one, by putting both information into a single document? Or alternatively take a look at the [join datatype](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/parent-join.html)

--Alex

---

<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 4, 2019, 1:28pm UTC](https://discuss.elastic.co/t/select-records-from-first-index-which-are-not-present-in-another-index/202510/4 "2019-11-04T13:28:26Z")

</div>

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