# Returning multiple inner hits

**URL:** <https://discuss.elastic.co/t/returning-multiple-inner-hits/86794>\
**Category:** Elasticsearch\
**Created:** [May 23, 2017, 10:30am UTC](https://discuss.elastic.co/t/returning-multiple-inner-hits/86794 "2017-05-23T10:30:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmills-Inkwrx](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@bmills-Inkwrx](https://discuss.elastic.co/u/bmills-Inkwrx)\
**Post date:** [May 23, 2017, 10:30am UTC](https://discuss.elastic.co/t/returning-multiple-inner-hits/86794/1 "2017-05-23T10:30:11Z")

</div>

I have a query that aims to return just the specified nested fields.

```
GET data/_search?pretty
{
  "_source":false,
  "query": {
    "nested":{
      "path":"fields",
     "query":{
            "match":{"fields.fieldId":"fdtElem7"}
       },
       "inner_hits":{}
     }
    
  }
}

```

This works perfectly and returns just the nested field I want. But what I really need is to return more than one nested field. So say I require 2 nested fields returned, one with id "fdtElem7" and another with id: "fdtElem144", how would I amend my query to allow this? (I've tried a lot of different things, bool etc that haven't worked.)

---

<div class="post-metadata">

**Author:** ![bmills-Inkwrx](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@bmills-Inkwrx](https://discuss.elastic.co/u/bmills-Inkwrx)\
**Post date:** [May 23, 2017, 10:39am UTC](https://discuss.elastic.co/t/returning-multiple-inner-hits/86794/2 "2017-05-23T10:39:48Z")

</div>

never mind, I figured it out. 🙂

```
 GET data/_search?pretty
{
  "_source":false,
  "query": {
    "nested":{
      "path":"fields",
     "query":{
       "bool":
       {
         "should": [
           {"match":{"fields.fieldId":"fdtElem2607Group"}},
             {"match":{"fields.fieldId":"fdtElem115Group"}}
         ]
       }
            
       },
       "inner_hits":{}
     }
    
  }
}
```

---

<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 20, 2017, 10:39am UTC](https://discuss.elastic.co/t/returning-multiple-inner-hits/86794/3 "2017-06-20T10:39:52Z")

</div>

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