# Querying documents from element in Array

**URL:** https://discuss.elastic.co/t/querying-documents-from-element-in-array/81000
**Category:** Elasticsearch
**Created:** [April 3, 2017, 12:18pm UTC](https://discuss.elastic.co/t/querying-documents-from-element-in-array/81000 "2017-04-03T12:18:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Alek\_Gold](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alek_gold/32/16993_2.png) [@Alek\_Gold](https://discuss.elastic.co/u/Alek_Gold)
#### Post date: [April 3, 2017, 12:18pm UTC](https://discuss.elastic.co/t/querying-documents-from-element-in-array/81000/1 "2017-04-03T12:18:49Z")

</div>

Hi Everyone !

First of all, I would like to thanks Elastic's team for their work.

I already checked other topics before create a new one but I didn't find anything.  
This [Topic](https://discuss.elastic.co/t/matching-by-array-elements/39530) is the closest than my problem but the solution seems to be Inappropriate.

My issue is :

In my documents, I have a field which is an array of integers.  
my\_field = [2,3,6]

I would like to get all the documents which have for exemple, the element 2 in its array.  
I already tried several solutions as bool =\> must or bool =\> script =\> script but none of them was successfull.

Have you any idea ?

Thank you.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [April 3, 2017, 12:36pm UTC](https://discuss.elastic.co/t/querying-documents-from-element-in-array/81000/2 "2017-04-03T12:36:28Z")

</div>

I think that a term query will work.

---

<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: [May 1, 2017, 12:36pm UTC](https://discuss.elastic.co/t/querying-documents-from-element-in-array/81000/3 "2017-05-01T12:36:47Z")

</div>

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