# Combine bool with nested query

**URL:** <https://discuss.elastic.co/t/combine-bool-with-nested-query/129445>\
**Category:** Elasticsearch\
**Created:** [April 25, 2018, 9:40am UTC](https://discuss.elastic.co/t/combine-bool-with-nested-query/129445 "2018-04-25T09:40:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)\
**Post date:** [April 25, 2018, 9:40am UTC](https://discuss.elastic.co/t/combine-bool-with-nested-query/129445/1 "2018-04-25T09:40:38Z")

</div>

I am sending the following request:

> ```
> {
> "query": {
> "bool": {
> "must": [{
> "terms": {
> "name": ["test"]
> }
> }, {
> "terms": {
> "tags": ["java", "php"]
> }
> }, {
> "nested ": {
> "path": "fields",
> "query": {
> "bool": {
> "must": [{
> "bool": {
> "must": [{
> "match": {
> "fields.uid": "number_43"
> }
> },
> {
> "match": {
> "fields.value": 612
> }
> }
> ]
> }
> }]
> }
> }
> }
> }]
> }
> 
> },
> "highlight": {
> "pre_tags": ["<b>"],
> "post_tags": ["</b>"],
> "fields": {
> "*": {}
> 
> }
> }
> }
> 
> ```

It is giving me the following result:

> `no [query] registered for [nested]`

Can anyone help me here?  
What is wrong in my query?

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [April 26, 2018, 8:20am UTC](https://discuss.elastic.co/t/combine-bool-with-nested-query/129445/2 "2018-04-26T08:20:13Z")

</div>

There is a space after `nested`. You need to change `"nested "` into `"nested"`.

---

<div class="post-metadata">

**Author:** ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)\
**Post date:** [April 26, 2018, 3:14pm UTC](https://discuss.elastic.co/t/combine-bool-with-nested-query/129445/3 "2018-04-26T15:14:52Z")

</div>

Thanks Abdon

---

<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:** [May 24, 2018, 3:15pm UTC](https://discuss.elastic.co/t/combine-bool-with-nested-query/129445/4 "2018-05-24T15:15:01Z")

</div>

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