# Performance on query with nested objects

**URL:** <https://discuss.elastic.co/t/performance-on-query-with-nested-objects/181792>\
**Category:** Elasticsearch\
**Created:** [May 20, 2019, 10:31am UTC](https://discuss.elastic.co/t/performance-on-query-with-nested-objects/181792 "2019-05-20T10:31:51Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 20, 2019, 3:08pm UTC](https://discuss.elastic.co/t/performance-on-query-with-nested-objects/181792/5 "2019-05-20T15:08:17Z")

</div>

> [@joel.ortin](#):
>
> I've tried to remove the source and add the store fields, and of course, the query filtering by retailer.id improved a lot.

Great. So we prove that ready a BIG document from disk is costing more than reading a smaller one.

> [@joel.ortin](#):
>
> But when filtering by the store.area with a geo\_shape query it takes 229 ms to process, with the 6200 nested objects.

That's a different question. The previous question was related to "how much it costs to read a doc from disk to generate the response for the 10 hits that we need to retrieve".  
The new question is more about "the response time when searching with a `term` query vs with a `geo_shape` query.

That's like comparing oranges and apples to me. There is a price to pay to make that kind of filtering, whatever the size of the fields you will need to read after having been able to select 10 of them.

> Is there any way to return the fields from an `inner_hit` that is not from `_source`

I don't know. I don't think so. The only thing I can see but that will probably not answer to your needs, is to use a `copy_to` option in the nested object to copy values to the parent object in a stored field. But as a result you won't get only the internal match.

That could be better to provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

---

_[View the full topic](https://discuss.elastic.co/t/performance-on-query-with-nested-objects/181792)._
