# Nested boolean filters on nested objects

**URL:** https://discuss.elastic.co/t/nested-boolean-filters-on-nested-objects/53976
**Category:** Elasticsearch
**Created:** [June 26, 2016, 5:36pm UTC](https://discuss.elastic.co/t/nested-boolean-filters-on-nested-objects/53976 "2016-06-26T17:36:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Sudhakar\_Reddy](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@Sudhakar\_Reddy](https://discuss.elastic.co/u/Sudhakar_Reddy)
#### Post date: [June 26, 2016, 5:36pm UTC](https://discuss.elastic.co/t/nested-boolean-filters-on-nested-objects/53976/1 "2016-06-26T17:36:28Z")

</div>

Below is question looks like,

![](https://us1.discourse-cdn.com/elastic/original/2X/0/0e2c7a2c90b9a934f0fdca734a9aac1ccbc5c4b2.jpg)

user can select more than one option from each row.  
Below is my mapping for that question

`"q_1153": { "type": "nested", "properties": { "answer_option": { "type": "long" }, "row_id": { "type": "long" } }}`

I'll store the option\_ids in the ES instead of text.

In my Reports, I want to the users who selected "Option 1" OR "Option 2" from Row1 AND "Option 2" from Row2.

In SQL style: WHERE (row\_id='Row1' AND (answer\_option='Option1' OR answer\_option='Option2' )) AND (row\_id='Row2' AND (answer\_option='Option2'))

There is a response with the above criteria. IF I use "OR" operator between the two row options The result was returning. If I use "AND" nothing is returning. How can I solve the this query?

---

<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: [July 5, 2017, 10:40pm UTC](https://discuss.elastic.co/t/nested-boolean-filters-on-nested-objects/53976/2 "2017-07-05T22:40:24Z")

</div>


