# Two step inner\_hits, and combine that with bool queries... that is not in nested type

**URL:** <https://discuss.elastic.co/t/two-step-inner-hits-and-combine-that-with-bool-queries-that-is-not-in-nested-type/86686>\
**Category:** Elasticsearch\
**Created:** [May 22, 2017, 2:27pm UTC](https://discuss.elastic.co/t/two-step-inner-hits-and-combine-that-with-bool-queries-that-is-not-in-nested-type/86686 "2017-05-22T14:27:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maralbe](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@maralbe](https://discuss.elastic.co/u/maralbe)\
**Post date:** [May 22, 2017, 2:27pm UTC](https://discuss.elastic.co/t/two-step-inner-hits-and-combine-that-with-bool-queries-that-is-not-in-nested-type/86686/1 "2017-05-22T14:27:49Z")

</div>

i have a mapping like this :  
`

```
 'candidate_cvs' => [
    'properties' => [
'folder_applications' => [
    'type' => 'nested',
    "properties" => [
        "created_at" => [
            "type" => "date"
        ],
        "employer_folder_id" => [
            "type" => "long"
        ],
        "folder" => [
            "type" => "nested",
            "properties" => [
                "employer_id" => [
                   "type" => "long"
                   ],
                   "id" => [
                        "type" => "long"
                    ]
                ]
            ],
            "hire_stage_id" => [
               "type" => "long"
            ],
            "is_applied" => [
                "type" => "long"
            ],
            "status_id" => [
                "type" => "long"
            ]
       ]
    ],
]

```

]  
so i want to search inside my type, using nested query and bool query.. this is the query that i wrote: `

```
"query" => [
        "bool" => [
            "must" => [
                
                "query" => [
                    "nested" => [
                        "path" => "folder_applications",
                        "query" => [
                            "nested" => [
                                "path" => "folder_applications.folder",
                                "query" => [
                                    "match" => ["folder_applications.folder.id" => 7937]
                                ]
                            ],

                            [
                                "match" => ["folder_applications.status_id" => 141]
                            ]
                        ]
                    ]
                ]

            ],
            "must_not" => $this->mustNot,
            "filter" => $this->filter
        ]
    ],

```

`

but its get me error.. i dont know how to combine my queries..  
no [query] registered for [query]

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [May 26, 2017, 8:32am UTC](https://discuss.elastic.co/t/two-step-inner-hits-and-combine-that-with-bool-queries-that-is-not-in-nested-type/86686/2 "2017-05-26T08:32:43Z")

</div>

You don't need the `query` after the `must`.

---

<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 23, 2017, 8:32am UTC](https://discuss.elastic.co/t/two-step-inner-hits-and-combine-that-with-bool-queries-that-is-not-in-nested-type/86686/3 "2017-06-23T08:32:47Z")

</div>

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