# Older versions of parent document returned in has\_child query for Parent/Child setup

**URL:** <https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342>\
**Category:** Elasticsearch\
**Created:** [January 15, 2013, 3:03am UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342 "2013-01-15T03:03:51Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesus\_Domingo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jesus_domingo/32/2544_2.png) [@Jesus\_Domingo](https://discuss.elastic.co/u/Jesus_Domingo)\
**Post date:** [January 15, 2013, 3:03am UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/1 "2013-01-15T03:03:51Z")

</div>

I have a parent/child mapping for topics and comments. Whenever a comment  
is added to the topic, i index the comment, then update the topic index  
(increment comment count and update last post date).

Then when I use has\_child search on the topics, I get duplicate results of  
the matching parent documents, and upon inspection, they seem to be  
previous versions of the topic (based on comment count and last post  
dates). So if say a topic has 3 comments (has also been updated in the  
index 3 times), the record will show up in the has\_child search results 3  
times, showing all versions of the topic.

Doing a \_cache/clear fixes this but does that mean every time I reindex a  
topic for adding child documents, I have to clear the cache? Or am I  
missing something?

For my has\_child query, i'm using 'sum' for the 'score\_type'.

Would really appreciate help on this. I've been asking this in the irc  
channel for a day and nothing seems to get answered there.

--

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 15, 2013, 12:52pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/2 "2013-01-15T12:52:16Z")

</div>

Hi Jesus

This sounds like it might be a bug. If you could open an issue showing  
exactly how to recreate this, it'd help us to find the issue

ta

Clint

On Mon, 2013-01-14 at 19:03 -0800, Jesus Domingo wrote:

