Returning multiple inner hits

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

never mind, I figured it out. :slight_smile:

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

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