# Need an example to search incoming value in a Multi valued attribute

**URL:** <https://discuss.elastic.co/t/need-an-example-to-search-incoming-value-in-a-multi-valued-attribute/366917>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [September 22, 2024, 9:08am UTC](https://discuss.elastic.co/t/need-an-example-to-search-incoming-value-in-a-multi-valued-attribute/366917 "2024-09-22T09:08:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vkrishna](https://avatars.discourse-cdn.com/v4/letter/v/cab0a1/32.png) [@vkrishna](https://discuss.elastic.co/u/vkrishna)\
**Post date:** [September 22, 2024, 9:08am UTC](https://discuss.elastic.co/t/need-an-example-to-search-incoming-value-in-a-multi-valued-attribute/366917/1 "2024-09-22T09:08:55Z")

</div>

## Hi Team, I need an example to search a value in a multi valued attribute. Example: Let's say I have below documents in an index.

```auto
[
   { "id":1, "lenders"=[32,76], "lender_yield"=1.0 },
   { "id":2, "lenders"=[1,9], "lender_yield"=1.1 },
   { "id":3, "lenders"="[76,100], "lender_yield"=3.0 },
   { "id":4, "lenders"=[4,32], "lender_yield"=2.8 }
]

```

- 

## If search value is 76 I should get documents with id 1 and 3. I want a JAVA Elasticsearch query written using co.elastic.clients.elasticsearch.\_types.query\_dsl.Query.

Could you please help me on this  
Thank you.

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [September 22, 2024, 4:20pm UTC](https://discuss.elastic.co/t/need-an-example-to-search-incoming-value-in-a-multi-valued-attribute/366917/2 "2024-09-22T16:20:28Z")

</div>

Hi @vkrishna

Look this question, maybe the solution help you:

> [@Using TermsQuery in Java API Client \[7.17\]](https://discuss.elastic.co/t/using-termsquery-in-java-api-client-7-17/304904):
>
> I'm using Java API Client [7.17] in my project. I'm able to do most of the queries, but I'm trying to figure out how to search for multiple values in a particular fields and return values containing any of the values provided. I would assume Terms Query is what I'm looking for. But how do I pass a String array/list into the TermsQuery in Java API Client. For example how do I write the below in Java: GET /\_search { "query": { "terms": { "referenceno": ["xxx", "yyy"] } } } F…
