Querying documents from element in Array

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 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.

I think that a term query will work.

1 Like

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