> I have a parent/child mapping for topics and comments. Whenever a  
> comment is added to the topic, i index the comment, then update the  
> topic index (increment comment count and update last post date).
> 
> Then when I use has\_child search on the topics, I get duplicate  
> results of the matching parent documents, and upon inspection, they  
> seem to be previous versions of the topic (based on comment count and  
> last post dates). So if say a topic has 3 comments (has also been  
> updated in the index 3 times), the record will show up in the  
> has\_child search results 3 times, showing all versions of the topic.
> 
> Doing a \_cache/clear fixes this but does that mean every time I  
> reindex a topic for adding child documents, I have to clear the cache?  
> Or am I missing something?
> 
> For my has\_child query, i'm using 'sum' for the 'score\_type'.
> 
> Would really appreciate help on this. I've been asking this in the irc  
> channel for a day and nothing seems to get answered there.
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Chad\_Kouse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chad_kouse/32/2290_2.png) [@Chad\_Kouse](https://discuss.elastic.co/u/Chad_Kouse)\
**Post date:** [May 23, 2013, 7:05pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/3 "2013-05-23T19:05:08Z")

</div>

I am seeing this today as well on version 0.20.5 -- did an issue ever get  
created?

On Tuesday, January 15, 2013 7:52:16 AM UTC-5, Clinton Gormley wrote:

> Hi Jesus
> 
> This sounds like it might be a bug. If you could open an issue showing  
> exactly how to recreate this, it'd help us to find the issue
> 
> ta
> 
> Clint
> 
> On Mon, 2013-01-14 at 19:03 -0800, Jesus Domingo wrote:
> 
> > I have a parent/child mapping for topics and comments. Whenever a  
> > comment is added to the topic, i index the comment, then update the  
> > topic index (increment comment count and update last post date).
> > 
> > Then when I use has\_child search on the topics, I get duplicate  
> > results of the matching parent documents, and upon inspection, they  
> > seem to be previous versions of the topic (based on comment count and  
> > last post dates). So if say a topic has 3 comments (has also been  
> > updated in the index 3 times), the record will show up in the  
> > has\_child search results 3 times, showing all versions of the topic.
> > 
> > Doing a \_cache/clear fixes this but does that mean every time I  
> > reindex a topic for adding child documents, I have to clear the cache?  
> > Or am I missing something?
> > 
> > For my has\_child query, i'm using 'sum' for the 'score\_type'.
> > 
> > Would really appreciate help on this. I've been asking this in the irc  
> > channel for a day and nothing seems to get answered there.
> > 
> > --

--  
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:** ![Chad\_Kouse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chad_kouse/32/2290_2.png) [@Chad\_Kouse](https://discuss.elastic.co/u/Chad_Kouse)\
**Post date:** [May 23, 2013, 7:10pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/4 "2013-05-23T19:10:57Z")

</div>

Here's my query also in case it helps:

curl -XGET localhost:9200/shares/share/\_search?pretty -d '{  
"query": {  
"has\_child": {  
"type": "comment",  
"score\_type": "sum",  
"query": {  
"term": {  
"text.lower": {  
"value": "#bestoftunewiki"  
}  
}  
}  
}  
},  
"from": 0,  
"size": 10,  
"sort": [  
{  
"id": {  
"sort\_mode": null,  
"order": "desc",  
"missing": null,  
"ignore\_unmapped": null  
}  
}  
]  
}'

On Thursday, May 23, 2013 3:05:08 PM UTC-4, Chad Kouse wrote:

> I am seeing this today as well on version 0.20.5 -- did an issue ever get  
> created?
> 
> On Tuesday, January 15, 2013 7:52:16 AM UTC-5, Clinton Gormley wrote:
> 
> > Hi Jesus
> > 
> > This sounds like it might be a bug. If you could open an issue showing  
> > exactly how to recreate this, it'd help us to find the issue
> > 
> > ta
> > 
> > Clint
> > 
> > On Mon, 2013-01-14 at 19:03 -0800, Jesus Domingo wrote:
> > 
> > > I have a parent/child mapping for topics and comments. Whenever a  
> > > comment is added to the topic, i index the comment, then update the  
> > > topic index (increment comment count and update last post date).
> > > 
> > > Then when I use has\_child search on the topics, I get duplicate  
> > > results of the matching parent documents, and upon inspection, they  
> > > seem to be previous versions of the topic (based on comment count and  
> > > last post dates). So if say a topic has 3 comments (has also been  
> > > updated in the index 3 times), the record will show up in the  
> > > has\_child search results 3 times, showing all versions of the topic.
> > > 
> > > Doing a \_cache/clear fixes this but does that mean every time I  
> > > reindex a topic for adding child documents, I have to clear the cache?  
> > > Or am I missing something?
> > > 
> > > For my has\_child query, i'm using 'sum' for the 'score\_type'.
> > > 
> > > Would really appreciate help on this. I've been asking this in the irc  
> > > channel for a day and nothing seems to get answered there.
> > > 
> > > --

--  
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:** ![Chad\_Kouse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chad_kouse/32/2290_2.png) [@Chad\_Kouse](https://discuss.elastic.co/u/Chad_Kouse)\
**Post date:** [May 23, 2013, 9:08pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/5 "2013-05-23T21:08:46Z")

</div>

one more observation - we never noticed this when we had 2 nodes both  
running openjdk 6 -- now we have 3 nodes running oracle's java 7 -- so, it  
could be going from 2 to 3 nodes.. or could be the java switch.

On Thursday, May 23, 2013 3:10:57 PM UTC-4, Chad Kouse wrote:

> Here's my query also in case it helps:
> 
> curl -XGET localhost:9200/shares/share/\_search?pretty -d '{  
> "query": {  
> "has\_child": {  
> "type": "comment",  
> "score\_type": "sum",  
> "query": {  
> "term": {  
> "text.lower": {  
> "value": "#bestoftunewiki"  
> }  
> }  
> }  
> }  
> },  
> "from": 0,  
> "size": 10,  
> "sort": [  
> {  
> "id": {  
> "sort\_mode": null,  
> "order": "desc",  
> "missing": null,  
> "ignore\_unmapped": null  
> }  
> }  
> ]  
> }'
> 
> On Thursday, May 23, 2013 3:05:08 PM UTC-4, Chad Kouse wrote:
> 
> > I am seeing this today as well on version 0.20.5 -- did an issue ever get  
> > created?
> > 
> > On Tuesday, January 15, 2013 7:52:16 AM UTC-5, Clinton Gormley wrote:
> > 
> > > Hi Jesus
> > > 
> > > This sounds like it might be a bug. If you could open an issue showing  
> > > exactly how to recreate this, it'd help us to find the issue
> > > 
> > > ta
> > > 
> > > Clint
> > > 
> > > On Mon, 2013-01-14 at 19:03 -0800, Jesus Domingo wrote:
> > > 
> > > > I have a parent/child mapping for topics and comments. Whenever a  
> > > > comment is added to the topic, i index the comment, then update the  
> > > > topic index (increment comment count and update last post date).
> > > > 
> > > > Then when I use has\_child search on the topics, I get duplicate  
> > > > results of the matching parent documents, and upon inspection, they  
> > > > seem to be previous versions of the topic (based on comment count and  
> > > > last post dates). So if say a topic has 3 comments (has also been  
> > > > updated in the index 3 times), the record will show up in the  
> > > > has\_child search results 3 times, showing all versions of the topic.
> > > > 
> > > > Doing a \_cache/clear fixes this but does that mean every time I  
> > > > reindex a topic for adding child documents, I have to clear the cache?  
> > > > Or am I missing something?
> > > > 
> > > > For my has\_child query, i'm using 'sum' for the 'score\_type'.
> > > > 
> > > > Would really appreciate help on this. I've been asking this in the irc  
> > > > channel for a day and nothing seems to get answered there.
> > > > 
> > > > --

--  
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:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [May 24, 2013, 10:25am UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/6 "2013-05-24T10:25:20Z")

</div>

Chad, when you index your parent or child docs, are you specifying a  
routing value? Do you child docs have grandparents?

clint

--  
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:** ![Chad\_Kouse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chad_kouse/32/2290_2.png) [@Chad\_Kouse](https://discuss.elastic.co/u/Chad_Kouse)\
**Post date:** [May 24, 2013, 2:01pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/7 "2013-05-24T14:01:26Z")

</div>

No I'm not specifying a routing value and they don't have grandparents. However I may index the same document more than once (with the same id)

This is the scenario: a user creates a document and it gets indexed. Another user makes a comment on this document and the comment and the original document(again) get indexed--the comment is given the document id as its parent. The document would have the same id it originally had so i assume this is ok and it would just replace what was already there. this is sort of a fail safe (basically whenever the document changes or has a new comment added we reindex the document and all of its comments for safety)

—  
chad

On Fri, May 24, 2013 at 6:25 AM, Clinton Gormley [clint@traveljury.com](mailto:clint@traveljury.com)  
wrote:

> ## Chad, when you index your parent or child docs, are you specifying a routing value? Do you child docs have grandparents? clint
> 
> 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/SQaQ7QcmcKQ/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US).  
> 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:** ![Chad\_Kouse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chad_kouse/32/2290_2.png) [@Chad\_Kouse](https://discuss.elastic.co/u/Chad_Kouse)\
**Post date:** [May 24, 2013, 8:36pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/8 "2013-05-24T20:36:24Z")

</div>

I reduced our cluster from 3 nodes to 2 and it seems like this issue has  
gone away. -- So the bug must be dependent on the number of nodes.

I am using the default 5 shards & 1 replica

On Friday, May 24, 2013 10:01:26 AM UTC-4, Chad Kouse wrote:

> No I'm not specifying a routing value and they don't have grandparents.  
> However I may index the same document more than once (with the same id)
> 
> This is the scenario: a user creates a document and it gets indexed.  
> Another user makes a comment on this document and the comment and the  
> original document(again) get indexed--the comment is given the document id  
> as its parent. The document would have the same id it originally had so i  
> assume this is ok and it would just replace what was already there. this  
> is sort of a fail safe (basically whenever the document changes or has a  
> new comment added we reindex the document and all of its comments for  
> safety)
> 
> —  
> chad
> 
> On Fri, May 24, 2013 at 6:25 AM, Clinton Gormley wrote:
> 
> > Chad, when you index your parent or child docs, are you specifying a  
> > routing value? Do you child docs have grandparents?
> > 
> > clint
> > 
> > --  
> > 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/SQaQ7QcmcKQ/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US)  
> > .  
> > To unsubscribe from this group and all its topics, send an email t  
> > 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:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [May 25, 2013, 6:32am UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/9 "2013-05-25T06:32:23Z")

</div>

What you are describing should work, but parent-child can be tricky at  
times. I would suggest pasting the actual curl commands that get issues to  
(1) create the original post and (2) add a comment. Note: actual curl  
commands, as opposed to what you think it should be doing - the two may not  
be the same. Plus the mapping for your index.

clint

On 24 May 2013 22:36, Chad Kouse [chad.kouse@gmail.com](mailto:chad.kouse@gmail.com) wrote:

> I reduced our cluster from 3 nodes to 2 and it seems like this issue has  
> gone away. -- So the bug must be dependent on the number of nodes.
> 
> I am using the default 5 shards & 1 replica
> 
> On Friday, May 24, 2013 10:01:26 AM UTC-4, Chad Kouse wrote:
> 
> > No I'm not specifying a routing value and they don't have grandparents.  
> > However I may index the same document more than once (with the same id)
> > 
> > This is the scenario: a user creates a document and it gets indexed.  
> > Another user makes a comment on this document and the comment and the  
> > original document(again) get indexed--the comment is given the document id  
> > as its parent. The document would have the same id it originally had so i  
> > assume this is ok and it would just replace what was already there. this  
> > is sort of a fail safe (basically whenever the document changes or has a  
> > new comment added we reindex the document and all of its comments for  
> > safety)
> > 
> > —  
> > chad
> > 
> > On Fri, May 24, 2013 at 6:25 AM, Clinton Gormley wrote:
> > 
> > > Chad, when you index your parent or child docs, are you specifying a  
> > > routing value? Do you child docs have grandparents?
> > > 
> > > clint
> > > 
> > > --  
> > > 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/\*\*SQaQ7QcmcKQ/unsubscribe?hl=en-\*\*US[https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US)  
> > > .  
> > > To unsubscribe from this group and all its topics, send an email t  
> > > 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 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).

