# Nested search does not find any result

**URL:** <https://discuss.elastic.co/t/nested-search-does-not-find-any-result/149691>\
**Category:** Elasticsearch\
**Created:** [September 24, 2018, 2:31pm UTC](https://discuss.elastic.co/t/nested-search-does-not-find-any-result/149691 "2018-09-24T14:31:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Kruger](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@Martin\_Kruger](https://discuss.elastic.co/u/Martin_Kruger)\
**Post date:** [September 24, 2018, 2:31pm UTC](https://discuss.elastic.co/t/nested-search-does-not-find-any-result/149691/1 "2018-09-24T14:31:02Z")

</div>

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

---

<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:** [October 22, 2018, 2:31pm UTC](https://discuss.elastic.co/t/nested-search-does-not-find-any-result/149691/2 "2018-10-22T14:31:07Z")

</div>

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