# Searching across parent and child

**URL:** <https://discuss.elastic.co/t/searching-across-parent-and-child/13001>\
**Category:** Elasticsearch\
**Created:** [July 30, 2013, 9:56am UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001 "2013-07-30T09:56:56Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Manoj\_Mohan\_2](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Manoj\_Mohan\_2](https://discuss.elastic.co/u/Manoj_Mohan_2)\
**Post date:** [July 30, 2013, 9:56am UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/1 "2013-07-30T09:56:56Z")

</div>

Hi,

I am working on an application that uses ElasticSearch for providing a  
searching across the application. Now I have a scenario where a Product can  
have many variations depending on it's colors. So a product A available in  
Blue and Green will have 2 Product variations and a Product entity indexed  
into ES. Now each of the product variations will contain some specific  
fields not present in the Product domain. Also I have marked the Product -  
ProductVariation relationship with a parent-child relationship(Product  
being the parent).

Now I have a case of searching for a products using a free text search.  
Since I have different fields in those domains, I would have to search  
across both the domains. What I would essentially like to have is that I  
make a single query to search across a product and it's related child  
ProductVariation to get a match Eg: Blue jeans search should search across  
both where blue is the color present in ProductVariation and Jeans is a  
category in Product. Also I intend to provide filtering/faceting over these  
fields.

How would I do a search and across which domain. I am tried out the  
has\_child and has\_parent queries but am a bit skeptical about the results.

Any help would be greatly appreciated.

Regards  
Manoj Mohan

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Manoj\_Mohan\_2](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Manoj\_Mohan\_2](https://discuss.elastic.co/u/Manoj_Mohan_2)\
**Post date:** [August 6, 2013, 6:59am UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/2 "2013-08-06T06:59:55Z")

</div>

Bumping this thread... really need some solution for this ...

Regards  
Manoj Mohan  
Intelligrape Software

On Tue, Jul 30, 2013 at 3:26 PM, Manoj Mohan [manoj@intelligrape.com](mailto:manoj@intelligrape.com) wrote:

> Hi,
> 
> I am working on an application that uses Elasticsearch for providing a  
> searching across the application. Now I have a scenario where a Product can  
> have many variations depending on it's colors. So a product A available in  
> Blue and Green will have 2 Product variations and a Product entity indexed  
> into ES. Now each of the product variations will contain some specific  
> fields not present in the Product domain. Also I have marked the Product -  
> ProductVariation relationship with a parent-child relationship(Product  
> being the parent).
> 
> Now I have a case of searching for a products using a free text search.  
> Since I have different fields in those domains, I would have to search  
> across both the domains. What I would essentially like to have is that I  
> make a single query to search across a product and it's related child  
> ProductVariation to get a match Eg: Blue jeans search should search across  
> both where blue is the color present in ProductVariation and Jeans is a  
> category in Product. Also I intend to provide filtering/faceting over these  
> fields.
> 
> How would I do a search and across which domain. I am tried out the  
> has\_child and has\_parent queries but am a bit skeptical about the results.
> 
> Any help would be greatly appreciated.
> 
> Regards  
> Manoj Mohan
> 
> --  
> 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/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Damien\_Alexandre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/damien_alexandre/32/21566_2.png) [@Damien\_Alexandre](https://discuss.elastic.co/u/Damien_Alexandre)\
**Post date:** [August 6, 2013, 8:26am UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/3 "2013-08-06T08:26:40Z")

</div>

From my POV: stay away from has\_child and has\_parent query if you need  
facets - that can't work: you will not be able to perform "color" facet if  
the field is not on the product document.

My best guest whould be that the product document should host his  
variations (maybe in a nested object[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)to ease the query against some variation only).

Having everything in the same doc will also ease indexing & update & query  
against everything.

My 2cts 😉  
Damien

On Tuesday, July 30, 2013 11:56:56 AM UTC+2, Manoj Mohan wrote:

> Hi,
> 
> I am working on an application that uses Elasticsearch for providing a  
> searching across the application. Now I have a scenario where a Product can  
> have many variations depending on it's colors. So a product A available in  
> Blue and Green will have 2 Product variations and a Product entity indexed  
> into ES. Now each of the product variations will contain some specific  
> fields not present in the Product domain. Also I have marked the Product -  
> ProductVariation relationship with a parent-child relationship(Product  
> being the parent).
> 
> Now I have a case of searching for a products using a free text search.  
> Since I have different fields in those domains, I would have to search  
> across both the domains. What I would essentially like to have is that I  
> make a single query to search across a product and it's related child  
> ProductVariation to get a match Eg: Blue jeans search should search across  
> both where blue is the color present in ProductVariation and Jeans is a  
> category in Product. Also I intend to provide filtering/faceting over these  
> fields.
> 
> How would I do a search and across which domain. I am tried out the  
> has\_child and has\_parent queries but am a bit skeptical about the results.
> 
> Any help would be greatly appreciated.
> 
> Regards  
> Manoj Mohan

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Manoj\_Mohan\_2](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Manoj\_Mohan\_2](https://discuss.elastic.co/u/Manoj_Mohan_2)\
**Post date:** [August 6, 2013, 9:51am UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/4 "2013-08-06T09:51:33Z")

</div>

Thanks for the reply Damien.

But the problem with nested objects is that there can be a cross match that  
results in a fake result as mentioned in this doc  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/nested-type/).  
So a product having 2 variations -

Price : $50  
Color:Blue

Price: $20  
Color:Black

Here searching for a Blue colored product under $30 would give back the  
product having the above variations, which is a big problem there isn't a  
variation that matches the criteria.

Regards  
Manoj Mohan  
Intelligrape Software

On Tue, Aug 6, 2013 at 1:56 PM, Damien Alexandre [dalexandre@jolicode.com](mailto:dalexandre@jolicode.com)wrote:

> From my POV: stay away from has\_child and has\_parent query if you need  
> facets - that can't work: you will not be able to perform "color" facet if  
> the field is not on the product document.
> 
> My best guest whould be that the product document should host his  
> variations (maybe in a nested object[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)to ease the query against some variation only).
> 
> Having everything in the same doc will also ease indexing & update & query  
> against everything.
> 
> My 2cts 😉  
> Damien
> 
> On Tuesday, July 30, 2013 11:56:56 AM UTC+2, Manoj Mohan wrote:
> 
> > Hi,
> > 
> > I am working on an application that uses Elasticsearch for providing a  
> > searching across the application. Now I have a scenario where a Product can  
> > have many variations depending on it's colors. So a product A available in  
> > Blue and Green will have 2 Product variations and a Product entity indexed  
> > into ES. Now each of the product variations will contain some specific  
> > fields not present in the Product domain. Also I have marked the Product -  
> > ProductVariation relationship with a parent-child relationship(Product  
> > being the parent).
> > 
> > Now I have a case of searching for a products using a free text search.  
> > Since I have different fields in those domains, I would have to search  
> > across both the domains. What I would essentially like to have is that I  
> > make a single query to search across a product and it's related child  
> > ProductVariation to get a match Eg: Blue jeans search should search across  
> > both where blue is the color present in ProductVariation and Jeans is a  
> > category in Product. Also I intend to provide filtering/faceting over these  
> > fields.
> > 
> > How would I do a search and across which domain. I am tried out the  
> > has\_child and has\_parent queries but am a bit skeptical about the results.
> > 
> > Any help would be greatly appreciated.
> > 
> > Regards  
> > Manoj Mohan
> 
> --  
> 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/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Damien\_Alexandre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/damien_alexandre/32/21566_2.png) [@Damien\_Alexandre](https://discuss.elastic.co/u/Damien_Alexandre)\
**Post date:** [August 6, 2013, 9:55am UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/5 "2013-08-06T09:55:14Z")

</div>

On Tuesday, August 6, 2013 11:51:33 AM UTC+2, Manoj Mohan wrote:

> Thanks for the reply Damien.
> 
> But the problem with nested objects is that there can be a cross match  
> that results in a fake result as mentioned in this doc  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/nested-type/).  
> So a product having 2 variations -
> 
> Price : $50  
> Color:Blue
> 
> Price: $20  
> Color:Black
> 
> Here searching for a Blue colored product under $30 would give back the  
> product having the above variations, which is a big problem there isn't a  
> variation that matches the criteria.

