# How to perform search on the qualified docs resulted from a query

**URL:** <https://discuss.elastic.co/t/how-to-perform-search-on-the-qualified-docs-resulted-from-a-query/21818>\
**Category:** Elasticsearch\
**Created:** [January 25, 2015, 4:44am UTC](https://discuss.elastic.co/t/how-to-perform-search-on-the-qualified-docs-resulted-from-a-query/21818 "2015-01-25T04:44:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)\
**Post date:** [January 25, 2015, 4:44am UTC](https://discuss.elastic.co/t/how-to-perform-search-on-the-qualified-docs-resulted-from-a-query/21818/1 "2015-01-25T04:44:11Z")

</div>

Hi,

can some one help me on this.

have scenario where have Query1 which qualifies some documents and now I  
want to take \_parent id of qualified documents and search on \_parentid  
field to get the qualified documents and all others documents with same  
parent id

.These two searches I want to do it in one single request , is it possible?

Regards,  
Nagaraju

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 25, 2015, 5:14am UTC](https://discuss.elastic.co/t/how-to-perform-search-on-the-qualified-docs-resulted-from-a-query/21818/2 "2015-01-25T05:14:55Z")

</div>

If you are using Parent / Child feature, you should look at has\_parent, has\_child filters.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

In that case, you don't need to get back parent id yourself.

If you are not using Parent / child, I'm afraid you need to run 2 queries.

My 2 cents

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 25 janv. 2015 à 05:44, bvnrwork [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com) a écrit :
> 
> Hi,
> 
> can some one help me on this.
> 
> have scenario where have Query1 which qualifies some documents and now I want to take \_parent id of qualified documents and search on \_parentid field to get the qualified documents and all others documents with same parent id
> 
> .These two searches I want to do it in one single request , is it possible?
> 
> ## Regards, Nagaraju
> 
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)\
**Post date:** [January 25, 2015, 7:14pm UTC](https://discuss.elastic.co/t/how-to-perform-search-on-the-qualified-docs-resulted-from-a-query/21818/3 "2015-01-25T19:14:39Z")

</div>

I dont get it exactly so explaining doc structure and example docs .I  
understand that HasChild will get you the parent documents and HasParent  
will get the only parents.Please help me in understanding

have two document types :one is FakeDocument which is the fake document  
holding the group id for all docs in a group  
and other is Document which is the actual document

Example Docs are:

FakeDocument{  
Id:"G1"  
}  
FakeDocument{  
Id:"G2"  
}

Indexed two documents under group "G1"

Document1{  
Name:One

}

Document2{  
Name:Two

}

Indexed two documents under group "G2"

Document3{  
Name:Three

}

Document4{  
Name:Four

}

Now my scenario is

querying for "Name:One" should result me document with name :"One" and also  
all other documents that has same \_parentId in one request

Regards  
Nagaraju  
908 517 6981

On Sun, Jan 25, 2015 at 12:14 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> If you are using Parent / Child feature, you should look at has\_parent,  
> has\_child filters.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-has-child-filter.html#query-dsl-has-child-filter)
> 
> In that case, you don't need to get back parent id yourself.
> 
> If you are not using Parent / child, I'm afraid you need to run 2 queries.
> 
> My 2 cents
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 25 janv. 2015 à 05:44, bvnrwork [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com) a écrit :
> 
> Hi,
> 
> can some one help me on this.
> 
> have scenario where have Query1 which qualifies some documents and now I  
> want to take \_parent id of qualified documents and search on \_parentid  
> field to get the qualified documents and all others documents with same  
> parent id
> 
> .These two searches I want to do it in one single request , is it possible?
> 
> Regards,  
> Nagaraju
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/Ye7ICf\_ZUkg/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Ye7ICf_ZUkg/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr)  
> [https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B%2BpREVYLKLPrXdbNAS%3DrY5S%2BBkvkg\_HxE5\_V129CnA%3DQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B%2BpREVYLKLPrXdbNAS%3DrY5S%2BBkvkg_HxE5_V129CnA%3DQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)\
**Post date:** [January 27, 2015, 11:54pm UTC](https://discuss.elastic.co/t/how-to-perform-search-on-the-qualified-docs-resulted-from-a-query/21818/4 "2015-01-27T23:54:40Z")

</div>

Any answers for me :)?

Regards  
Nagaraju  
908 517 6981

On Sun, Jan 25, 2015 at 2:14 PM, buddarapu nagaraju [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com)  
wrote:

> I dont get it exactly so explaining doc structure and example docs .I  
> understand that HasChild will get you the parent documents and HasParent  
> will get the only parents.Please help me in understanding
> 
> have two document types :one is FakeDocument which is the fake document  
> holding the group id for all docs in a group  
> and other is Document which is the actual document
> 
> Example Docs are:
> 
> FakeDocument{  
> Id:"G1"  
> }  
> FakeDocument{  
> Id:"G2"  
> }
> 
> Indexed two documents under group "G1"
> 
> Document1{  
> Name:One
> 
> }
> 
> Document2{  
> Name:Two
> 
> }
> 
> Indexed two documents under group "G2"
> 
> Document3{  
> Name:Three
> 
> }
> 
> Document4{  
> Name:Four
> 
> }
> 
> Now my scenario is
> 
> querying for "Name:One" should result me document with name :"One" and  
> also all other documents that has same \_parentId in one request
> 
> Regards  
> Nagaraju  
> 908 517 6981
> 
> On Sun, Jan 25, 2015 at 12:14 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > If you are using Parent / Child feature, you should look at has\_parent,  
> > has\_child filters.
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-has-child-filter.html#query-dsl-has-child-filter)
> > 
> > In that case, you don't need to get back parent id yourself.
> > 
> > If you are not using Parent / child, I'm afraid you need to run 2 queries.
> > 
> > My 2 cents
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 25 janv. 2015 à 05:44, bvnrwork [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com) a écrit :
> > 
> > Hi,
> > 
> > can some one help me on this.
> > 
> > have scenario where have Query1 which qualifies some documents and now I  
> > want to take \_parent id of qualified documents and search on \_parentid  
> > field to get the qualified documents and all others documents with same  
> > parent id
> > 
> > .These two searches I want to do it in one single request , is it  
> > possible?
> > 
> > Regards,  
> > Nagaraju
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/Ye7ICf\_ZUkg/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Ye7ICf_ZUkg/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr)  
> > [https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B2wEtz7ff-xXa%2BztvC%2B%2Bg-hpKY4s5X0%2BRVAZ8U5d7Puw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B2wEtz7ff-xXa%2BztvC%2B%2Bg-hpKY4s5X0%2BRVAZ8U5d7Puw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 28, 2015, 2:07am UTC](https://discuss.elastic.co/t/how-to-perform-search-on-the-qualified-docs-resulted-from-a-query/21818/5 "2015-01-28T02:07:26Z")

</div>

You need to run 2 queries in that case IMHO.

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 28 janv. 2015 à 00:54, buddarapu nagaraju [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com) a écrit :
> 
> Any answers for me :)?
> 
> Regards  
> Nagaraju  
> 908 517 6981
> 
> > On Sun, Jan 25, 2015 at 2:14 PM, buddarapu nagaraju [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com) wrote:  
> > I dont get it exactly so explaining doc structure and example docs .I understand that HasChild will get you the parent documents and HasParent will get the only parents.Please help me in understanding
> > 
> > have two document types :one is FakeDocument which is the fake document holding the group id for all docs in a group  
> > and other is Document which is the actual document
> > 
> > Example Docs are:
> > 
> > FakeDocument{  
> > Id:"G1"  
> > }  
> > FakeDocument{  
> > Id:"G2"  
> > }
> > 
> > Indexed two documents under group "G1"
> > 
> > Document1{  
> > Name:One
> > 
> > }
> > 
> > Document2{  
> > Name:Two
> > 
> > }
> > 
> > Indexed two documents under group "G2"
> > 
> > Document3{  
> > Name:Three
> > 
> > }
> > 
> > Document4{  
> > Name:Four
> > 
> > }
> > 
> > Now my scenario is
> > 
> > querying for "Name:One" should result me document with name :"One" and also all other documents that has same \_parentId in one request
> > 
> > Regards  
> > Nagaraju  
> > 908 517 6981
> > 
> > > On Sun, Jan 25, 2015 at 12:14 AM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
> > > If you are using Parent / Child feature, you should look at has\_parent, has\_child filters.
> > > 
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-has-child-filter.html#query-dsl-has-child-filter)
> > > 
> > > In that case, you don't need to get back parent id yourself.
> > > 
> > > If you are not using Parent / child, I'm afraid you need to run 2 queries.
> > > 
> > > My 2 cents
> > > 
> > > --  
> > > David 😉  
> > > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > > 
> > > > Le 25 janv. 2015 à 05:44, bvnrwork [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com) a écrit :
> > > > 
> > > > Hi,
> > > > 
> > > > can some one help me on this.
> > > > 
> > > > have scenario where have Query1 which qualifies some documents and now I want to take \_parent id of qualified documents and search on \_parentid field to get the qualified documents and all others documents with same parent id
> > > > 
> > > > .These two searches I want to do it in one single request , is it possible?
> > > > 
> > > > ## Regards, Nagaraju
> > > > 
> > > > You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/Ye7ICf\_ZUkg/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Ye7ICf_ZUkg/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr).
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B2wEtz7ff-xXa%2BztvC%2B%2Bg-hpKY4s5X0%2BRVAZ8U5d7Puw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B2wEtz7ff-xXa%2BztvC%2B%2Bg-hpKY4s5X0%2BRVAZ8U5d7Puw%40mail.gmail.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/70D06388-5173-4225-97A7-9BB78A78A096%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/70D06388-5173-4225-97A7-9BB78A78A096%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)\
**Post date:** [January 28, 2015, 3:29am UTC](https://discuss.elastic.co/t/how-to-perform-search-on-the-qualified-docs-resulted-from-a-query/21818/6 "2015-01-28T03:29:11Z")

</div>

Okay Thank you ,does nested objects help here .

Is it possible to get only inner objects (from nested objects ) ?

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Tuesday, 27 January 2015 21:07:35 UTC-5, David Pilato wrote:

> You need to run 2 queries in that case IMHO.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 28 janv. 2015 à 00:54, buddarapu nagaraju \<[budda...@gmail.com](mailto:budda...@gmail.com)  
> \<javascript:\>\> a écrit :
> 
> Any answers for me :)?
> 
> Regards  
> Nagaraju  
> 908 517 6981
> 
> On Sun, Jan 25, 2015 at 2:14 PM, buddarapu nagaraju \<[budda...@gmail.com](mailto:budda...@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > I dont get it exactly so explaining doc structure and example docs .I  
> > understand that HasChild will get you the parent documents and HasParent  
> > will get the only parents.Please help me in understanding
> > 
> > have two document types :one is FakeDocument which is the fake document  
> > holding the group id for all docs in a group  
> > and other is Document which is the actual document
> > 
> > Example Docs are:
> > 
> > FakeDocument{  
> > Id:"G1"  
> > }  
> > FakeDocument{  
> > Id:"G2"  
> > }
> > 
> > Indexed two documents under group "G1"
> > 
> > Document1{  
> > Name:One
> > 
> > }
> > 
> > Document2{  
> > Name:Two
> > 
> > }
> > 
> > Indexed two documents under group "G2"
> > 
> > Document3{  
> > Name:Three
> > 
> > }
> > 
> > Document4{  
> > Name:Four
> > 
> > }
> > 
> > Now my scenario is
> > 
> > querying for "Name:One" should result me document with name :"One" and  
> > also all other documents that has same \_parentId in one request
> > 
> > Regards  
> > Nagaraju  
> > 908 517 6981
> > 
> > On Sun, Jan 25, 2015 at 12:14 AM, David Pilato \<[da...@pilato.fr](mailto:da...@pilato.fr)  
> > \<javascript:\>\> wrote:
> > 
> > > If you are using Parent / Child feature, you should look at has\_parent,  
> > > has\_child filters.
> > > 
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-has-child-filter.html#query-dsl-has-child-filter)
> > > 
> > > In that case, you don't need to get back parent id yourself.
> > > 
> > > If you are not using Parent / child, I'm afraid you need to run 2  
> > > queries.
> > > 
> > > My 2 cents
> > > 
> > > --  
> > > David 😉  
> > > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > > 
> > > Le 25 janv. 2015 à 05:44, bvnrwork \<[budda...@gmail.com](mailto:budda...@gmail.com) \<javascript:\>\> a  
> > > écrit :
> > > 
> > > Hi,
> > > 
> > > can some one help me on this.
> > > 
> > > have scenario where have Query1 which qualifies some documents and now I  
> > > want to take \_parent id of qualified documents and search on \_parentid  
> > > field to get the qualified documents and all others documents with same  
> > > parent id
> > > 
> > > .These two searches I want to do it in one single request , is it  
> > > possible?
> > > 
> > > Regards,  
> > > Nagaraju
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/Ye7ICf\_ZUkg/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Ye7ICf_ZUkg/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr)  
> > > [https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B2wEtz7ff-xXa%2BztvC%2B%2Bg-hpKY4s5X0%2BRVAZ8U5d7Puw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B2wEtz7ff-xXa%2BztvC%2B%2Bg-hpKY4s5X0%2BRVAZ8U5d7Puw%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B2wEtz7ff-xXa%2BztvC%2B%2Bg-hpKY4s5X0%2BRVAZ8U5d7Puw%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B2wEtz7ff-xXa%2BztvC%2B%2Bg-hpKY4s5X0%2BRVAZ8U5d7Puw%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3146fbf6-63e9-45bf-8593-90dcacf16184%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3146fbf6-63e9-45bf-8593-90dcacf16184%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 28, 2015, 7:29am UTC](https://discuss.elastic.co/t/how-to-perform-search-on-the-qualified-docs-resulted-from-a-query/21818/7 "2015-01-28T07:29:47Z")

</div>

In 1.5, a new inner hits feature will come. [Add inner hits to nested and parent/child queries by martijnvg · Pull Request #8153 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/8153)

David

> Le 28 janv. 2015 à 04:29, bvnrwork [budda08nitt@gmail.com](mailto:budda08nitt@gmail.com) a écrit :
> 
> Okay Thank you ,does nested objects help here .
> 
> Is it possible to get only inner objects (from nested objects ) ?
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/nested-objects.html)
> 
> > On Tuesday, 27 January 2015 21:07:35 UTC-5, David Pilato wrote:  
> > You need to run 2 queries in that case IMHO.
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > > Le 28 janv. 2015 à 00:54, buddarapu nagaraju [budda...@gmail.com](mailto:budda...@gmail.com) a écrit :
> > > 
> > > Any answers for me :)?
> > > 
> > > Regards  
> > > Nagaraju  
> > > 908 517 6981
> > > 
> > > > On Sun, Jan 25, 2015 at 2:14 PM, buddarapu nagaraju [budda...@gmail.com](mailto:budda...@gmail.com) wrote:  
> > > > I dont get it exactly so explaining doc structure and example docs .I understand that HasChild will get you the parent documents and HasParent will get the only parents.Please help me in understanding
> > > > 
> > > > have two document types :one is FakeDocument which is the fake document holding the group id for all docs in a group  
> > > > and other is Document which is the actual document
> > > > 
> > > > Example Docs are:
> > > > 
> > > > FakeDocument{  
> > > > Id:"G1"  
> > > > }  
> > > > FakeDocument{  
> > > > Id:"G2"  
> > > > }
> > > > 
> > > > Indexed two documents under group "G1"
> > > > 
> > > > Document1{  
> > > > Name:One
> > > > 
> > > > }
> > > > 
> > > > Document2{  
> > > > Name:Two
> > > > 
> > > > }
> > > > 
> > > > Indexed two documents under group "G2"
> > > > 
> > > > Document3{  
> > > > Name:Three
> > > > 
> > > > }
> > > > 
> > > > Document4{  
> > > > Name:Four
> > > > 
> > > > }
> > > > 
> > > > Now my scenario is
> > > > 
> > > > querying for "Name:One" should result me document with name :"One" and also all other documents that has same \_parentId in one request
> > > > 
> > > > Regards  
> > > > Nagaraju  
> > > > 908 517 6981
> > > > 
> > > > > On Sun, Jan 25, 2015 at 12:14 AM, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:  
> > > > > If you are using Parent / Child feature, you should look at has\_parent, has\_child filters.
> > > > > 
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-has-child-filter.html#query-dsl-has-child-filter)
> > > > > 
> > > > > In that case, you don't need to get back parent id yourself.
> > > > > 
> > > > > If you are not using Parent / child, I'm afraid you need to run 2 queries.
> > > > > 
> > > > > My 2 cents
> > > > > 
> > > > > --  
> > > > > David 😉  
> > > > > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > > > > 
> > > > > > Le 25 janv. 2015 à 05:44, bvnrwork [budda...@gmail.com](mailto:budda...@gmail.com) a écrit :
> > > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > can some one help me on this.
> > > > > > 
> > > > > > have scenario where have Query1 which qualifies some documents and now I want to take \_parent id of qualified documents and search on \_parentid field to get the qualified documents and all others documents with same parent id
> > > > > > 
> > > > > > .These two searches I want to do it in one single request , is it possible?
> > > > > > 
> > > > > > ## Regards, Nagaraju
> > > > > > 
> > > > > > You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > > To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a1946c82-7239-4e56-a082-ab11e66b4041%40googlegroups.com).  
> > > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/Ye7ICf\_ZUkg/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Ye7ICf_ZUkg/unsubscribe).  
> > > > > To unsubscribe from this group and all its topics, send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > > To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/A4959B00-FB5F-4EAA-9304-5B2BCC490601%40pilato.fr).
> > > > > 
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B2wEtz7ff-xXa%2BztvC%2B%2Bg-hpKY4s5X0%2BRVAZ8U5d7Puw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAFtuXX%2B2wEtz7ff-xXa%2BztvC%2B%2Bg-hpKY4s5X0%2BRVAZ8U5d7Puw%40mail.gmail.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3146fbf6-63e9-45bf-8593-90dcacf16184%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3146fbf6-63e9-45bf-8593-90dcacf16184%40googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/1C12ABD6-8762-46B5-AA2C-5DA249BF61AD%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/1C12ABD6-8762-46B5-AA2C-5DA249BF61AD%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:36am UTC](https://discuss.elastic.co/t/how-to-perform-search-on-the-qualified-docs-resulted-from-a-query/21818/8 "2017-07-06T00:36:15Z")

</div>


