# Using \_exlpain on parent / child

**URL:** https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702
**Category:** Elasticsearch
**Created:** [July 8, 2013, 2:57pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702 "2013-07-08T14:57:09Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)
#### Post date: [July 8, 2013, 2:57pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/1 "2013-07-08T14:57:09Z")

</div>

Should it be possible to use explain API with a has\_child query?

I have a parent document that has child documents. I'm trying to run an  
explain on a query like this:

{  
"query": {  
"has\_child": {  
"type": "child",  
"query": {  
"bool": {  
"must": [  
{  
"term": {  
"path": "/top"  
}  
}  
]  
}  
}  
}  
}  
}

And the result I'm getting is:

{"error":"ElasticSearchIllegalStateException[has\_child filter hasn't executed properly]","status":500}

--  
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: ![Boaz\_Leskes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/boaz_leskes/32/723_2.png) [@Boaz\_Leskes](https://discuss.elastic.co/u/Boaz_Leskes)
#### Post date: [July 9, 2013, 1:15pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/2 "2013-07-09T13:15:22Z")

</div>

Hi Rotem,

It does look like there is an issue with the \_explain end point & the  
has\_child query . I encourage you to report it  
here: [Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/) . Please post  
CURLs to reproduce it. This will make it much easier to investigate.

In the mean time - search based explain does work  
( [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/explain/) ) . As  
an alternative you can debug by querying child types directly.

Cheers,  
Boaz

On Monday, July 8, 2013 4:57:09 PM UTC+2, Rotem wrote:

> Should it be possible to use explain API with a has\_child query?
> 
> I have a parent document that has child documents. I'm trying to run an  
> explain on a query like this:
> 
> {  
> "query": {  
> "has\_child": {  
> "type": "child",  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "term": {  
> "path": "/top"  
> }  
> }  
> ]  
> }  
> }  
> }  
> }  
> }
> 
> And the result I'm getting is:
> 
> {"error":"ElasticSearchIllegalStateException[has\_child filter hasn't executed properly]","status":500}

--  
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: ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)
#### Post date: [July 9, 2013, 1:22pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/3 "2013-07-09T13:22:47Z")

</div>

Thanks Boaz.

