Nested search does not find any result

Hi,

I have a document with some nested elements in it like

{
  ...
  elements: [
    {"content" : "car"},
    {"content" : "bicycle"}
  ]
  ...
}

If I search for a term a document is found if one of the elements contains the term.

A special case arises when I search for "car AND bicycle". Then the text shall be found because element1 contains car and element2 contains bicycle.

I do not use the Query String Query but parse the query on my own and generate a nested query with must like

{
  "nested": {
    "path" : "elements",
    "query" : {
      "bool" : {
        "must" : [
          { "match" : {"elements.content" : "car"}},
          { "match" : {"elements.content" : "bicycle"}},
        ]
     }
   }
}

In this case the document is not found. But why?

Does the nested query work like a loop? So, the match queries will be evaluated on the elements one by one and therefore does not find the document. Is this correct?

Greetings,
Martin

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