# Problem with reindexing grand children documents

**URL:** <https://discuss.elastic.co/t/problem-with-reindexing-grand-children-documents/40423>\
**Category:** Elasticsearch\
**Created:** [January 28, 2016, 11:11pm UTC](https://discuss.elastic.co/t/problem-with-reindexing-grand-children-documents/40423 "2016-01-28T23:11:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![photonic\_world\_2](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@photonic\_world\_2](https://discuss.elastic.co/u/photonic_world_2)\
**Post date:** [January 28, 2016, 11:11pm UTC](https://discuss.elastic.co/t/problem-with-reindexing-grand-children-documents/40423/1 "2016-01-28T23:11:06Z")

</div>

I have a 3 tiers of documents arranged as parent(A)-child(B)-grandchild(C).

This is done specifically, since the data on the child and grandchild keep adding up (and are never updated) and to make querying easier. This works perfectly fine.

Now the problem is:

- I want to Re-index all three types of documents because I have realized the mappings could be more efficient.
- I can reindex parent without any problem
- I can reindex child since I have reference to parent id in the child document. I can use this to pass as argument for `parent=<parent-id>` while indexing.
- **The problem is with re-indexing child document (C)**, I will have to specify both parent Id of **B** and routing parameter as ID of **A** `parent=<B-id>&routing=<A-id>`. Since I only have reference to its parent id (B). I am looking for a way get ID of **A** to avoid fetching its parent (B) to reindex (C)

Any ideas? Any way I can fetch routing value of a document in C so that I can reuse it to re-index?

---

<div class="post-metadata">

**Author:** ![photonic\_world\_2](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@photonic\_world\_2](https://discuss.elastic.co/u/photonic_world_2)\
**Post date:** [January 28, 2016, 11:20pm UTC](https://discuss.elastic.co/t/problem-with-reindexing-grand-children-documents/40423/2 "2016-01-28T23:20:46Z")

</div>

Found a way to do that.

Could get the fields by querying for \_parent  
GET /index/type/\_search  
{  
"fields": [  
"\_parent","\_routing"  
],  
"\_source":{  
"include":["\*"]  
},  
"query": {  
"match\_all": {}  
}  
}

The above will fetch you parent id, routing id and the source.

---

<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 5, 2017, 11:20pm UTC](https://discuss.elastic.co/t/problem-with-reindexing-grand-children-documents/40423/3 "2017-07-05T23:20:37Z")

</div>

Closed on July 5, 2017, 11:20pm UTC


