# I am trying to write a query for the below input(array of objects)

**URL:** <https://discuss.elastic.co/t/i-am-trying-to-write-a-query-for-the-below-input-array-of-objects/179459>\
**Category:** Elasticsearch\
**Created:** [May 3, 2019, 4:24am UTC](https://discuss.elastic.co/t/i-am-trying-to-write-a-query-for-the-below-input-array-of-objects/179459 "2019-05-03T04:24:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vnrj1995](https://avatars.discourse-cdn.com/v4/letter/v/e0b2c6/32.png) [@vnrj1995](https://discuss.elastic.co/u/vnrj1995)\
**Post date:** [May 3, 2019, 4:24am UTC](https://discuss.elastic.co/t/i-am-trying-to-write-a-query-for-the-below-input-array-of-objects/179459/1 "2019-05-03T04:24:19Z")

</div>

I am trying to write a query for the below input(array of objects).

```auto
"UserDetails": [                                    
     { "Name" : "Vanaraj", "Age" : "27", "country" : "India" },
     { "Name" : "Ranjit", "Age" : "26", "country" : "US" }
  ]

```

Name, Age, Country are three different fields, their type is text. From the front end, input will come like the above combination of all three fields with the array.

I need to write a query with these three combinations and filter the records from the index based on the combination of all the three fields and their values. "UserDetails" is just a name which I mentioned three fields only present in the index.

Search the index with the combination of {"Name" : "Vanaraj", "Age" : "27", "country" : "India"} and { "Name" : "Ranjit", "Age" : "26", "country" : "US" } and output should come whatever match with these combination.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 6, 2019, 8:09am UTC](https://discuss.elastic.co/t/i-am-trying-to-write-a-query-for-the-below-input-array-of-objects/179459/2 "2019-05-06T08:09:08Z")

</div>

Hey,

take a look at the [nested datatype](https://www.elastic.co/guide/en/elasticsearch/reference/7.0/nested.html) plus its queries and aggregations.

---

<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:** [June 3, 2019, 8:09am UTC](https://discuss.elastic.co/t/i-am-trying-to-write-a-query-for-the-below-input-array-of-objects/179459/3 "2019-06-03T08:09:09Z")

</div>

Closed on June 3, 2019, 8:09am UTC

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