Having problem retrieving child documents with their IDs

I have an index with a parent type and a child type. The parent type gets
stored just fine and I haven't seen any issues searching or retrieving it
using it's ID. However I've just noticed some issues with SOME, not all, of
the child type documents.

http://localhost:9200/sample_index/sample_child_type/_search

Shows all the children as expected:

{"took": 5,"timed_out": false,"_shards": {"total": 5,"successful": 5,"failed
": 0},"hits": {"total": 28,"max_score": 11.905941,"hits": [{"_index": "
sample_index","_type": "sample_child_type","_id": "FfuRaL-WRWWutdglmV3gBg","
_score": 11.905941,"_source": {}},{"_index": "sample_index","_type": "
sample_child_type","_id": "ZoofwbnwQuKnJiElwsIVoA","_score": 11.905941,"
_source": {}}

The problem can be shown with the top two results given back. They both are
children with different parents.

If I go directly to the first child ID I get the data back:

http://localhost:9200/sample_index/sample_child_type/FfuRaL-WRWWutdglmV3gBg

{"_index": "sample_index","_type": "sample_child_type","_id": "
FfuRaL-WRWWutdglmV3gBg","_version": 1,"exists": true,"_source": {}}
But if I go directly to the second child ID, it says it doesn't exist:

http://localhost:9200/sample_index/sample_child_type/ZoofwbnwQuKnJiElwsIVoA

{"_index": "sample_index","_type": "sample_child_type","_id": "
ZoofwbnwQuKnJiElwsIVoA","exists": false}

Weirdly searching for the _id shows the result:

http://localhost:9200/sample_index/sample_child_type/_search?q=_id:ZoofwbnwQuKnJiElwsIVoA

{"took": 7,"timed_out": false,"_shards": {"total": 5,"successful": 5,"failed
": 0},"hits": {"total": 1,"max_score": 1,"hits": [{"_index": "sample_index",
"_type": "sample_child_type","_id": "ZoofwbnwQuKnJiElwsIVoA","_score": 1,"
_source": {}}]}}
And requesting the _parent field shows that it is definitely a child
document:

http://localhost:9200/sample_index/sample_child_type/_search?q=_id:ZoofwbnwQuKnJiElwsIVoA&fields=_parent

{"took": 2,"timed_out": false,"_shards": {"total": 5,"successful": 5,"failed
": 0},"hits": {"total": 1,"max_score": 1,"hits": [{"_index": "sample_index",
"_type": "sample_child_type","_id": "ZoofwbnwQuKnJiElwsIVoA","_score": 1,"
fields": {"_parent": "e15996a6d791742af47477d594c36cdb"}}]}}

The parent with that ID does exist, just in case that matters.

Does anyone know what's going wrong here, or even know where it could be
going wrong?

Thanks in advance.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

On Mon, 2013-03-11 at 09:15 -0700, Paul W wrote:

I have an index with a parent type and a child type. The parent type
gets stored just fine and I haven't seen any issues searching or
retrieving it using it's ID. However I've just noticed some issues
with SOME, not all, of the child type documents.

You need to specify the parent ID when you GET the child. The parent ID
determines which shard the child is on. If you don't specify the parent
ID, then is uses the child ID, which will be wrong 80% of the time
(assuming 5 primary shards)

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.
For more options, visit https://groups.google.com/groups/opt_out.