# Query to compare between lists

**URL:** https://discuss.elastic.co/t/query-to-compare-between-lists/147909
**Category:** Elasticsearch
**Created:** [September 10, 2018, 7:37am UTC](https://discuss.elastic.co/t/query-to-compare-between-lists/147909 "2018-09-10T07:37:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rakshify](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakshify/32/35355_2.png) [@rakshify](https://discuss.elastic.co/u/rakshify)
#### Post date: [September 10, 2018, 7:37am UTC](https://discuss.elastic.co/t/query-to-compare-between-lists/147909/1 "2018-09-10T07:37:09Z")

</div>

Hi,

I need to have a field, say "tags", in indexed document which has a list value. I have the same field in request at query time, "tags", which again has a list value.  
Could someone please help me with query, and also indexing if something special is to be done at that time to make the things happen, to match such that we select only those documents whose "tags" have a non-empty intersection with "tags" in request.

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: [October 8, 2018, 7:37am UTC](https://discuss.elastic.co/t/query-to-compare-between-lists/147909/2 "2018-10-08T07:37:11Z")

</div>

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