# Nested types are slower?

**URL:** <https://discuss.elastic.co/t/nested-types-are-slower/90546>\
**Category:** Elasticsearch\
**Created:** [June 22, 2017, 9:46pm UTC](https://discuss.elastic.co/t/nested-types-are-slower/90546 "2017-06-22T21:46:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![diego.bernardes](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@diego.bernardes](https://discuss.elastic.co/u/diego.bernardes)\
**Post date:** [June 22, 2017, 9:46pm UTC](https://discuss.elastic.co/t/nested-types-are-slower/90546/1 "2017-06-22T21:46:04Z")

</div>

[https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-objects.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/nested-objects.html)  
Not only that, because of the way that nested objects are indexed, **joining the nested documents to the root document at query time is fast—almost as fast as if they were a single document**.

[https://www.elastic.co/guide/en/elasticsearch/reference/master/tune-for-search-speed.html](https://www.elastic.co/guide/en/elasticsearch/reference/master/tune-for-search-speed.html)  
In particular, joins should be avoided. **nested can make queries several times slower and parent-child relations can make queries hundreds of times slower**. So if the same questions can be answered without joins by denormalizing documents, significant speedups can be expected.

I found this 2 references of nested objects on Elastic documentation, but don't know what which one is true.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 23, 2017, 7:02am UTC](https://discuss.elastic.co/t/nested-types-are-slower/90546/2 "2017-06-23T07:02:12Z")

</div>

When there are complaints about nested it is normally because of the inefficiency of updates if they require frequent change or the volume of Lucene docs created if there are many nested objects.  
Speed of query is not normally a complaint.

---

<div class="post-metadata">

**Author:** ![diego.bernardes](https://avatars.discourse-cdn.com/v4/letter/d/a88e4f/32.png) [@diego.bernardes](https://discuss.elastic.co/u/diego.bernardes)\
**Post date:** [June 23, 2017, 4:17pm UTC](https://discuss.elastic.co/t/nested-types-are-slower/90546/3 "2017-06-23T16:17:56Z")

</div>

Ok, i'm trying everything to make our query faster. The index isn't really a problem, the problem is the query time. Gonna look more to find the solution.

Thanks!

---

<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 21, 2017, 4:18pm UTC](https://discuss.elastic.co/t/nested-types-are-slower/90546/4 "2017-07-21T16:18:00Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