This can be avoid using  
NestedQuery: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/)  
(or filter).  
I use them a lot and that works fine for this case.

> Regards  
> Manoj Mohan  
> Intelligrape Software
> 
> On Tue, Aug 6, 2013 at 1:56 PM, Damien Alexandre \<[dalex...@jolicode.com](mailto:dalex...@jolicode.com)\<javascript:\>
> 
> > wrote:
> 
> > From my POV: stay away from has\_child and has\_parent query if you need  
> > facets - that can't work: you will not be able to perform "color" facet if  
> > the field is not on the product document.
> > 
> > My best guest whould be that the product document should host his  
> > variations (maybe in a nested object[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)to ease the query against some variation only).
> > 
> > Having everything in the same doc will also ease indexing & update &  
> > query against everything.
> > 
> > My 2cts 😉  
> > Damien
> > 
> > On Tuesday, July 30, 2013 11:56:56 AM UTC+2, Manoj Mohan wrote:
> > 
> > > Hi,
> > > 
> > > I am working on an application that uses Elasticsearch for providing a  
> > > searching across the application. Now I have a scenario where a Product can  
> > > have many variations depending on it's colors. So a product A available in  
> > > Blue and Green will have 2 Product variations and a Product entity indexed  
> > > into ES. Now each of the product variations will contain some specific  
> > > fields not present in the Product domain. Also I have marked the Product -  
> > > ProductVariation relationship with a parent-child relationship(Product  
> > > being the parent).
> > > 
> > > Now I have a case of searching for a products using a free text search.  
> > > Since I have different fields in those domains, I would have to search  
> > > across both the domains. What I would essentially like to have is that I  
> > > make a single query to search across a product and it's related child  
> > > ProductVariation to get a match Eg: Blue jeans search should search across  
> > > both where blue is the color present in ProductVariation and Jeans is a  
> > > category in Product. Also I intend to provide filtering/faceting over these  
> > > fields.
> > > 
> > > How would I do a search and across which domain. I am tried out the  
> > > has\_child and has\_parent queries but am a bit skeptical about the results.
> > > 
> > > Any help would be greatly appreciated.
> > > 
> > > Regards  
> > > Manoj Mohan
> > 
> > --  
> > 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/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Manoj\_Mohan\_2](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Manoj\_Mohan\_2](https://discuss.elastic.co/u/Manoj_Mohan_2)\
**Post date:** [August 6, 2013, 12:16pm UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/6 "2013-08-06T12:16:34Z")

</div>

Thanks _Damien._  
\*  
\*  
It seems to work now with a _Nested Filter_. I had tried it out earlier  
before asking this question in the Elasticsearch HEAD  
plugin[http://mobz.github.io/elasticsearch-head/](http://mobz.github.io/elasticsearch-head/),  
but it seemed to fail using the GET call. I now tried it out using a POST  
call for which it seems to work. Using the CURL command it works for both  
scenarios.

I then tried out using the _Nested Query_ for which I _can't_ seem to _make  
it work_. Here's a mapping of the index against which I am trying it out..

- mappings: {
  - nested\_author: {
    - properties: {
      - books: {
        - properties: {
          - genre: {
            - type: string  
}

          - name: {
            - type: string  
}

          - publisher: {
            - type: string  
}  
}

        - type: nested  
}

      - name: {
        - type: string  
}  
}  
}  
}

Some test data ...

_curl -XPUT localhost:9200/authors/nested\_author/1 -d'{_  
_"name": "Multi G. Enre",_  
_"books": [_  
_{_

- "name": "Guns and lasers",\*

- "genre": "scifi",\*

- "publisher": "orbit"\*  
_},_  
_{_

- "name": "Dead in the night",\*

- "genre": "thriller",\*

- "publisher": "penguin"\*  
_}_  
_]_  
_}'_

- 
- 

_curl -XPUT localhost:9200/authors/nested\_author/2 -d'{_  
_"name": "Alastair Reynolds",_  
_"books": [_  
_{_

- "name": "Revelation Space",\*
- "genre": "scifi",\*
- "publisher": "penguin"\*  
_}_  
_]_  
_}'_

I made this query to search for records, but it results in a \*  
SearchPhaseExecutionException\*

_curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
_{_

- 

```
       "nested" : {*

```

- 

```
       "path" : "books",*

```

- 

```
       "score_mode" : "avg",*

```

- 

```
       "query" : {*

```

- 

```
           "bool" : {*

```

- 

```
               "must" : [*

```

- 

```
                       {*

```

- 

```
                           "term": {"books.publisher": "orbit"}*

```

- 

```
                       },*

```

- 

```
                       {*

```

- 

```
                           "term": {"books.genre": "thriller"}*

```

- 

```
                       }*

```

- 

```
               ]*

```

- 

```
           }*

```

- 

```
       }*

```

- 

```
   }*

```

- 

```
   }'*

```

- 
- 

Can you spot any issues with the query or the mapping itself for which the  
query might be failing ???

Thanks again.. You have been of great help.

Regards  
Manoj Mohan  
Intelligrape Software

On Tue, Aug 6, 2013 at 3:25 PM, Damien Alexandre [dalexandre@jolicode.com](mailto:dalexandre@jolicode.com)wrote:

> On Tuesday, August 6, 2013 11:51:33 AM UTC+2, Manoj Mohan wrote:
> 
> > Thanks for the reply Damien.
> > 
> > But the problem with nested objects is that there can be a cross match  
> > that results in a fake result as mentioned in this doc  
> > [http://www.elasticsearch](http://www.elasticsearch).\*\*org/guide/reference/mapping/\*\*nested-type/[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)  
> > .  
> > So a product having 2 variations -
> > 
> > Price : $50  
> > Color:Blue
> > 
> > Price: $20  
> > Color:Black
> > 
> > Here searching for a Blue colored product under $30 would give back the  
> > product having the above variations, which is a big problem there isn't a  
> > variation that matches the criteria.
> 
> This can be avoid using NestedQuery:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/) (or  
> filter).  
> I use them a lot and that works fine for this case.
> 
> > Regards  
> > Manoj Mohan  
> > Intelligrape Software
> > 
> > On Tue, Aug 6, 2013 at 1:56 PM, Damien Alexandre [dalex...@jolicode.com](mailto:dalex...@jolicode.com)wrote:
> > 
> > > From my POV: stay away from has\_child and has\_parent query if you need  
> > > facets - that can't work: you will not be able to perform "color" facet if  
> > > the field is not on the product document.
> > > 
> > > My best guest whould be that the product document should host his  
> > > variations (maybe in a nested object[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)to ease the query against some variation only).
> > > 
> > > Having everything in the same doc will also ease indexing & update &  
> > > query against everything.
> > > 
> > > My 2cts 😉  
> > > Damien
> > > 
> > > On Tuesday, July 30, 2013 11:56:56 AM UTC+2, Manoj Mohan wrote:
> > > 
> > > > Hi,
> > > > 
> > > > I am working on an application that uses Elasticsearch for providing a  
> > > > searching across the application. Now I have a scenario where a Product can  
> > > > have many variations depending on it's colors. So a product A available in  
> > > > Blue and Green will have 2 Product variations and a Product entity indexed  
> > > > into ES. Now each of the product variations will contain some specific  
> > > > fields not present in the Product domain. Also I have marked the Product -  
> > > > ProductVariation relationship with a parent-child relationship(Product  
> > > > being the parent).
> > > > 
> > > > Now I have a case of searching for a products using a free text search.  
> > > > Since I have different fields in those domains, I would have to search  
> > > > across both the domains. What I would essentially like to have is that I  
> > > > make a single query to search across a product and it's related child  
> > > > ProductVariation to get a match Eg: Blue jeans search should search across  
> > > > both where blue is the color present in ProductVariation and Jeans is a  
> > > > category in Product. Also I intend to provide filtering/faceting over these  
> > > > fields.
> > > > 
> > > > How would I do a search and across which domain. I am tried out the  
> > > > has\_child and has\_parent queries but am a bit skeptical about the results.
> > > > 
> > > > Any help would be greatly appreciated.
> > > > 
> > > > Regards  
> > > > Manoj Mohan
> > > 
> > > --  
> > > 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/](https://groups.google.com/d/)\*\*  
> > > topic/elasticsearch/Y-\*\*AxvhSyhXU/unsubscribe[https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe)  
> > > .  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > 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/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Manoj\_Mohan\_2](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Manoj\_Mohan\_2](https://discuss.elastic.co/u/Manoj_Mohan_2)\
**Post date:** [August 6, 2013, 12:36pm UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/7 "2013-08-06T12:36:18Z")

</div>

Hey finally figured out the issue.. I hadn't wrapped the query in a "query"  
format .. and it works ..

_curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
_{_

- "query": {\*\* \*
- 

```
"nested" : {*

```

- 

```
       "path" : "books",*

```

- 

```
       "score_mode" : "avg",*

```

- 

```
       "query" : {*

```

- 

```
           "bool" : {*

```

- 

```
               "must" : [*

```

- 

```
                       {*

```

- 

```
                           "term": {"books.publisher": "orbit"}*

```

- 

```
                       },*

```

- 

```
                       {*

```

- 

```
                           "term": {"books.genre": "thriller"}*

```

- 

```
                       }*

```

- 

```
               ]*

```

- 

```
           }*

```

- 

```
       }*

```

- 

```
   }*

```

- 

```
  }*

```

- 

```
   }'*

```

- 
- 
- 
- 

Regards  
Manoj Mohan  
Intelligrape Software

On Tue, Aug 6, 2013 at 5:46 PM, Manoj Mohan [manoj@intelligrape.com](mailto:manoj@intelligrape.com) wrote:

> Thanks _Damien._  
> \*  
> \*  
> It seems to work now with a _Nested Filter_. I had tried it out earlier  
> before asking this question in the Elasticsearch HEAD plugin[http://mobz.github.io/elasticsearch-head/](http://mobz.github.io/elasticsearch-head/),  
> but it seemed to fail using the GET call. I now tried it out using a POST  
> call for which it seems to work. Using the CURL command it works for both  
> scenarios.
> 
> I then tried out using the _Nested Query_ for which I _can't_ seem to _make  
> it work_. Here's a mapping of the index against which I am trying it out..
> 
> - mappings: {
> - nested\_author: {
> - properties: {
> - books: {
> - properties: {
> - genre: {
> - type: string  
> }
> 
> - name: {
> - type: string  
> }
> 
> - publisher: {
> - type: string  
> }  
> }
> 
> - type: nested  
> }
> 
> - name: {
> - type: string  
> }  
> }  
> }  
> }
> 
> Some test data ...
> 
> _curl -XPUT localhost:9200/authors/nested\_author/1 -d'{_  
> _"name": "Multi G. Enre",_  
> _"books": [_  
> _{_
> 
> - "name": "Guns and lasers",\*
> 
> - "genre": "scifi",\*
> 
> - "publisher": "orbit"\*  
> _},_  
> _{_
> 
> - "name": "Dead in the night",\*
> 
> - "genre": "thriller",\*
> 
> - "publisher": "penguin"\*  
> _}_  
> _]_  
> _}'_
> 
> - 
> - 
> 
> _curl -XPUT localhost:9200/authors/nested\_author/2 -d'{_  
> _"name": "Alastair Reynolds",_  
> _"books": [_  
> _{_
> 
> - "name": "Revelation Space",\*
> - "genre": "scifi",\*
> - "publisher": "penguin"\*  
> _}_  
> _]_  
> _}'_
> 
> I made this query to search for records, but it results in a \*  
> SearchPhaseExecutionException\*
> 
> _curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
> _{_
> 
> - 
> 
> ```
> "nested" : {*
> 
> ```
> 
> - 
> 
> ```
> "path" : "books",*
> 
> ```
> 
> - 
> 
> ```
> "score_mode" : "avg",*
> 
> ```
> 
> - 
> 
> ```
> "query" : {*
> 
> ```
> 
> - 
> 
> ```
> "bool" : {*
> 
> ```
> 
> - 
> 
> ```
> "must" : [*
> 
> ```
> 
> - 
> 
> ```
> {*
> 
> ```
> 
> - 
> 
> ```
> "term": {"books.publisher": "orbit"}*
> 
> ```
> 
> - 
> 
> ```
> },*
> 
> ```
> 
> - 
> 
> ```
> {*
> 
> ```
> 
> - 
> 
> ```
> "term": {"books.genre": "thriller"}*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - 
> 
> ```
> ]*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - 
> 
> ```
> }'*
> 
> ```
> 
> - 
> - 
> 
> Can you spot any issues with the query or the mapping itself for which the  
> query might be failing ???
> 
> Thanks again.. You have been of great help.
> 
> Regards  
> Manoj Mohan  
> Intelligrape Software
> 
> On Tue, Aug 6, 2013 at 3:25 PM, Damien Alexandre [dalexandre@jolicode.com](mailto:dalexandre@jolicode.com)wrote:
> 
> > On Tuesday, August 6, 2013 11:51:33 AM UTC+2, Manoj Mohan wrote:
> > 
> > > Thanks for the reply Damien.
> > > 
> > > But the problem with nested objects is that there can be a cross match  
> > > that results in a fake result as mentioned in this doc  
> > > [http://www.elasticsearch](http://www.elasticsearch).\*\*org/guide/reference/mapping/\*\*nested-type/[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)  
> > > .  
> > > So a product having 2 variations -
> > > 
> > > Price : $50  
> > > Color:Blue
> > > 
> > > Price: $20  
> > > Color:Black
> > > 
> > > Here searching for a Blue colored product under $30 would give back the  
> > > product having the above variations, which is a big problem there isn't a  
> > > variation that matches the criteria.
> > 
> > This can be avoid using NestedQuery:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/) (or  
> > filter).  
> > I use them a lot and that works fine for this case.
> > 
> > > Regards  
> > > Manoj Mohan  
> > > Intelligrape Software
> > > 
> > > On Tue, Aug 6, 2013 at 1:56 PM, Damien Alexandre [dalex...@jolicode.com](mailto:dalex...@jolicode.com)wrote:
> > > 
> > > > From my POV: stay away from has\_child and has\_parent query if you need  
> > > > facets - that can't work: you will not be able to perform "color" facet if  
> > > > the field is not on the product document.
> > > > 
> > > > My best guest whould be that the product document should host his  
> > > > variations (maybe in a nested object[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)to ease the query against some variation only).
> > > > 
> > > > Having everything in the same doc will also ease indexing & update &  
> > > > query against everything.
> > > > 
> > > > My 2cts 😉  
> > > > Damien
> > > > 
> > > > On Tuesday, July 30, 2013 11:56:56 AM UTC+2, Manoj Mohan wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > I am working on an application that uses Elasticsearch for providing a  
> > > > > searching across the application. Now I have a scenario where a Product can  
> > > > > have many variations depending on it's colors. So a product A available in  
> > > > > Blue and Green will have 2 Product variations and a Product entity indexed  
> > > > > into ES. Now each of the product variations will contain some specific  
> > > > > fields not present in the Product domain. Also I have marked the Product -  
> > > > > ProductVariation relationship with a parent-child relationship(Product  
> > > > > being the parent).
> > > > > 
> > > > > Now I have a case of searching for a products using a free text  
> > > > > search. Since I have different fields in those domains, I would have to  
> > > > > search across both the domains. What I would essentially like to have is  
> > > > > that I make a single query to search across a product and it's related  
> > > > > child ProductVariation to get a match Eg: Blue jeans search should search  
> > > > > across both where blue is the color present in ProductVariation and Jeans  
> > > > > is a category in Product. Also I intend to provide filtering/faceting over  
> > > > > these fields.
> > > > > 
> > > > > How would I do a search and across which domain. I am tried out the  
> > > > > has\_child and has\_parent queries but am a bit skeptical about the results.
> > > > > 
> > > > > Any help would be greatly appreciated.
> > > > > 
> > > > > Regards  
> > > > > Manoj Mohan
> > > > 
> > > > --  
> > > > 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/](https://groups.google.com/d/)\*\*  
> > > > topic/elasticsearch/Y-\*\*AxvhSyhXU/unsubscribe[https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > > 
> > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > .
> > > 
> > > --  
> > > 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/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Damien\_Alexandre](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/damien_alexandre/32/21566_2.png) [@Damien\_Alexandre](https://discuss.elastic.co/u/Damien_Alexandre)\
**Post date:** [August 6, 2013, 12:50pm UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/8 "2013-08-06T12:50:15Z")

</div>

Haha yes the missing "query" part is a common mistake 🙂

Also, I also  
recommand [https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpbo](https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpbo)  
to write test queries,  
it has autocomplete and validation.

Glad I helped you,  
Damien

On Tuesday, August 6, 2013 2:36:18 PM UTC+2, Manoj Mohan wrote:

> Hey finally figured out the issue.. I hadn't wrapped the query in a  
> "query" format .. and it works ..
> 
> _curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
> _{_
> 
> - "query": {\*\* \*
> - 
> 
> ```
> "nested" : {*
> 
> ```
> 
> - 
> 
> ```
> "path" : "books",*
> 
> ```
> 
> - 
> 
> ```
> "score_mode" : "avg",*
> 
> ```
> 
> - 
> 
> ```
> "query" : {*
> 
> ```
> 
> - 
> 
> ```
> "bool" : {*
> 
> ```
> 
> - 
> 
> ```
> "must" : [*
> 
> ```
> 
> - 
> 
> ```
> {*
> 
> ```
> 
> - 
> 
> ```
> "term": {"books.publisher": "orbit"}*
> 
> ```
> 
> - 
> 
> ```
> },*
> 
> ```
> 
> - 
> 
> ```
> {*
> 
> ```
> 
> - 
> 
> ```
> "term": {"books.genre": "thriller"}*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - 
> 
> ```
> ]*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - 
> 
> ```
> }*
> 
> ```
> 
> - 
> 
> ```
> }'*
> 
> ```
> 
> - 
> - 
> - 
> - 
> 
> Regards  
> Manoj Mohan  
> Intelligrape Software
> 
> On Tue, Aug 6, 2013 at 5:46 PM, Manoj Mohan \<[ma...@intelligrape.com](mailto:ma...@intelligrape.com)\<javascript:\>
> 
> > wrote:
> 
> > Thanks _Damien._  
> > \*  
> > \*  
> > It seems to work now with a _Nested Filter_. I had tried it out earlier  
> > before asking this question in the Elasticsearch HEAD plugin[http://mobz.github.io/elasticsearch-head/](http://mobz.github.io/elasticsearch-head/),  
> > but it seemed to fail using the GET call. I now tried it out using a POST  
> > call for which it seems to work. Using the CURL command it works for both  
> > scenarios.
> > 
> > I then tried out using the _Nested Query_ for which I _can't_ seem to _make  
> > it work_. Here's a mapping of the index against which I am trying it  
> > out..
> > 
> > - mappings: {
> > - nested\_author: {
> > - properties: {
> > - books: {
> > - properties: {
> > - genre: {
> > - type: string  
> > }
> > 
> > - name: {
> > - type: string  
> > }
> > 
> > - publisher: {
> > - type: string  
> > }  
> > }
> > 
> > - type: nested  
> > }
> > 
> > - name: {
> > - type: string  
> > }  
> > }  
> > }  
> > }
> > 
> > Some test data ...
> > 
> > _curl -XPUT localhost:9200/authors/nested\_author/1 -d'{_  
> > _"name": "Multi G. Enre",_  
> > _"books": [_  
> > _{_
> > 
> > - "name": "Guns and lasers",\*
> > 
> > - "genre": "scifi",\*
> > 
> > - "publisher": "orbit"\*  
> > _},_  
> > _{_
> > 
> > - "name": "Dead in the night",\*
> > 
> > - "genre": "thriller",\*
> > 
> > - "publisher": "penguin"\*  
> > _}_  
> > _]_  
> > _}'_
> > 
> > - 
> > - 
> > 
> > _curl -XPUT localhost:9200/authors/nested\_author/2 -d'{_  
> > _"name": "Alastair Reynolds",_  
> > _"books": [_  
> > _{_
> > 
> > - "name": "Revelation Space",\*
> > - "genre": "scifi",\*
> > - "publisher": "penguin"\*  
> > _}_  
> > _]_  
> > _}'_
> > 
> > I made this query to search for records, but it results in a \*  
> > SearchPhaseExecutionException\*
> > 
> > _curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
> > _{_
> > 
> > - 
> > 
> > ```
> > "nested" : {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "path" : "books",*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "score_mode" : "avg",*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "query" : {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "bool" : {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "must" : [*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "term": {"books.publisher": "orbit"}*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > },*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "term": {"books.genre": "thriller"}*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > ]*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }'*
> > 
> > ```
> > 
> > - 
> > - 
> > 
> > Can you spot any issues with the query or the mapping itself for which  
> > the query might be failing ???
> > 
> > Thanks again.. You have been of great help.
> > 
> > Regards  
> > Manoj Mohan  
> > Intelligrape Software
> > 
> > On Tue, Aug 6, 2013 at 3:25 PM, Damien Alexandre \<[dalex...@jolicode.com](mailto:dalex...@jolicode.com)\<javascript:\>
> > 
> > > wrote:
> > 
> > > On Tuesday, August 6, 2013 11:51:33 AM UTC+2, Manoj Mohan wrote:
> > > 
> > > > Thanks for the reply Damien.
> > > > 
> > > > But the problem with nested objects is that there can be a cross match  
> > > > that results in a fake result as mentioned in this doc  
> > > > [http://www.elasticsearch](http://www.elasticsearch).\*\*org/guide/reference/mapping/\*\*nested-type/[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)  
> > > > .  
> > > > So a product having 2 variations -
> > > > 
> > > > Price : $50  
> > > > Color:Blue
> > > > 
> > > > Price: $20  
> > > > Color:Black
> > > > 
> > > > Here searching for a Blue colored product under $30 would give back the  
> > > > product having the above variations, which is a big problem there isn't a  
> > > > variation that matches the criteria.
> > > 
> > > This can be avoid using NestedQuery:  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/)(or filter).  
> > > I use them a lot and that works fine for this case.
> > > 
> > > > Regards  
> > > > Manoj Mohan  
> > > > Intelligrape Software
> > > > 
> > > > On Tue, Aug 6, 2013 at 1:56 PM, Damien Alexandre \<[dalex...@jolicode.com](mailto:dalex...@jolicode.com)
> > > > 
> > > > > wrote:
> > > > 
> > > > > From my POV: stay away from has\_child and has\_parent query if you  
> > > > > need facets - that can't work: you will not be able to perform "color"  
> > > > > facet if the field is not on the product document.
> > > > > 
> > > > > My best guest whould be that the product document should host his  
> > > > > variations (maybe in a nested object[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)to ease the query against some variation only).
> > > > > 
> > > > > Having everything in the same doc will also ease indexing & update &  
> > > > > query against everything.
> > > > > 
> > > > > My 2cts 😉  
> > > > > Damien
> > > > > 
> > > > > On Tuesday, July 30, 2013 11:56:56 AM UTC+2, Manoj Mohan wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > I am working on an application that uses Elasticsearch for providing  
> > > > > > a searching across the application. Now I have a scenario where a Product  
> > > > > > can have many variations depending on it's colors. So a product A available  
> > > > > > in Blue and Green will have 2 Product variations and a Product entity  
> > > > > > indexed into ES. Now each of the product variations will contain some  
> > > > > > specific fields not present in the Product domain. Also I have marked the  
> > > > > > Product - ProductVariation relationship with a parent-child  
> > > > > > relationship(Product being the parent).
> > > > > > 
> > > > > > Now I have a case of searching for a products using a free text  
> > > > > > search. Since I have different fields in those domains, I would have to  
> > > > > > search across both the domains. What I would essentially like to have is  
> > > > > > that I make a single query to search across a product and it's related  
> > > > > > child ProductVariation to get a match Eg: Blue jeans search should search  
> > > > > > across both where blue is the color present in ProductVariation and Jeans  
> > > > > > is a category in Product. Also I intend to provide filtering/faceting over  
> > > > > > these fields.
> > > > > > 
> > > > > > How would I do a search and across which domain. I am tried out the  
> > > > > > has\_child and has\_parent queries but am a bit skeptical about the results.
> > > > > > 
> > > > > > Any help would be greatly appreciated.
> > > > > > 
> > > > > > Regards  
> > > > > > Manoj Mohan
> > > > > 
> > > > > --  
> > > > > 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/](https://groups.google.com/d/)\*\*  
> > > > > topic/elasticsearch/Y-\*\*AxvhSyhXU/unsubscribe[https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > > > 
> > > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > > .
> > > > 
> > > > --  
> > > > 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/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe).  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Manoj\_Mohan\_2](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Manoj\_Mohan\_2](https://discuss.elastic.co/u/Manoj_Mohan_2)\
**Post date:** [August 6, 2013, 3:36pm UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/9 "2013-08-06T15:36:57Z")

</div>

Hey this extension's pretty cool ... the autocomplete alone makes it  
worthwhile..  
Thanks a ton

Regards  
Manoj Mohan  
Intelligrape Software

On Tue, Aug 6, 2013 at 6:20 PM, Damien Alexandre [dalexandre@jolicode.com](mailto:dalexandre@jolicode.com)wrote:

> Haha yes the missing "query" part is a common mistake 🙂
> 
> Also, I also recommand  
> [https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpboto](https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpboto) write test queries,  
> it has autocomplete and validation.
> 
> Glad I helped you,  
> Damien
> 
> On Tuesday, August 6, 2013 2:36:18 PM UTC+2, Manoj Mohan wrote:
> 
> > Hey finally figured out the issue.. I hadn't wrapped the query in a  
> > "query" format .. and it works ..
> > 
> > _curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
> > _{_
> > 
> > - "query": {\*\* \*
> > - 
> > 
> > ```
> > "nested" : {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "path" : "books",*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "score_mode" : "avg",*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "query" : {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "bool" : {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "must" : [*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "term": {"books.publisher": "orbit"}*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > },*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > "term": {"books.genre": "thriller"}*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > ]*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }'*
> > 
> > ```
> > 
> > - 
> > - 
> > - 
> > - 
> > 
> > Regards  
> > Manoj Mohan  
> > Intelligrape Software
> > 
> > On Tue, Aug 6, 2013 at 5:46 PM, Manoj Mohan [ma...@intelligrape.com](mailto:ma...@intelligrape.com)wrote:
> > 
> > > Thanks _Damien._  
> > > \*  
> > > \*  
> > > It seems to work now with a _Nested Filter_. I had tried it out earlier  
> > > before asking this question in the Elasticsearch HEAD plugin[http://mobz.github.io/elasticsearch-head/](http://mobz.github.io/elasticsearch-head/),  
> > > but it seemed to fail using the GET call. I now tried it out using a POST  
> > > call for which it seems to work. Using the CURL command it works for both  
> > > scenarios.
> > > 
> > > I then tried out using the _Nested Query_ for which I _can't_ seem to _make  
> > > it work_. Here's a mapping of the index against which I am trying it  
> > > out..
> > > 
> > > - mappings: {
> > > - nested\_author: {
> > > - properties: {
> > > - books: {
> > > - properties: {
> > > - genre: {
> > > - type: string  
> > > }
> > > 
> > > - name: {
> > > - type: string  
> > > }
> > > 
> > > - publisher: {
> > > - type: string  
> > > }  
> > > }
> > > 
> > > - type: nested  
> > > }
> > > 
> > > - name: {
> > > - type: string  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > Some test data ...
> > > 
> > > _curl -XPUT localhost:9200/authors/nested\_author/1 -d'{_  
> > > _"name": "Multi G. Enre",_  
> > > _"books": [_  
> > > _{_
> > > 
> > > - "name": "Guns and lasers",\*
> > > 
> > > - "genre": "scifi",\*
> > > 
> > > - "publisher": "orbit"\*  
> > > _},_  
> > > _{_
> > > 
> > > - "name": "Dead in the night",\*
> > > 
> > > - "genre": "thriller",\*
> > > 
> > > - "publisher": "penguin"\*  
> > > _}_  
> > > _]_  
> > > _}'_
> > > 
> > > - 
> > > - 
> > > 
> > > _curl -XPUT localhost:9200/authors/nested\_author/2 -d'{_  
> > > _"name": "Alastair Reynolds",_  
> > > _"books": [_  
> > > _{_
> > > 
> > > - "name": "Revelation Space",\*
> > > - "genre": "scifi",\*
> > > - "publisher": "penguin"\*  
> > > _}_  
> > > _]_  
> > > _}'_
> > > 
> > > I made this query to search for records, but it results in a \*  
> > > SearchPhaseExecutionException\*
> > > 
> > > _curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
> > > _{_
> > > 
> > > - 
> > > 
> > > ```
> > > "nested" : {*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "path" : "books",*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "score_mode" : "avg",*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "query" : {*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "bool" : {*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "must" : [*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > {*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "term": {"books.publisher": "orbit"}*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > },*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > {*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "term": {"books.genre": "thriller"}*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > ]*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }'*
> > > 
> > > ```
> > > 
> > > - 
> > > - 
> > > 
> > > Can you spot any issues with the query or the mapping itself for which  
> > > the query might be failing ???
> > > 
> > > Thanks again.. You have been of great help.
> > > 
> > > Regards  
> > > Manoj Mohan  
> > > Intelligrape Software
> > > 
> > > On Tue, Aug 6, 2013 at 3:25 PM, Damien Alexandre [dalex...@jolicode.com](mailto:dalex...@jolicode.com)wrote:
> > > 
> > > > On Tuesday, August 6, 2013 11:51:33 AM UTC+2, Manoj Mohan wrote:
> > > > 
> > > > > Thanks for the reply Damien.
> > > > > 
> > > > > But the problem with nested objects is that there can be a cross match  
> > > > > that results in a fake result as mentioned in this doc  
> > > > > [http://www.elasticsearch](http://www.elasticsearch). **o** rg/guide/reference/mapping/ **nes**  
> > > > > ted-type/[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)  
> > > > > .  
> > > > > So a product having 2 variations -
> > > > > 
> > > > > Price : $50  
> > > > > Color:Blue
> > > > > 
> > > > > Price: $20  
> > > > > Color:Black
> > > > > 
> > > > > Here searching for a Blue colored product under $30 would give back  
> > > > > the product having the above variations, which is a big problem there isn't  
> > > > > a variation that matches the criteria.
> > > > 
> > > > This can be avoid using NestedQuery: [http://www](http://www).\*\*  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://elasticsearch.org/guide/ **reference/query-dsl/nested-** query/)[http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/](http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/)(or filter).  
> > > > I use them a lot and that works fine for this case.
> > > > 
> > > > > Regards  
> > > > > Manoj Mohan  
> > > > > Intelligrape Software
> > > > > 
> > > > > On Tue, Aug 6, 2013 at 1:56 PM, Damien Alexandre \<  
> > > > > [dalex...@jolicode.com](mailto:dalex...@jolicode.com)\> wrote:
> > > > > 
> > > > > > From my POV: stay away from has\_child and has\_parent query if you  
> > > > > > need facets - that can't work: you will not be able to perform "color"  
> > > > > > facet if the field is not on the product document.
> > > > > > 
> > > > > > My best guest whould be that the product document should host his  
> > > > > > variations (maybe in a nested object[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)to ease the query against some variation only).
> > > > > > 
> > > > > > Having everything in the same doc will also ease indexing & update &  
> > > > > > query against everything.
> > > > > > 
> > > > > > My 2cts 😉  
> > > > > > Damien
> > > > > > 
> > > > > > On Tuesday, July 30, 2013 11:56:56 AM UTC+2, Manoj Mohan wrote:
> > > > > > 
> > > > > > > Hi,
> > > > > > > 
> > > > > > > I am working on an application that uses Elasticsearch for providing  
> > > > > > > a searching across the application. Now I have a scenario where a Product  
> > > > > > > can have many variations depending on it's colors. So a product A available  
> > > > > > > in Blue and Green will have 2 Product variations and a Product entity  
> > > > > > > indexed into ES. Now each of the product variations will contain some  
> > > > > > > specific fields not present in the Product domain. Also I have marked the  
> > > > > > > Product - ProductVariation relationship with a parent-child  
> > > > > > > relationship(Product being the parent).
> > > > > > > 
> > > > > > > Now I have a case of searching for a products using a free text  
> > > > > > > search. Since I have different fields in those domains, I would have to  
> > > > > > > search across both the domains. What I would essentially like to have is  
> > > > > > > that I make a single query to search across a product and it's related  
> > > > > > > child ProductVariation to get a match Eg: Blue jeans search should search  
> > > > > > > across both where blue is the color present in ProductVariation and Jeans  
> > > > > > > is a category in Product. Also I intend to provide filtering/faceting over  
> > > > > > > these fields.
> > > > > > > 
> > > > > > > How would I do a search and across which domain. I am tried out the  
> > > > > > > has\_child and has\_parent queries but am a bit skeptical about the results.
> > > > > > > 
> > > > > > > Any help would be greatly appreciated.
> > > > > > > 
> > > > > > > Regards  
> > > > > > > Manoj Mohan
> > > > > > 
> > > > > > --  
> > > > > > 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/](https://groups.google.com/d/)\*\*  
> > > > > > to\*\*pic/elasticsearch/Y-\*\*AxvhSyhXU/\*\*unsubscribe[https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > elasticsearc...@\*\*googlegroups.\*\*com.
> > > > > > 
> > > > > > For more options, visit [https://groups.google.com/\*\*grou\*\*ps/opt\_out](https://groups.google.com/ **grou** ps/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > > > .
> > > > > 
> > > > > --  
> > > > > 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/](https://groups.google.com/d/)\*\*  
> > > > > topic/elasticsearch/Y-\*\*AxvhSyhXU/unsubscribe[https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).  
> > > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > > .
> > 
> > --  
> > 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/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to  
> > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Manoj\_Mohan\_2](https://avatars.discourse-cdn.com/v4/letter/m/e9a140/32.png) [@Manoj\_Mohan\_2](https://discuss.elastic.co/u/Manoj_Mohan_2)\
**Post date:** [August 7, 2013, 9:32am UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/10 "2013-08-07T09:32:10Z")

</div>

In continuation of this scenario ... it seems that when I get a match over  
a document, I would not be able to ascertain which nested documents matched  
the original query. I thought the Highlighting API might help out here ..  
but it seems that highlighting is not possible with a nested query over  
nested objects. Is it so ??  
Is there any other way out here ... ??

On the other hand in a Parent-Child scenario, if I query on the Child  
domain to get child documents, is it possible to get a list of child  
documents pertaining to 'n' no of parent documents.  
Eg: If I query of a ProductVariation , is it possible to get those  
ProductVariations which are children of 10 Product documents. This is  
important in the case of pagination for us.

Regards  
Manoj Mohan  
Intelligrape Software

On Tue, Aug 6, 2013 at 9:06 PM, Manoj Mohan [manoj@intelligrape.com](mailto:manoj@intelligrape.com) wrote:

> Hey this extension's pretty cool ... the autocomplete alone makes it  
> worthwhile..  
> Thanks a ton
> 
> Regards  
> Manoj Mohan  
> Intelligrape Software
> 
> On Tue, Aug 6, 2013 at 6:20 PM, Damien Alexandre [dalexandre@jolicode.com](mailto:dalexandre@jolicode.com)wrote:
> 
> > Haha yes the missing "query" part is a common mistake 🙂
> > 
> > Also, I also recommand  
> > [https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpboto](https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpboto) write test queries,  
> > it has autocomplete and validation.
> > 
> > Glad I helped you,  
> > Damien
> > 
> > On Tuesday, August 6, 2013 2:36:18 PM UTC+2, Manoj Mohan wrote:
> > 
> > > Hey finally figured out the issue.. I hadn't wrapped the query in a  
> > > "query" format .. and it works ..
> > > 
> > > _curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
> > > _{_
> > > 
> > > - "query": {\*\* \*
> > > - 
> > > 
> > > ```
> > > "nested" : {*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "path" : "books",*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "score_mode" : "avg",*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "query" : {*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "bool" : {*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "must" : [*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > {*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "term": {"books.publisher": "orbit"}*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > },*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > {*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > "term": {"books.genre": "thriller"}*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > ]*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }*
> > > 
> > > ```
> > > 
> > > - 
> > > 
> > > ```
> > > }'*
> > > 
> > > ```
> > > 
> > > - 
> > > - 
> > > - 
> > > - 
> > > 
> > > Regards  
> > > Manoj Mohan  
> > > Intelligrape Software
> > > 
> > > On Tue, Aug 6, 2013 at 5:46 PM, Manoj Mohan [ma...@intelligrape.com](mailto:ma...@intelligrape.com)wrote:
> > > 
> > > > Thanks _Damien._  
> > > > \*  
> > > > \*  
> > > > It seems to work now with a _Nested Filter_. I had tried it out  
> > > > earlier before asking this question in the Elasticsearch HEAD plugin[http://mobz.github.io/elasticsearch-head/](http://mobz.github.io/elasticsearch-head/),  
> > > > but it seemed to fail using the GET call. I now tried it out using a POST  
> > > > call for which it seems to work. Using the CURL command it works for both  
> > > > scenarios.
> > > > 
> > > > I then tried out using the _Nested Query_ for which I _can't_ seem to _make  
> > > > it work_. Here's a mapping of the index against which I am trying it  
> > > > out..
> > > > 
> > > > - mappings: {
> > > > - nested\_author: {
> > > > - properties: {
> > > > - books: {
> > > > - properties: {
> > > > - genre: {
> > > > - type: string  
> > > > }
> > > > 
> > > > - name: {
> > > > - type: string  
> > > > }
> > > > 
> > > > - publisher: {
> > > > - type: string  
> > > > }  
> > > > }
> > > > 
> > > > - type: nested  
> > > > }
> > > > 
> > > > - name: {
> > > > - type: string  
> > > > }  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > Some test data ...
> > > > 
> > > > _curl -XPUT localhost:9200/authors/nested\_author/1 -d'{_  
> > > > _"name": "Multi G. Enre",_  
> > > > _"books": [_  
> > > > _{_
> > > > 
> > > > - "name": "Guns and lasers",\*
> > > > 
> > > > - "genre": "scifi",\*
> > > > 
> > > > - "publisher": "orbit"\*  
> > > > _},_  
> > > > _{_
> > > > 
> > > > - "name": "Dead in the night",\*
> > > > 
> > > > - "genre": "thriller",\*
> > > > 
> > > > - "publisher": "penguin"\*  
> > > > _}_  
> > > > _]_  
> > > > _}'_
> > > > 
> > > > - 
> > > > - 
> > > > 
> > > > _curl -XPUT localhost:9200/authors/nested\_author/2 -d'{_  
> > > > _"name": "Alastair Reynolds",_  
> > > > _"books": [_  
> > > > _{_
> > > > 
> > > > - "name": "Revelation Space",\*
> > > > - "genre": "scifi",\*
> > > > - "publisher": "penguin"\*  
> > > > _}_  
> > > > _]_  
> > > > _}'_
> > > > 
> > > > I made this query to search for records, but it results in a \*  
> > > > SearchPhaseExecutionException\*
> > > > 
> > > > _curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
> > > > _{_
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "nested" : {*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "path" : "books",*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "score_mode" : "avg",*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "query" : {*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "bool" : {*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "must" : [*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > {*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "term": {"books.publisher": "orbit"}*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > },*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > {*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "term": {"books.genre": "thriller"}*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > ]*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }'*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > - 
> > > > 
> > > > Can you spot any issues with the query or the mapping itself for which  
> > > > the query might be failing ???
> > > > 
> > > > Thanks again.. You have been of great help.
> > > > 
> > > > Regards  
> > > > Manoj Mohan  
> > > > Intelligrape Software
> > > > 
> > > > On Tue, Aug 6, 2013 at 3:25 PM, Damien Alexandre \<[dalex...@jolicode.com](mailto:dalex...@jolicode.com)
> > > > 
> > > > > wrote:
> > > > 
> > > > > On Tuesday, August 6, 2013 11:51:33 AM UTC+2, Manoj Mohan wrote:
> > > > > 
> > > > > > Thanks for the reply Damien.
> > > > > > 
> > > > > > But the problem with nested objects is that there can be a cross  
> > > > > > match that results in a fake result as mentioned in this doc  
> > > > > > [http://www.elasticsearch](http://www.elasticsearch). **o** rg/guide/reference/mapping/ **nes**  
> > > > > > ted-type/[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)  
> > > > > > .  
> > > > > > So a product having 2 variations -
> > > > > > 
> > > > > > Price : $50  
> > > > > > Color:Blue
> > > > > > 
> > > > > > Price: $20  
> > > > > > Color:Black
> > > > > > 
> > > > > > Here searching for a Blue colored product under $30 would give back  
> > > > > > the product having the above variations, which is a big problem there isn't  
> > > > > > a variation that matches the criteria.
> > > > > 
> > > > > This can be avoid using NestedQuery: [http://www](http://www).\*\*  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://elasticsearch.org/guide/ **reference/query-dsl/nested-** query/)[http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/](http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/)(or filter).  
> > > > > I use them a lot and that works fine for this case.
> > > > > 
> > > > > > Regards  
> > > > > > Manoj Mohan  
> > > > > > Intelligrape Software
> > > > > > 
> > > > > > On Tue, Aug 6, 2013 at 1:56 PM, Damien Alexandre \<  
> > > > > > [dalex...@jolicode.com](mailto:dalex...@jolicode.com)\> wrote:
> > > > > > 
> > > > > > > From my POV: stay away from has\_child and has\_parent query if you  
> > > > > > > need facets - that can't work: you will not be able to perform "color"  
> > > > > > > facet if the field is not on the product document.
> > > > > > > 
> > > > > > > My best guest whould be that the product document should host his  
> > > > > > > variations (maybe in a nested object[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)to ease the query against some variation only).
> > > > > > > 
> > > > > > > Having everything in the same doc will also ease indexing & update &  
> > > > > > > query against everything.
> > > > > > > 
> > > > > > > My 2cts 😉  
> > > > > > > Damien
> > > > > > > 
> > > > > > > On Tuesday, July 30, 2013 11:56:56 AM UTC+2, Manoj Mohan wrote:
> > > > > > > 
> > > > > > > > Hi,
> > > > > > > > 
> > > > > > > > I am working on an application that uses Elasticsearch for  
> > > > > > > > providing a searching across the application. Now I have a scenario where a  
> > > > > > > > Product can have many variations depending on it's colors. So a product A  
> > > > > > > > available in Blue and Green will have 2 Product variations and a Product  
> > > > > > > > entity indexed into ES. Now each of the product variations will contain  
> > > > > > > > some specific fields not present in the Product domain. Also I have marked  
> > > > > > > > the Product - ProductVariation relationship with a parent-child  
> > > > > > > > relationship(Product being the parent).
> > > > > > > > 
> > > > > > > > Now I have a case of searching for a products using a free text  
> > > > > > > > search. Since I have different fields in those domains, I would have to  
> > > > > > > > search across both the domains. What I would essentially like to have is  
> > > > > > > > that I make a single query to search across a product and it's related  
> > > > > > > > child ProductVariation to get a match Eg: Blue jeans search should search  
> > > > > > > > across both where blue is the color present in ProductVariation and Jeans  
> > > > > > > > is a category in Product. Also I intend to provide filtering/faceting over  
> > > > > > > > these fields.
> > > > > > > > 
> > > > > > > > How would I do a search and across which domain. I am tried out the  
> > > > > > > > has\_child and has\_parent queries but am a bit skeptical about the results.
> > > > > > > > 
> > > > > > > > Any help would be greatly appreciated.
> > > > > > > > 
> > > > > > > > Regards  
> > > > > > > > Manoj Mohan
> > > > > > > 
> > > > > > > --  
> > > > > > > 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/](https://groups.google.com/d/)\*\*  
> > > > > > > to\*\*pic/elasticsearch/Y-\*\*AxvhSyhXU/\*\*unsubscribe[https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe)  
> > > > > > > .  
> > > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > > elasticsearc...@\*\*googlegroups.\*\*com.
> > > > > > > 
> > > > > > > For more options, visit [https://groups.google.com/\*\*grou\*\*ps/opt\_out](https://groups.google.com/ **grou** ps/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > > > > .
> > > > > > 
> > > > > > --  
> > > > > > 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/](https://groups.google.com/d/)\*\*  
> > > > > > topic/elasticsearch/Y-\*\*AxvhSyhXU/unsubscribe[https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).  
> > > > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > > > .
> > > 
> > > --  
> > > 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/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![wvdklee](https://avatars.discourse-cdn.com/v4/letter/w/a88e4f/32.png) [@wvdklee](https://discuss.elastic.co/u/wvdklee)\
**Post date:** [August 7, 2013, 10:11am UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/11 "2013-08-07T10:11:47Z")

</div>

Yes, I have similar issues and so would would be interested in an answer to  
these points

On Wednesday, 7 August 2013 10:32:10 UTC+1, Manoj Mohan wrote:

> In continuation of this scenario ... it seems that when I get a match over  
> a document, I would not be able to ascertain which nested documents matched  
> the original query. I thought the Highlighting API might help out here ..  
> but it seems that highlighting is not possible with a nested query over  
> nested objects. Is it so ??  
> Is there any other way out here ... ??
> 
> On the other hand in a Parent-Child scenario, if I query on the Child  
> domain to get child documents, is it possible to get a list of child  
> documents pertaining to 'n' no of parent documents.  
> Eg: If I query of a ProductVariation , is it possible to get those  
> ProductVariations which are children of 10 Product documents. This is  
> important in the case of pagination for us.
> 
> Regards  
> Manoj Mohan  
> Intelligrape Software
> 
> On Tue, Aug 6, 2013 at 9:06 PM, Manoj Mohan \<[ma...@intelligrape.com](mailto:ma...@intelligrape.com)\<javascript:\>
> 
> > wrote:
> 
> > Hey this extension's pretty cool ... the autocomplete alone makes it  
> > worthwhile..  
> > Thanks a ton
> > 
> > Regards  
> > Manoj Mohan  
> > Intelligrape Software
> > 
> > On Tue, Aug 6, 2013 at 6:20 PM, Damien Alexandre \<[dalex...@jolicode.com](mailto:dalex...@jolicode.com)\<javascript:\>
> > 
> > > wrote:
> > 
> > > Haha yes the missing "query" part is a common mistake 🙂
> > > 
> > > Also, I also recommand  
> > > [https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpboto](https://chrome.google.com/webstore/detail/sense/doinijnbnggojdlcjifpdckfokbbfpboto) write test queries,  
> > > it has autocomplete and validation.
> > > 
> > > Glad I helped you,  
> > > Damien
> > > 
> > > On Tuesday, August 6, 2013 2:36:18 PM UTC+2, Manoj Mohan wrote:
> > > 
> > > > Hey finally figured out the issue.. I hadn't wrapped the query in a  
> > > > "query" format .. and it works ..
> > > > 
> > > > _curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
> > > > _{_
> > > > 
> > > > - "query": {\*\* \*
> > > > - 
> > > > 
> > > > ```
> > > > "nested" : {*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "path" : "books",*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "score_mode" : "avg",*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "query" : {*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "bool" : {*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "must" : [*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > {*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "term": {"books.publisher": "orbit"}*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > },*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > {*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > "term": {"books.genre": "thriller"}*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > ]*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > 
> > > > ```
> > > > }'*
> > > > 
> > > > ```
> > > > 
> > > > - 
> > > > - 
> > > > - 
> > > > - 
> > > > 
> > > > Regards  
> > > > Manoj Mohan  
> > > > Intelligrape Software
> > > > 
> > > > On Tue, Aug 6, 2013 at 5:46 PM, Manoj Mohan [ma...@intelligrape.com](mailto:ma...@intelligrape.com)wrote:
> > > > 
> > > > > Thanks _Damien._  
> > > > > \*  
> > > > > \*  
> > > > > It seems to work now with a _Nested Filter_. I had tried it out  
> > > > > earlier before asking this question in the Elasticsearch HEAD plugin[http://mobz.github.io/elasticsearch-head/](http://mobz.github.io/elasticsearch-head/),  
> > > > > but it seemed to fail using the GET call. I now tried it out using a POST  
> > > > > call for which it seems to work. Using the CURL command it works for both  
> > > > > scenarios.
> > > > > 
> > > > > I then tried out using the _Nested Query_ for which I _can't_ seem to  
> > > > > _make it work_. Here's a mapping of the index against which I am  
> > > > > trying it out..
> > > > > 
> > > > > - mappings: {
> > > > > - nested\_author: {
> > > > > - properties: {
> > > > > - books: {
> > > > > - properties: {
> > > > > - genre: {
> > > > > - type: string  
> > > > > }
> > > > > 
> > > > > - name: {
> > > > > - type: string  
> > > > > }
> > > > > 
> > > > > - publisher: {
> > > > > - type: string  
> > > > > }  
> > > > > }
> > > > > 
> > > > > - type: nested  
> > > > > }
> > > > > 
> > > > > - name: {
> > > > > - type: string  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }
> > > > > 
> > > > > Some test data ...
> > > > > 
> > > > > _curl -XPUT localhost:9200/authors/nested\_author/1 -d'{_  
> > > > > _"name": "Multi G. Enre",_  
> > > > > _"books": [_  
> > > > > _{_
> > > > > 
> > > > > - "name": "Guns and lasers",\*
> > > > > 
> > > > > - "genre": "scifi",\*
> > > > > 
> > > > > - "publisher": "orbit"\*  
> > > > > _},_  
> > > > > _{_
> > > > > 
> > > > > - "name": "Dead in the night",\*
> > > > > 
> > > > > - "genre": "thriller",\*
> > > > > 
> > > > > - "publisher": "penguin"\*  
> > > > > _}_  
> > > > > _]_  
> > > > > _}'_
> > > > > 
> > > > > - 
> > > > > - 
> > > > > 
> > > > > _curl -XPUT localhost:9200/authors/nested\_author/2 -d'{_  
> > > > > _"name": "Alastair Reynolds",_  
> > > > > _"books": [_  
> > > > > _{_
> > > > > 
> > > > > - "name": "Revelation Space",\*
> > > > > - "genre": "scifi",\*
> > > > > - "publisher": "penguin"\*  
> > > > > _}_  
> > > > > _]_  
> > > > > _}'_
> > > > > 
> > > > > I made this query to search for records, but it results in a \*  
> > > > > SearchPhaseExecutionException\*
> > > > > 
> > > > > _curl -XPOST localhost:9200/authors/nested\_author/\_search -d '_  
> > > > > _{_
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > "nested" : {*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > "path" : "books",*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > "score_mode" : "avg",*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > "query" : {*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > "bool" : {*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > "must" : [*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > {*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > "term": {"books.publisher": "orbit"}*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > },*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > {*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > "term": {"books.genre": "thriller"}*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > }*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > ]*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > }*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > }*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > }*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > 
> > > > > ```
> > > > > }'*
> > > > > 
> > > > > ```
> > > > > 
> > > > > - 
> > > > > - 
> > > > > 
> > > > > Can you spot any issues with the query or the mapping itself for which  
> > > > > the query might be failing ???
> > > > > 
> > > > > Thanks again.. You have been of great help.
> > > > > 
> > > > > Regards  
> > > > > Manoj Mohan  
> > > > > Intelligrape Software
> > > > > 
> > > > > On Tue, Aug 6, 2013 at 3:25 PM, Damien Alexandre \<  
> > > > > [dalex...@jolicode.com](mailto:dalex...@jolicode.com)\> wrote:
> > > > > 
> > > > > > On Tuesday, August 6, 2013 11:51:33 AM UTC+2, Manoj Mohan wrote:
> > > > > > 
> > > > > > > Thanks for the reply Damien.
> > > > > > > 
> > > > > > > But the problem with nested objects is that there can be a cross  
> > > > > > > match that results in a fake result as mentioned in this doc  
> > > > > > > [http://www.elasticsearch](http://www.elasticsearch). **o** rg/guide/reference/mapping/ **nes**  
> > > > > > > ted-type/[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)  
> > > > > > > .  
> > > > > > > So a product having 2 variations -
> > > > > > > 
> > > > > > > Price : $50  
> > > > > > > Color:Blue
> > > > > > > 
> > > > > > > Price: $20  
> > > > > > > Color:Black
> > > > > > > 
> > > > > > > Here searching for a Blue colored product under $30 would give back  
> > > > > > > the product having the above variations, which is a big problem there isn't  
> > > > > > > a variation that matches the criteria.
> > > > > > 
> > > > > > This can be avoid using NestedQuery: [http://www](http://www).\*\*  
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://elasticsearch.org/guide/ **reference/query-dsl/nested-** query/)[http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/](http://www.elasticsearch.org/guide/reference/query-dsl/nested-query/)(or filter).  
> > > > > > I use them a lot and that works fine for this case.
> > > > > > 
> > > > > > > Regards  
> > > > > > > Manoj Mohan  
> > > > > > > Intelligrape Software
> > > > > > > 
> > > > > > > On Tue, Aug 6, 2013 at 1:56 PM, Damien Alexandre \<  
> > > > > > > [dalex...@jolicode.com](mailto:dalex...@jolicode.com)\> wrote:
> > > > > > > 
> > > > > > > > From my POV: stay away from has\_child and has\_parent query if you  
> > > > > > > > need facets - that can't work: you will not be able to perform "color"  
> > > > > > > > facet if the field is not on the product document.
> > > > > > > > 
> > > > > > > > My best guest whould be that the product document should host his  
> > > > > > > > variations (maybe in a nested object[http://www.elasticsearch.org/guide/reference/mapping/nested-type/](http://www.elasticsearch.org/guide/reference/mapping/nested-type/)to ease the query against some variation only).
> > > > > > > > 
> > > > > > > > Having everything in the same doc will also ease indexing & update  
> > > > > > > > & query against everything.
> > > > > > > > 
> > > > > > > > My 2cts 😉  
> > > > > > > > Damien
> > > > > > > > 
> > > > > > > > On Tuesday, July 30, 2013 11:56:56 AM UTC+2, Manoj Mohan wrote:
> > > > > > > > 
> > > > > > > > > Hi,
> > > > > > > > > 
> > > > > > > > > I am working on an application that uses Elasticsearch for  
> > > > > > > > > providing a searching across the application. Now I have a scenario where a  
> > > > > > > > > Product can have many variations depending on it's colors. So a product A  
> > > > > > > > > available in Blue and Green will have 2 Product variations and a Product  
> > > > > > > > > entity indexed into ES. Now each of the product variations will contain  
> > > > > > > > > some specific fields not present in the Product domain. Also I have marked  
> > > > > > > > > the Product - ProductVariation relationship with a parent-child  
> > > > > > > > > relationship(Product being the parent).
> > > > > > > > > 
> > > > > > > > > Now I have a case of searching for a products using a free text  
> > > > > > > > > search. Since I have different fields in those domains, I would have to  
> > > > > > > > > search across both the domains. What I would essentially like to have is  
> > > > > > > > > that I make a single query to search across a product and it's related  
> > > > > > > > > child ProductVariation to get a match Eg: Blue jeans search should search  
> > > > > > > > > across both where blue is the color present in ProductVariation and Jeans  
> > > > > > > > > is a category in Product. Also I intend to provide filtering/faceting over  
> > > > > > > > > these fields.
> > > > > > > > > 
> > > > > > > > > How would I do a search and across which domain. I am tried out  
> > > > > > > > > the has\_child and has\_parent queries but am a bit skeptical about the  
> > > > > > > > > results.
> > > > > > > > > 
> > > > > > > > > Any help would be greatly appreciated.
> > > > > > > > > 
> > > > > > > > > Regards  
> > > > > > > > > Manoj Mohan
> > > > > > > > 
> > > > > > > > --  
> > > > > > > > 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/](https://groups.google.com/d/)\*  
> > > > > > > > \*to\*\*pic/elasticsearch/Y-\*\*AxvhSyhXU/\*\*unsubscribe[https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe)  
> > > > > > > > .  
> > > > > > > > To unsubscribe from this group and all its topics, send an email  
> > > > > > > > to elasticsearc...@\*\*googlegroups.\*\*com.
> > > > > > > > 
> > > > > > > > For more options, visit [https://groups.google.com/\*\*grou](https://groups.google.com/**grou)\*\*  
> > > > > > > > ps/opt\_out [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > > > > > 
> > > > > > > --  
> > > > > > > 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/](https://groups.google.com/d/)\*\*  
> > > > > > > topic/elasticsearch/Y-\*\*AxvhSyhXU/unsubscribe[https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe)  
> > > > > > > .  
> > > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > > elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).  
> > > > > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > > > > .
> > > > 
> > > > --  
> > > > 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/Y-AxvhSyhXU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/Y-AxvhSyhXU/unsubscribe).  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:22am UTC](https://discuss.elastic.co/t/searching-across-parent-and-child/13001/12 "2017-07-06T02:22:27Z")

</div>


