# Filtering on one set of nested values while returning inner hits on others

**URL:** <https://discuss.elastic.co/t/filtering-on-one-set-of-nested-values-while-returning-inner-hits-on-others/70858>\
**Category:** Elasticsearch\
**Created:** [January 7, 2017, 5:39pm UTC](https://discuss.elastic.co/t/filtering-on-one-set-of-nested-values-while-returning-inner-hits-on-others/70858 "2017-01-07T17:39:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![derrickburns](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@derrickburns](https://discuss.elastic.co/u/derrickburns)\
**Post date:** [January 7, 2017, 5:39pm UTC](https://discuss.elastic.co/t/filtering-on-one-set-of-nested-values-while-returning-inner-hits-on-others/70858/1 "2017-01-07T17:39:11Z")

</div>

Mapping  
OuterObject contains nested NestedObject.

Data  
OuterObject1 contains NestedObject1, NestedObject2  
OuterObject2 contains NestedObject3, NestedObject4

I would like to filter outer objects based on one criteria (A) on the nested objects and then return the outer object and its nested objects that pass a different second criteria (B).

So, if NestedObject1 passed my criteria A and NestedObject2 passes criteria B then I would return:

OuterObject1, NestedObject2

Suggestions?

---

<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:** [February 4, 2017, 5:39pm UTC](https://discuss.elastic.co/t/filtering-on-one-set-of-nested-values-while-returning-inner-hits-on-others/70858/2 "2017-02-04T17:39:37Z")

</div>

Closed on February 4, 2017, 5:39pm UTC

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