# Indicies Filter or Script Filter?

**URL:** <https://discuss.elastic.co/t/indicies-filter-or-script-filter/30027>\
**Category:** Elasticsearch\
**Created:** [September 25, 2015, 2:27pm UTC](https://discuss.elastic.co/t/indicies-filter-or-script-filter/30027 "2015-09-25T14:27:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tegan\_Snyder](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tegan_snyder/32/4946_2.png) [@Tegan\_Snyder](https://discuss.elastic.co/u/Tegan_Snyder)\
**Post date:** [September 25, 2015, 2:27pm UTC](https://discuss.elastic.co/t/indicies-filter-or-script-filter/30027/1 "2015-09-25T14:27:06Z")

</div>

I'm looking for a way to perform a query similar to a MySQL WHERE IN query.

I have two indexes:

- Index A contains many documents describing a widget (size, desc, weight, price, UPC, part\_num, etc)
- Index B just contains UPCs and location.

I'm MySQL If I was looking to get a result set containing all the documents from Index A that have a UPC shared with Index B I would write:

SELECT \* FROM IndexA WHERE IndexA.UPC IN (SELECT IndexB.UPC FROM IndexB)

Is there a similar way to do this in ElasticSearch. I've looked into the indicies filter and script filter, but i think I may be missing something.

Thanks

---

<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:** [July 5, 2017, 11:48pm UTC](https://discuss.elastic.co/t/indicies-filter-or-script-filter/30027/2 "2017-07-05T23:48:05Z")

</div>

Closed on July 5, 2017, 11:48pm UTC