Actually I'm not really interested in debugging the query. My real  
intention is to know if a document matches a query.  
But I can't use the percolator since it doesn't support parent / child  
documents.  
And issuing the search query in question with an added \_id constraint may  
also be a problem since the document might still not be updated in the  
index (in my use case i need to check it right after indexing).  
So I was hoping the \_explain endpoint will do the trick (all I need is to  
see if there's a match).  
Any other ideas maybe?

On Tuesday, July 9, 2013 4:15:22 PM UTC+3, Boaz Leskes wrote:

> Hi Rotem,
> 
> It does look like there is an issue with the \_explain end point & the  
> has\_child query . I encourage you to report it here:  
> [Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/) . Please post  
> CURLs to reproduce it. This will make it much easier to investigate.
> 
> In the mean time - search based explain does work (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/explain/) ) . As  
> an alternative you can debug by querying child types directly.
> 
> Cheers,  
> Boaz
> 
> On Monday, July 8, 2013 4:57:09 PM UTC+2, Rotem wrote:
> 
> > Should it be possible to use explain API with a has\_child query?
> > 
> > I have a parent document that has child documents. I'm trying to run an  
> > explain on a query like this:
> > 
> > {  
> > "query": {  
> > "has\_child": {  
> > "type": "child",  
> > "query": {  
> > "bool": {  
> > "must": [  
> > {  
> > "term": {  
> > "path": "/top"  
> > }  
> > }  
> > ]  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > And the result I'm getting is:
> > 
> > {"error":"ElasticSearchIllegalStateException[has\_child filter hasn't executed properly]","status":500}

--  
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: ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)
#### Post date: [July 9, 2013, 1:51pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/4 "2013-07-09T13:51:21Z")

</div>

BTW, issue opened:

> <https://github.com/elastic/elasticsearch/issues/3305>
>
> Steps to reproduce:
> 
> Create a child type: 
> 
> PUT http://es:9200/hrtest/child/\_map…ping
> {
> "child" : {
> "\_parent" : {
> "type" : "parent"
> }
> }
> }
> 
> Index a parent:
> POST http://es:9200/hrtest/parent/p1
> {
> "name" : "my parent" 
> }
> 
> Index a child: 
> POST http://es:9200/hrtest/child/c1?parent=p1
> {
> "path" : "/top" 
> }
> 
> Try searching:
> POST http://es:9200/hrtest/parent/\_search
> {
> "query": {
> "has\_child": {
> "type": "child",
> "query": {
> "bool": {
> "must": \[
> {
> "term": {
> "path": "/top"
> }
> }
> \]
> }
> }
> }
> }
> }
> 
> Now try \_explain:
> POST http://es:9200/hrtest/parent/p1/\_explain
> {
> "query": {
> "has\_child": {
> "type": "child",
> "query": {
> "bool": {
> "must": \[
> {
> "term": {
> "path": "/top"
> }
> }
> \]
> }
> }
> }
> }
> }
> 
> You get an error:
> {
> "error": "ElasticSearchIllegalStateException\[has\_child filter hasn't executed properly\]",
> "status": 500
> }

On Tuesday, July 9, 2013 4:15:22 PM UTC+3, Boaz Leskes wrote:

> Hi Rotem,
> 
> It does look like there is an issue with the \_explain end point & the  
> has\_child query . I encourage you to report it here:  
> [Issues · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/) . Please post  
> CURLs to reproduce it. This will make it much easier to investigate.
> 
> In the mean time - search based explain does work (  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/explain/) ) . As  
> an alternative you can debug by querying child types directly.
> 
> Cheers,  
> Boaz
> 
> On Monday, July 8, 2013 4:57:09 PM UTC+2, Rotem wrote:
> 
> > Should it be possible to use explain API with a has\_child query?
> > 
> > I have a parent document that has child documents. I'm trying to run an  
> > explain on a query like this:
> > 
> > {  
> > "query": {  
> > "has\_child": {  
> > "type": "child",  
> > "query": {  
> > "bool": {  
> > "must": [  
> > {  
> > "term": {  
> > "path": "/top"  
> > }  
> > }  
> > ]  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > And the result I'm getting is:
> > 
> > {"error":"ElasticSearchIllegalStateException[has\_child filter hasn't executed properly]","status":500}

--  
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: ![Boaz\_Leskes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/boaz_leskes/32/723_2.png) [@Boaz\_Leskes](https://discuss.elastic.co/u/Boaz_Leskes)
#### Post date: [July 9, 2013, 2:18pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/5 "2013-07-09T14:18:15Z")

</div>

Thx.

FYI - the \_explain API also works in near realtime , just like search. The  
reason is that it needs the tokenised version of the doc to explain the  
query. You should also be aware that \_explain is heavy (but maybe not too  
heavy for you) which also means it is usually used for debugging and  
therefore doesn't need realtime support.

Does the query contain only a has\_child clause? if you so you might be able  
to query the children type with the parent id.

On Tue, Jul 9, 2013 at 3:51 PM, Rotem [rotem.hermon@gmail.com](mailto:rotem.hermon@gmail.com) wrote:

> BTW, issue opened:  
> [\_explain endpoint does not work with has\_child query · Issue #3305 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3305)
> 
> On Tuesday, July 9, 2013 4:15:22 PM UTC+3, Boaz Leskes wrote:
> 
> > Hi Rotem,
> > 
> > It does look like there is an issue with the \_explain end point & the  
> > has\_child query . I encourage you to report it here: [https://github.com/](https://github.com/)\*  
> > \*elasticsearch/elasticsearch/\*\*issues/[https://github.com/elasticsearch/elasticsearch/issues/](https://github.com/elasticsearch/elasticsearch/issues/) . Please post CURLs to reproduce it. This will make it much easier to  
> > investigate.
> > 
> > In the mean time - search based explain does work (  
> > [http://www.elasticsearch](http://www.elasticsearch).\*\*org/guide/reference/api/\*\*search/explain/[http://www.elasticsearch.org/guide/reference/api/search/explain/](http://www.elasticsearch.org/guide/reference/api/search/explain/)) . As an alternative you can debug by querying child types directly.
> > 
> > Cheers,  
> > Boaz
> > 
> > On Monday, July 8, 2013 4:57:09 PM UTC+2, Rotem wrote:
> > 
> > > Should it be possible to use explain API with a has\_child query?
> > > 
> > > I have a parent document that has child documents. I'm trying to run an  
> > > explain on a query like this:
> > > 
> > > {  
> > > "query": {  
> > > "has\_child": {  
> > > "type": "child",  
> > > "query": {  
> > > "bool": {  
> > > "must": [  
> > > {  
> > > "term": {  
> > > "path": "/top"  
> > > }  
> > > }  
> > > ]  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > And the result I'm getting is:
> > > 
> > > {"error":" **ElasticSearchIllegalStateExcep** tion[has\_child filter hasn't executed properly]","status":500}
> > > 
> > > --  
> > > 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/jI0oU0BMsMU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/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: ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)
#### Post date: [July 9, 2013, 2:21pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/6 "2013-07-09T14:21:52Z")

</div>

```
No, the query will be a combination of parent / child attributes. 

So if it's only near realtime the explain endpoint also doesn't fit
my use case. Is there any other way of doing this I might have
missed?
```

---

<div class="post-metadata">

### Author: ![Boaz\_Leskes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/boaz_leskes/32/723_2.png) [@Boaz\_Leskes](https://discuss.elastic.co/u/Boaz_Leskes)
#### Post date: [July 9, 2013, 2:29pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/7 "2013-07-09T14:29:14Z")

</div>

Not that I can see. Perhaps if you tell me more about your application - is  
the a chance of aggregated all the child document in the parent and  
percolating it? Depending on the nuances of the query it may be inaccurate  
but it might also be good enough for you.

On Tue, Jul 9, 2013 at 4:21 PM, Rotem Hermon [rotem.hermon@gmail.com](mailto:rotem.hermon@gmail.com) wrote:

> No, the query will be a combination of parent / child attributes.  
> So if it's only near realtime the explain endpoint also doesn't fit my use  
> case. Is there any other way of doing this I might have missed?
> 
> --  
> 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/jI0oU0BMsMU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/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: ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)
#### Post date: [July 9, 2013, 2:38pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/8 "2013-07-09T14:38:14Z")

</div>

Basically I have a parent document on which I collect all kind of dynamic  
counters. Each counter has a name (which can be anything and is varied) and  
a value.

I need to search based on name/value combination so the counters can't be  
added as an array to the parent (otherwise searches will not bring correct  
results). They can be either nested or children. Children seems more  
appropriate as the parent document can be big and I don't want to re-index  
it on every counter update (which can happen a lot).

I also have a set of predefined queries (which combine parent attributes  
and counter values). When I index (update) a parent document I need to  
check if it answers to one of the predefined queries.

On Tuesday, July 9, 2013 5:29:14 PM UTC+3, Boaz Leskes wrote:

> Not that I can see. Perhaps if you tell me more about your application -  
> is the a chance of aggregated all the child document in the parent and  
> percolating it? Depending on the nuances of the query it may be inaccurate  
> but it might also be good enough for you.
> 
> On Tue, Jul 9, 2013 at 4:21 PM, Rotem Hermon \<[rotem....@gmail.com](mailto:rotem....@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > No, the query will be a combination of parent / child attributes.  
> > So if it's only near realtime the explain endpoint also doesn't fit my  
> > use case. Is there any other way of doing this I might have missed?
> > 
> > --  
> > 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/jI0oU0BMsMU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/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: ![Boaz\_Leskes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/boaz_leskes/32/723_2.png) [@Boaz\_Leskes](https://discuss.elastic.co/u/Boaz_Leskes)
#### Post date: [July 11, 2013, 7:49pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/9 "2013-07-11T19:49:08Z")

</div>

Hi Rotem,

Yeah - parent/child is the perfect answer from a normal search & indexing  
point of view.

Thinking out of the box - is realistic for you do a mget for all the  
counters, inject them into the parent body in question and percolate that?  
or perhaps the reverse - injecting parent attributes to counter document  
and percolate all of those? to solve the searching problem relating to  
search both name and value - depending on the type of search - you can  
concatenate name and value and search on the combination. This works if  
you're not doing numeric range queries on the values. You can also see if  
you can translate the names into numbers and combine them with the counter  
values. All depends on what kind of assumptions you can safely do with your  
data.

I realize this is hacky - but that's the best I can offer.

Cheers,  
Boaz

On Tue, Jul 9, 2013 at 4:38 PM, Rotem [rotem.hermon@gmail.com](mailto:rotem.hermon@gmail.com) wrote:

> Basically I have a parent document on which I collect all kind of dynamic  
> counters. Each counter has a name (which can be anything and is varied) and  
> a value.
> 
> I need to search based on name/value combination so the counters can't be  
> added as an array to the parent (otherwise searches will not bring correct  
> results). They can be either nested or children. Children seems more  
> appropriate as the parent document can be big and I don't want to re-index  
> it on every counter update (which can happen a lot).
> 
> I also have a set of predefined queries (which combine parent attributes  
> and counter values). When I index (update) a parent document I need to  
> check if it answers to one of the predefined queries.
> 
> On Tuesday, July 9, 2013 5:29:14 PM UTC+3, Boaz Leskes wrote:
> 
> > Not that I can see. Perhaps if you tell me more about your application -  
> > is the a chance of aggregated all the child document in the parent and  
> > percolating it? Depending on the nuances of the query it may be inaccurate  
> > but it might also be good enough for you.
> > 
> > On Tue, Jul 9, 2013 at 4:21 PM, Rotem Hermon [rotem....@gmail.com](mailto:rotem....@gmail.com) wrote:
> > 
> > > No, the query will be a combination of parent / child attributes.  
> > > So if it's only near realtime the explain endpoint also doesn't fit my  
> > > use case. Is there any other way of doing this I might have missed?
> > > 
> > > --  
> > > 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/\*\*jI0oU0BMsMU/unsubscribe[https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/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/jI0oU0BMsMU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/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: ![rore](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rore/32/399_2.png) [@rore](https://discuss.elastic.co/u/rore)
#### Post date: [July 11, 2013, 9:46pm UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/10 "2013-07-11T21:46:19Z")

</div>

Hmmm, a bit hacky indeed but interesting ideas 🙂  
I'm not sure it will be valid data-wise, but definitely something to think  
about.

Thanks!

On Thu, Jul 11, 2013 at 10:49 PM, Boaz Leskes [b.leskes@gmail.com](mailto:b.leskes@gmail.com) wrote:

> Hi Rotem,
> 
> Yeah - parent/child is the perfect answer from a normal search & indexing  
> point of view.
> 
> Thinking out of the box - is realistic for you do a mget for all the  
> counters, inject them into the parent body in question and percolate that?  
> or perhaps the reverse - injecting parent attributes to counter document  
> and percolate all of those? to solve the searching problem relating to  
> search both name and value - depending on the type of search - you can  
> concatenate name and value and search on the combination. This works if  
> you're not doing numeric range queries on the values. You can also see if  
> you can translate the names into numbers and combine them with the counter  
> values. All depends on what kind of assumptions you can safely do with your  
> data.
> 
> I realize this is hacky - but that's the best I can offer.
> 
> Cheers,  
> Boaz
> 
> On Tue, Jul 9, 2013 at 4:38 PM, Rotem [rotem.hermon@gmail.com](mailto:rotem.hermon@gmail.com) wrote:
> 
> > Basically I have a parent document on which I collect all kind of dynamic  
> > counters. Each counter has a name (which can be anything and is varied) and  
> > a value.
> > 
> > I need to search based on name/value combination so the counters can't be  
> > added as an array to the parent (otherwise searches will not bring correct  
> > results). They can be either nested or children. Children seems more  
> > appropriate as the parent document can be big and I don't want to re-index  
> > it on every counter update (which can happen a lot).
> > 
> > I also have a set of predefined queries (which combine parent attributes  
> > and counter values). When I index (update) a parent document I need to  
> > check if it answers to one of the predefined queries.
> > 
> > On Tuesday, July 9, 2013 5:29:14 PM UTC+3, Boaz Leskes wrote:
> > 
> > > Not that I can see. Perhaps if you tell me more about your application -  
> > > is the a chance of aggregated all the child document in the parent and  
> > > percolating it? Depending on the nuances of the query it may be inaccurate  
> > > but it might also be good enough for you.
> > > 
> > > On Tue, Jul 9, 2013 at 4:21 PM, Rotem Hermon [rotem....@gmail.com](mailto:rotem....@gmail.com)wrote:
> > > 
> > > > No, the query will be a combination of parent / child attributes.  
> > > > So if it's only near realtime the explain endpoint also doesn't fit my  
> > > > use case. Is there any other way of doing this I might have missed?
> > > > 
> > > > --  
> > > > 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/\*\*jI0oU0BMsMU/unsubscribe[https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/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/jI0oU0BMsMU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/unsubscribe](https://groups.google.com/d/topic/elasticsearch/jI0oU0BMsMU/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: ![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:26am UTC](https://discuss.elastic.co/t/using--exlpain-on-parent-child/12702/11 "2017-07-06T02:26:54Z")

</div>


