# Nested objects and impact on performance of queries and filters

**URL:** <https://discuss.elastic.co/t/nested-objects-and-impact-on-performance-of-queries-and-filters/6491>\
**Category:** Elasticsearch\
**Created:** [January 25, 2012, 8:18am UTC](https://discuss.elastic.co/t/nested-objects-and-impact-on-performance-of-queries-and-filters/6491 "2012-01-25T08:18:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ittai\_Zeidman](https://avatars.discourse-cdn.com/v4/letter/i/838e76/32.png) [@Ittai\_Zeidman](https://discuss.elastic.co/u/Ittai_Zeidman)\
**Post date:** [January 25, 2012, 8:18am UTC](https://discuss.elastic.co/t/nested-objects-and-impact-on-performance-of-queries-and-filters/6491/1 "2012-01-25T08:18:44Z")

</div>

Hi,  
I have a java object which has a few primitive properties and a few  
references to othe types from my model. (example gist[https://gist.github.com/1675319](https://gist.github.com/1675319)  
)  
I'm using jackson to serialize/deserialize this object from ES (it's the  
only one that goes in as a type).  
The only properties I want from the referenced types is their "name"  
property.  
What I was able to do pretty easily in jackson (using @JsonFilter) is to  
have jackson output something along these lines:  
{ "name" : "testName" , "docProperty" : { "name" : "nameOfProperty" } , "multiDocProperties":[  
{"name" : "nameOfProperty2"} , {"name" : "nameOfProperty"} ] , "otherProperty"  
: "someValue" }  
What I want to know is if there's a difference, with respect to ES  
performance, between the above representation and somehow customizing  
jackson to output the names as values i.e.:  
{ "name" : "testName" , "docProperty" : "nameOfProperty" , "multiDocProperties":[ "nameOfProperty2"  
, "nameOfProperty" ] , "otherProperty" : "someValue" }

Thanks in advance

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 25, 2012, 4:35pm UTC](https://discuss.elastic.co/t/nested-objects-and-impact-on-performance-of-queries-and-filters/6491/2 "2012-01-25T16:35:05Z")

</div>

There isn't a difference between most of what you specified for the overhead of indexing, except for the size of the json (the first option is more verbose).

On Wednesday, January 25, 2012 at 10:18 AM, Ittai Zeidman wrote:

> Hi,  
> I have a java object which has a few primitive properties and a few references to othe types from my model. (example gist ([Example of the model for elasticsearch nested objects question (removed getters setters for clarity) · GitHub](https://gist.github.com/1675319)))  
> I'm using jackson to serialize/deserialize this object from ES (it's the only one that goes in as a type).  
> The only properties I want from the referenced types is their "name" property.  
> What I was able to do pretty easily in jackson (using @JsonFilter) is to have jackson output something along these lines:  
> { "name" : "testName" , "docProperty" : { "name" : "nameOfProperty" } , "multiDocProperties":[{"name" : "nameOfProperty2"} , {"name" : "nameOfProperty"}] , "otherProperty" : "someValue" }  
> What I want to know is if there's a difference, with respect to ES performance, between the above representation and somehow customizing jackson to output the names as values i.e.:  
> { "name" : "testName" , "docProperty" : "nameOfProperty" , "multiDocProperties":["nameOfProperty2" , "nameOfProperty"] , "otherProperty" : "someValue" }
> 
> Thanks in advance

---

<div class="post-metadata">

**Author:** ![Ittai\_Zeidman](https://avatars.discourse-cdn.com/v4/letter/i/838e76/32.png) [@Ittai\_Zeidman](https://discuss.elastic.co/u/Ittai_Zeidman)\
**Post date:** [January 25, 2012, 8:47pm UTC](https://discuss.elastic.co/t/nested-objects-and-impact-on-performance-of-queries-and-filters/6491/3 "2012-01-25T20:47:22Z")

</div>

Thanks a lot Shay,  
Glad that I can avoid that overhead.

ב-25 בינו 2012, בשעה 18:35, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) כתב/ה:

> There isn't a difference between most of what you specified for the overhead of indexing, except for the size of the json (the first option is more verbose).  
> On Wednesday, January 25, 2012 at 10:18 AM, Ittai Zeidman wrote:
> 
> > Hi,  
> > I have a java object which has a few primitive properties and a few references to othe types from my model. (example gist)  
> > I'm using jackson to serialize/deserialize this object from ES (it's the only one that goes in as a type).  
> > The only properties I want from the referenced types is their "name" property.  
> > What I was able to do pretty easily in jackson (using @JsonFilter) is to have jackson output something along these lines:  
> > { "name" : "testName" , "docProperty" : { "name" : "nameOfProperty" } , "multiDocProperties":[{"name" : "nameOfProperty2"} , {"name" : "nameOfProperty"}] , "otherProperty" : "someValue" }  
> > What I want to know is if there's a difference, with respect to ES performance, between the above representation and somehow customizing jackson to output the names as values i.e.:  
> > { "name" : "testName" , "docProperty" : "nameOfProperty" , "multiDocProperties":["nameOfProperty2" , "nameOfProperty"] , "otherProperty" : "someValue" }
> > 
> > Thanks in advance

---

<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, 3:41am UTC](https://discuss.elastic.co/t/nested-objects-and-impact-on-performance-of-queries-and-filters/6491/4 "2017-07-06T03:41:31Z")

</div>