--  
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:** ![Chad\_Kouse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chad_kouse/32/2290_2.png) [@Chad\_Kouse](https://discuss.elastic.co/u/Chad_Kouse)\
**Post date:** [June 3, 2013, 9:44pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/10 "2013-06-03T21:44:02Z")

</div>

fwiw we upgraded to 0.90.1 today and haven't seen the issue yet.. I'll give  
it a few more days and report back.

On Saturday, May 25, 2013 2:32:23 AM UTC-4, Clinton Gormley wrote:

> What you are describing should work, but parent-child can be tricky at  
> times. I would suggest pasting the actual curl commands that get issues to  
> (1) create the original post and (2) add a comment. Note: actual curl  
> commands, as opposed to what you think it should be doing - the two may not  
> be the same. Plus the mapping for your index.
> 
> clint
> 
> On 24 May 2013 22:36, Chad Kouse \<[chad....@gmail.com](mailto:chad....@gmail.com) \<javascript:\>\> wrote:
> 
> > I reduced our cluster from 3 nodes to 2 and it seems like this issue has  
> > gone away. -- So the bug must be dependent on the number of nodes.
> > 
> > I am using the default 5 shards & 1 replica
> > 
> > On Friday, May 24, 2013 10:01:26 AM UTC-4, Chad Kouse wrote:
> > 
> > > No I'm not specifying a routing value and they don't have grandparents.  
> > > However I may index the same document more than once (with the same id)
> > > 
> > > This is the scenario: a user creates a document and it gets indexed.  
> > > Another user makes a comment on this document and the comment and the  
> > > original document(again) get indexed--the comment is given the document id  
> > > as its parent. The document would have the same id it originally had so i  
> > > assume this is ok and it would just replace what was already there. this  
> > > is sort of a fail safe (basically whenever the document changes or has a  
> > > new comment added we reindex the document and all of its comments for  
> > > safety)
> > > 
> > > —  
> > > chad
> > > 
> > > On Fri, May 24, 2013 at 6:25 AM, Clinton Gormley wrote:
> > > 
> > > > Chad, when you index your parent or child docs, are you specifying a  
> > > > routing value? Do you child docs have grandparents?
> > > > 
> > > > clint
> > > > 
> > > > --  
> > > > 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/\*\*SQaQ7QcmcKQ/unsubscribe?hl=en-\*\*US[https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, send an email t  
> > > > 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 the Google Groups  
> > > "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > 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:** ![Chad\_Kouse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chad_kouse/32/2290_2.png) [@Chad\_Kouse](https://discuss.elastic.co/u/Chad_Kouse)\
**Post date:** [June 4, 2013, 5:18pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/11 "2013-06-04T17:18:22Z")

</div>

Issue has returned -- it may be related to increased traffic (both new  
documents coming in and increased searches)

On Monday, June 3, 2013 5:44:02 PM UTC-4, Chad Kouse wrote:

> fwiw we upgraded to 0.90.1 today and haven't seen the issue yet.. I'll  
> give it a few more days and report back.
> 
> On Saturday, May 25, 2013 2:32:23 AM UTC-4, Clinton Gormley wrote:
> 
> > What you are describing should work, but parent-child can be tricky at  
> > times. I would suggest pasting the actual curl commands that get issues to  
> > (1) create the original post and (2) add a comment. Note: actual curl  
> > commands, as opposed to what you think it should be doing - the two may not  
> > be the same. Plus the mapping for your index.
> > 
> > clint
> > 
> > On 24 May 2013 22:36, Chad Kouse [chad....@gmail.com](mailto:chad....@gmail.com) wrote:
> > 
> > > I reduced our cluster from 3 nodes to 2 and it seems like this issue has  
> > > gone away. -- So the bug must be dependent on the number of nodes.
> > > 
> > > I am using the default 5 shards & 1 replica
> > > 
> > > On Friday, May 24, 2013 10:01:26 AM UTC-4, Chad Kouse wrote:
> > > 
> > > > No I'm not specifying a routing value and they don't have grandparents.  
> > > > However I may index the same document more than once (with the same id)
> > > > 
> > > > This is the scenario: a user creates a document and it gets indexed.  
> > > > Another user makes a comment on this document and the comment and the  
> > > > original document(again) get indexed--the comment is given the document id  
> > > > as its parent. The document would have the same id it originally had so i  
> > > > assume this is ok and it would just replace what was already there. this  
> > > > is sort of a fail safe (basically whenever the document changes or has a  
> > > > new comment added we reindex the document and all of its comments for  
> > > > safety)
> > > > 
> > > > —  
> > > > chad
> > > > 
> > > > On Fri, May 24, 2013 at 6:25 AM, Clinton Gormley wrote:
> > > > 
> > > > > Chad, when you index your parent or child docs, are you specifying a  
> > > > > routing value? Do you child docs have grandparents?
> > > > > 
> > > > > clint
> > > > > 
> > > > > --  
> > > > > 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/\*\*SQaQ7QcmcKQ/unsubscribe?hl=en-\*\*US[https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, send an email t  
> > > > > 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 the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > 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:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [June 5, 2013, 2:44pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/12 "2013-06-05T14:44:26Z")

</div>

Chad, can you share via a gist how you index the document initially and how  
you index the document with comment(s) and the search request with the  
expected result? This will help us finding out what is going on.

On 4 June 2013 19:18, Chad Kouse [chad.kouse@gmail.com](mailto:chad.kouse@gmail.com) wrote:

> Issue has returned -- it may be related to increased traffic (both new  
> documents coming in and increased searches)
> 
> On Monday, June 3, 2013 5:44:02 PM UTC-4, Chad Kouse wrote:
> 
> > fwiw we upgraded to 0.90.1 today and haven't seen the issue yet.. I'll  
> > give it a few more days and report back.
> > 
> > On Saturday, May 25, 2013 2:32:23 AM UTC-4, Clinton Gormley wrote:
> > 
> > > What you are describing should work, but parent-child can be tricky at  
> > > times. I would suggest pasting the actual curl commands that get issues to  
> > > (1) create the original post and (2) add a comment. Note: actual curl  
> > > commands, as opposed to what you think it should be doing - the two may not  
> > > be the same. Plus the mapping for your index.
> > > 
> > > clint
> > > 
> > > On 24 May 2013 22:36, Chad Kouse [chad....@gmail.com](mailto:chad....@gmail.com) wrote:
> > > 
> > > > I reduced our cluster from 3 nodes to 2 and it seems like this issue  
> > > > has gone away. -- So the bug must be dependent on the number of nodes.
> > > > 
> > > > I am using the default 5 shards & 1 replica
> > > > 
> > > > On Friday, May 24, 2013 10:01:26 AM UTC-4, Chad Kouse wrote:
> > > > 
> > > > > No I'm not specifying a routing value and they don't have  
> > > > > grandparents. However I may index the same document more than once (with  
> > > > > the same id)
> > > > > 
> > > > > This is the scenario: a user creates a document and it gets indexed.  
> > > > > Another user makes a comment on this document and the comment and the  
> > > > > original document(again) get indexed--the comment is given the document id  
> > > > > as its parent. The document would have the same id it originally had so i  
> > > > > assume this is ok and it would just replace what was already there. this  
> > > > > is sort of a fail safe (basically whenever the document changes or has a  
> > > > > new comment added we reindex the document and all of its comments for  
> > > > > safety)
> > > > > 
> > > > > —  
> > > > > chad
> > > > > 
> > > > > On Fri, May 24, 2013 at 6:25 AM, Clinton Gormley wrote:
> > > > > 
> > > > > > Chad, when you index your parent or child docs, are you specifying a  
> > > > > > routing value? Do you child docs have grandparents?
> > > > > > 
> > > > > > clint
> > > > > > 
> > > > > > --  
> > > > > > 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/\*\*SQaQ7QcmcKQ/\*\*unsubscribe?hl=en-\*\*US[https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, send an email t  
> > > > > > 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 the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to elasticsearc...@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 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).

--  
Met vriendelijke groet,

Martijn van Groningen

--  
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:** ![Chad\_Kouse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chad_kouse/32/2290_2.png) [@Chad\_Kouse](https://discuss.elastic.co/u/Chad_Kouse)\
**Post date:** [June 5, 2013, 3:45pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/13 "2013-06-05T15:45:29Z")

</div>

The method indexing is the same whether its the initial indexing or updates  
after new comments are added:

> <https://gist.github.com/chadkouse/5714881>

When another comment is added this same process will take place but will  
include indexing the additional comment in a similar fashion -- do you need  
any other info?

On Wednesday, June 5, 2013 10:44:26 AM UTC-4, Martijn v Groningen wrote:

> Chad, can you share via a gist how you index the document initially and  
> how you index the document with comment(s) and the search request with the  
> expected result? This will help us finding out what is going on.
> 
> On 4 June 2013 19:18, Chad Kouse \<[chad....@gmail.com](mailto:chad....@gmail.com) \<javascript:\>\> wrote:
> 
> > Issue has returned -- it may be related to increased traffic (both new  
> > documents coming in and increased searches)
> > 
> > On Monday, June 3, 2013 5:44:02 PM UTC-4, Chad Kouse wrote:
> > 
> > > fwiw we upgraded to 0.90.1 today and haven't seen the issue yet.. I'll  
> > > give it a few more days and report back.
> > > 
> > > On Saturday, May 25, 2013 2:32:23 AM UTC-4, Clinton Gormley wrote:
> > > 
> > > > What you are describing should work, but parent-child can be tricky at  
> > > > times. I would suggest pasting the actual curl commands that get issues to  
> > > > (1) create the original post and (2) add a comment. Note: actual curl  
> > > > commands, as opposed to what you think it should be doing - the two may not  
> > > > be the same. Plus the mapping for your index.
> > > > 
> > > > clint
> > > > 
> > > > On 24 May 2013 22:36, Chad Kouse [chad....@gmail.com](mailto:chad....@gmail.com) wrote:
> > > > 
> > > > > I reduced our cluster from 3 nodes to 2 and it seems like this issue  
> > > > > has gone away. -- So the bug must be dependent on the number of nodes.
> > > > > 
> > > > > I am using the default 5 shards & 1 replica
> > > > > 
> > > > > On Friday, May 24, 2013 10:01:26 AM UTC-4, Chad Kouse wrote:
> > > > > 
> > > > > > No I'm not specifying a routing value and they don't have  
> > > > > > grandparents. However I may index the same document more than once (with  
> > > > > > the same id)
> > > > > > 
> > > > > > This is the scenario: a user creates a document and it gets indexed.  
> > > > > > Another user makes a comment on this document and the comment and the  
> > > > > > original document(again) get indexed--the comment is given the document id  
> > > > > > as its parent. The document would have the same id it originally had so i  
> > > > > > assume this is ok and it would just replace what was already there. this  
> > > > > > is sort of a fail safe (basically whenever the document changes or has a  
> > > > > > new comment added we reindex the document and all of its comments for  
> > > > > > safety)
> > > > > > 
> > > > > > —  
> > > > > > chad
> > > > > > 
> > > > > > On Fri, May 24, 2013 at 6:25 AM, Clinton Gormley wrote:
> > > > > > 
> > > > > > > Chad, when you index your parent or child docs, are you specifying a  
> > > > > > > routing value? Do you child docs have grandparents?
> > > > > > > 
> > > > > > > clint
> > > > > > > 
> > > > > > > --  
> > > > > > > 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/\*\*SQaQ7QcmcKQ/\*\*unsubscribe?hl=en-\*\*US[https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US)  
> > > > > > > .  
> > > > > > > To unsubscribe from this group and all its topics, send an email t  
> > > > > > > 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 the Google  
> > > > > > Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > > an email to elasticsearc...@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 the Google Groups  
> > > > "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> Met vriendelijke groet,
> 
> Martijn van Groningen

--  
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:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [June 6, 2013, 1:37pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/14 "2013-06-06T13:37:16Z")

</div>

Hi Chad,

I can confirm the bug that you're describing. I'll open an issue for it.  
Thanks for reporting this!

Martijn

On 5 June 2013 17:45, Chad Kouse [chad.kouse@gmail.com](mailto:chad.kouse@gmail.com) wrote:

> The method indexing is the same whether its the initial indexing or  
> updates after new comments are added:
> 
> [Requests to elasticsearch to index a share + comments · GitHub](https://gist.github.com/chadkouse/5714881)
> 
> When another comment is added this same process will take place but will  
> include indexing the additional comment in a similar fashion -- do you need  
> any other info?
> 
> On Wednesday, June 5, 2013 10:44:26 AM UTC-4, Martijn v Groningen wrote:
> 
> > Chad, can you share via a gist how you index the document initially and  
> > how you index the document with comment(s) and the search request with the  
> > expected result? This will help us finding out what is going on.
> > 
> > On 4 June 2013 19:18, Chad Kouse [chad....@gmail.com](mailto:chad....@gmail.com) wrote:
> > 
> > > Issue has returned -- it may be related to increased traffic (both new  
> > > documents coming in and increased searches)
> > > 
> > > On Monday, June 3, 2013 5:44:02 PM UTC-4, Chad Kouse wrote:
> > > 
> > > > fwiw we upgraded to 0.90.1 today and haven't seen the issue yet.. I'll  
> > > > give it a few more days and report back.
> > > > 
> > > > On Saturday, May 25, 2013 2:32:23 AM UTC-4, Clinton Gormley wrote:
> > > > 
> > > > > What you are describing should work, but parent-child can be tricky at  
> > > > > times. I would suggest pasting the actual curl commands that get issues to  
> > > > > (1) create the original post and (2) add a comment. Note: actual curl  
> > > > > commands, as opposed to what you think it should be doing - the two may not  
> > > > > be the same. Plus the mapping for your index.
> > > > > 
> > > > > clint
> > > > > 
> > > > > On 24 May 2013 22:36, Chad Kouse [chad....@gmail.com](mailto:chad....@gmail.com) wrote:
> > > > > 
> > > > > > I reduced our cluster from 3 nodes to 2 and it seems like this issue  
> > > > > > has gone away. -- So the bug must be dependent on the number of nodes.
> > > > > > 
> > > > > > I am using the default 5 shards & 1 replica
> > > > > > 
> > > > > > On Friday, May 24, 2013 10:01:26 AM UTC-4, Chad Kouse wrote:
> > > > > > 
> > > > > > > No I'm not specifying a routing value and they don't have  
> > > > > > > grandparents. However I may index the same document more than once (with  
> > > > > > > the same id)
> > > > > > > 
> > > > > > > This is the scenario: a user creates a document and it gets indexed.  
> > > > > > > Another user makes a comment on this document and the comment and the  
> > > > > > > original document(again) get indexed--the comment is given the document id  
> > > > > > > as its parent. The document would have the same id it originally had so i  
> > > > > > > assume this is ok and it would just replace what was already there. this  
> > > > > > > is sort of a fail safe (basically whenever the document changes or has a  
> > > > > > > new comment added we reindex the document and all of its comments for  
> > > > > > > safety)
> > > > > > > 
> > > > > > > —  
> > > > > > > chad
> > > > > > > 
> > > > > > > On Fri, May 24, 2013 at 6:25 AM, Clinton Gormley wrote:
> > > > > > > 
> > > > > > > > Chad, when you index your parent or child docs, are you specifying  
> > > > > > > > a routing value? Do you child docs have grandparents?
> > > > > > > > 
> > > > > > > > clint
> > > > > > > > 
> > > > > > > > --  
> > > > > > > > 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/\*\*SQaQ7QcmcKQ/\*\***unsubscribe?hl=en-US[https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US)  
> > > > > > > > .  
> > > > > > > > To unsubscribe from this group and all its topics, send an email t  
> > > > > > > > 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 the Google  
> > > > > > > Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > send an email to elasticsearc...@googlegroups. **c** om.  
> > > > > > > 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 the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, 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)  
> > > > > .
> > 
> > --  
> > Met vriendelijke groet,
> > 
> > Martijn van Groningen

--  
Met vriendelijke groet,

Martijn van Groningen

--  
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:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [June 6, 2013, 3:08pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/15 "2013-06-06T15:08:21Z")

</div>

And here is the issue for it:

> <https://github.com/elastic/elasticsearch/issues/3144>
>
> If score mode: \`max\`, \`avg\` or \`sum\` is specified for \`has\_child\` and if score m…ode \`score\` is specified for \`has\_parent\` query then deletes aren't taken into account.
> 
> This affects all version from 0.90.0.Beta1

On 6 June 2013 15:37, Martijn v Groningen [martijn.v.groningen@gmail.com](mailto:martijn.v.groningen@gmail.com)wrote:

> Hi Chad,
> 
> I can confirm the bug that you're describing. I'll open an issue for it.  
> Thanks for reporting this!
> 
> Martijn
> 
> On 5 June 2013 17:45, Chad Kouse [chad.kouse@gmail.com](mailto:chad.kouse@gmail.com) wrote:
> 
> > The method indexing is the same whether its the initial indexing or  
> > updates after new comments are added:
> > 
> > [Requests to elasticsearch to index a share + comments · GitHub](https://gist.github.com/chadkouse/5714881)
> > 
> > When another comment is added this same process will take place but will  
> > include indexing the additional comment in a similar fashion -- do you need  
> > any other info?
> > 
> > On Wednesday, June 5, 2013 10:44:26 AM UTC-4, Martijn v Groningen wrote:
> > 
> > > Chad, can you share via a gist how you index the document initially and  
> > > how you index the document with comment(s) and the search request with the  
> > > expected result? This will help us finding out what is going on.
> > > 
> > > On 4 June 2013 19:18, Chad Kouse [chad....@gmail.com](mailto:chad....@gmail.com) wrote:
> > > 
> > > > Issue has returned -- it may be related to increased traffic (both new  
> > > > documents coming in and increased searches)
> > > > 
> > > > On Monday, June 3, 2013 5:44:02 PM UTC-4, Chad Kouse wrote:
> > > > 
> > > > > fwiw we upgraded to 0.90.1 today and haven't seen the issue yet.. I'll  
> > > > > give it a few more days and report back.
> > > > > 
> > > > > On Saturday, May 25, 2013 2:32:23 AM UTC-4, Clinton Gormley wrote:
> > > > > 
> > > > > > What you are describing should work, but parent-child can be tricky  
> > > > > > at times. I would suggest pasting the actual curl commands that get issues  
> > > > > > to (1) create the original post and (2) add a comment. Note: actual curl  
> > > > > > commands, as opposed to what you think it should be doing - the two may not  
> > > > > > be the same. Plus the mapping for your index.
> > > > > > 
> > > > > > clint
> > > > > > 
> > > > > > On 24 May 2013 22:36, Chad Kouse [chad....@gmail.com](mailto:chad....@gmail.com) wrote:
> > > > > > 
> > > > > > > I reduced our cluster from 3 nodes to 2 and it seems like this issue  
> > > > > > > has gone away. -- So the bug must be dependent on the number of nodes.
> > > > > > > 
> > > > > > > I am using the default 5 shards & 1 replica
> > > > > > > 
> > > > > > > On Friday, May 24, 2013 10:01:26 AM UTC-4, Chad Kouse wrote:
> > > > > > > 
> > > > > > > > No I'm not specifying a routing value and they don't have  
> > > > > > > > grandparents. However I may index the same document more than once (with  
> > > > > > > > the same id)
> > > > > > > > 
> > > > > > > > This is the scenario: a user creates a document and it gets  
> > > > > > > > indexed. Another user makes a comment on this document and the comment and  
> > > > > > > > the original document(again) get indexed--the comment is given the document  
> > > > > > > > id as its parent. The document would have the same id it originally had so  
> > > > > > > > i assume this is ok and it would just replace what was already there. this  
> > > > > > > > is sort of a fail safe (basically whenever the document changes or has a  
> > > > > > > > new comment added we reindex the document and all of its comments for  
> > > > > > > > safety)
> > > > > > > > 
> > > > > > > > —  
> > > > > > > > chad
> > > > > > > > 
> > > > > > > > On Fri, May 24, 2013 at 6:25 AM, Clinton Gormley wrote:
> > > > > > > > 
> > > > > > > > > Chad, when you index your parent or child docs, are you specifying  
> > > > > > > > > a routing value? Do you child docs have grandparents?
> > > > > > > > > 
> > > > > > > > > clint
> > > > > > > > > 
> > > > > > > > > --  
> > > > > > > > > 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/\*\*SQaQ7QcmcKQ/\*\***unsubscribe?hl=en-US[https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US)  
> > > > > > > > > .  
> > > > > > > > > To unsubscribe from this group and all its topics, send an email t  
> > > > > > > > > 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 the Google  
> > > > > > > > Groups "elasticsearch" group.  
> > > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > > send an email to elasticsearc...@googlegroups. **c** om.  
> > > > > > > > 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 the Google  
> > > > > > Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this group and stop receiving emails from it, 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)  
> > > > > > .
> > > 
> > > --  
> > > Met vriendelijke groet,
> > > 
> > > Martijn van Groningen
> 
> --  
> Met vriendelijke groet,
> 
> Martijn van Groningen

--  
Met vriendelijke groet,

Martijn van Groningen

--  
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:** ![Chad\_Kouse](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chad_kouse/32/2290_2.png) [@Chad\_Kouse](https://discuss.elastic.co/u/Chad_Kouse)\
**Post date:** [June 6, 2013, 4:59pm UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/16 "2013-06-06T16:59:19Z")

</div>

awesome thanks!

On Thursday, June 6, 2013 11:08:21 AM UTC-4, Martijn v Groningen wrote:

> And here is the issue for it:  
> [has\_child & has\_parent queries don't take deletes into account · Issue #3144 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3144)
> 
> On 6 June 2013 15:37, Martijn v Groningen \<[martijn.v...@gmail.com](mailto:martijn.v...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Hi Chad,
> > 
> > I can confirm the bug that you're describing. I'll open an issue for it.  
> > Thanks for reporting this!
> > 
> > Martijn
> > 
> > On 5 June 2013 17:45, Chad Kouse \<[chad....@gmail.com](mailto:chad....@gmail.com) \<javascript:\>\>wrote:
> > 
> > > The method indexing is the same whether its the initial indexing or  
> > > updates after new comments are added:
> > > 
> > > [Requests to elasticsearch to index a share + comments · GitHub](https://gist.github.com/chadkouse/5714881)
> > > 
> > > When another comment is added this same process will take place but will  
> > > include indexing the additional comment in a similar fashion -- do you need  
> > > any other info?
> > > 
> > > On Wednesday, June 5, 2013 10:44:26 AM UTC-4, Martijn v Groningen wrote:
> > > 
> > > > Chad, can you share via a gist how you index the document initially and  
> > > > how you index the document with comment(s) and the search request with the  
> > > > expected result? This will help us finding out what is going on.
> > > > 
> > > > On 4 June 2013 19:18, Chad Kouse [chad....@gmail.com](mailto:chad....@gmail.com) wrote:
> > > > 
> > > > > Issue has returned -- it may be related to increased traffic (both new  
> > > > > documents coming in and increased searches)
> > > > > 
> > > > > On Monday, June 3, 2013 5:44:02 PM UTC-4, Chad Kouse wrote:
> > > > > 
> > > > > > fwiw we upgraded to 0.90.1 today and haven't seen the issue yet..  
> > > > > > I'll give it a few more days and report back.
> > > > > > 
> > > > > > On Saturday, May 25, 2013 2:32:23 AM UTC-4, Clinton Gormley wrote:
> > > > > > 
> > > > > > > What you are describing should work, but parent-child can be tricky  
> > > > > > > at times. I would suggest pasting the actual curl commands that get issues  
> > > > > > > to (1) create the original post and (2) add a comment. Note: actual curl  
> > > > > > > commands, as opposed to what you think it should be doing - the two may not  
> > > > > > > be the same. Plus the mapping for your index.
> > > > > > > 
> > > > > > > clint
> > > > > > > 
> > > > > > > On 24 May 2013 22:36, Chad Kouse [chad....@gmail.com](mailto:chad....@gmail.com) wrote:
> > > > > > > 
> > > > > > > > I reduced our cluster from 3 nodes to 2 and it seems like this  
> > > > > > > > issue has gone away. -- So the bug must be dependent on the number of nodes.
> > > > > > > > 
> > > > > > > > I am using the default 5 shards & 1 replica
> > > > > > > > 
> > > > > > > > On Friday, May 24, 2013 10:01:26 AM UTC-4, Chad Kouse wrote:
> > > > > > > > 
> > > > > > > > > No I'm not specifying a routing value and they don't have  
> > > > > > > > > grandparents. However I may index the same document more than once (with  
> > > > > > > > > the same id)
> > > > > > > > > 
> > > > > > > > > This is the scenario: a user creates a document and it gets  
> > > > > > > > > indexed. Another user makes a comment on this document and the comment and  
> > > > > > > > > the original document(again) get indexed--the comment is given the document  
> > > > > > > > > id as its parent. The document would have the same id it originally had so  
> > > > > > > > > i assume this is ok and it would just replace what was already there. this  
> > > > > > > > > is sort of a fail safe (basically whenever the document changes or has a  
> > > > > > > > > new comment added we reindex the document and all of its comments for  
> > > > > > > > > safety)
> > > > > > > > > 
> > > > > > > > > —  
> > > > > > > > > chad
> > > > > > > > > 
> > > > > > > > > On Fri, May 24, 2013 at 6:25 AM, Clinton Gormley wrote:
> > > > > > > > > 
> > > > > > > > > > Chad, when you index your parent or child docs, are you  
> > > > > > > > > > specifying a routing value? Do you child docs have grandparents?
> > > > > > > > > > 
> > > > > > > > > > clint
> > > > > > > > > > 
> > > > > > > > > > --  
> > > > > > > > > > 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/\*\*to\*\*\*\*pic/elasticsearch/](https://groups.google.com/d/ **to**** pic/elasticsearch/)\*\*  
> > > > > > > > > > SQaQ7QcmcKQ/\*\***unsubscribe?hl=en-US[https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/SQaQ7QcmcKQ/unsubscribe?hl=en-US)  
> > > > > > > > > > .  
> > > > > > > > > > To unsubscribe from this group and all its topics, send an email t  
> > > > > > > > > > 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 the Google  
> > > > > > > > > Groups "elasticsearch" group.  
> > > > > > > > > To unsubscribe from this group and stop receiving emails from it,  
> > > > > > > > > send an email to elasticsearc...@googlegroups. **c** om.  
> > > > > > > > > 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 the Google  
> > > > > > > Groups "elasticsearch" group.  
> > > > > > > To unsubscribe from this group and stop receiving emails from it, 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)  
> > > > > > > .
> > > > 
> > > > --  
> > > > Met vriendelijke groet,
> > > > 
> > > > Martijn van Groningen
> > 
> > --  
> > Met vriendelijke groet,
> > 
> > Martijn van Groningen
> 
> --  
> Met vriendelijke groet,
> 
> Martijn van Groningen

--  
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:32am UTC](https://discuss.elastic.co/t/older-versions-of-parent-document-returned-in-has-child-query-for-parent-child-setup/10342/17 "2017-07-06T02:32:33Z")

</div>


