# Is the test result correct for query performance of saving document source is much better than not saving document source?

**URL:** <https://discuss.elastic.co/t/is-the-test-result-correct-for-query-performance-of-saving-document-source-is-much-better-than-not-saving-document-source/7906>\
**Category:** Elasticsearch\
**Created:** [May 30, 2012, 7:27am UTC](https://discuss.elastic.co/t/is-the-test-result-correct-for-query-performance-of-saving-document-source-is-much-better-than-not-saving-document-source/7906 "2012-05-30T07:27:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dong\_Aihua](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dong_aihua/32/2413_2.png) [@Dong\_Aihua](https://discuss.elastic.co/u/Dong_Aihua)\
**Post date:** [May 30, 2012, 7:27am UTC](https://discuss.elastic.co/t/is-the-test-result-correct-for-query-performance-of-saving-document-source-is-much-better-than-not-saving-document-source/7906/1 "2012-05-30T07:27:26Z")

</div>

Hi,  
I setup two clusters. each cluster have two nodes(2 shards, 1 replica).  
One saves document source. Another one doesn't save. Both cluster already  
saves about 0.46 billion documents count.  
Through the test, I found query performance of saving document source is  
much better than not saving document source, almost twice. One is about  
1.5s response time, another is about 3s response time.  
I'm not sure this result is correct or not.  
Can anyone else help confirm it?  
Thank you very much!

-Regards-  
-Jackie-

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [May 30, 2012, 8:48am UTC](https://discuss.elastic.co/t/is-the-test-result-correct-for-query-performance-of-saving-document-source-is-much-better-than-not-saving-document-source/7906/2 "2012-05-30T08:48:22Z")

</div>

On Wed, 2012-05-30 at 00:27 -0700, jackiedong wrote:

> Hi,  
> I setup two clusters. each cluster have two nodes(2 shards, 1  
> replica). One saves document source. Another one doesn't save. Both  
> cluster already saves about 0.46 billion documents count.  
> Through the test, I found query performance of saving document  
> source is much better than not saving document source, almost twice.  
> One is about 1.5s response time, another is about 3s response time.

You don't provide your queries, so it is difficult to say. In the query  
on the cluster that doesn't have \_source enabled, are you requesting  
stored fields? If so, then factor in 5ms disk seek per field. With  
\_source enabled, you get your whole doc back with a single disk seek.

clint

> I'm not sure this result is correct or not.  
> Can anyone else help confirm it?  
> Thank you very much!
> 
> -Regards-  
> -Jackie-

---

<div class="post-metadata">

**Author:** ![Dong\_Aihua](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dong_aihua/32/2413_2.png) [@Dong\_Aihua](https://discuss.elastic.co/u/Dong_Aihua)\
**Post date:** [May 30, 2012, 9:33am UTC](https://discuss.elastic.co/t/is-the-test-result-correct-for-query-performance-of-saving-document-source-is-much-better-than-not-saving-document-source/7906/3 "2012-05-30T09:33:27Z")

</div>

Hi, Clinton:  
I use the default setting. That means no field is saved. Just save  
the whole document or don't save the whole document.  
The query is like this, plus some facets.  
{  
"size":10,  
"query":{"query\_string": {  
"default\_field" : "body",  
"query":  
"${errorbody} AND logType:${logtype} AND logTime:[2012-02-04T16:57:53 TO  
2012-04-04T16:58:23]"  
}}  
}

在 2012年5月30日星期三UTC+8下午4时48分22秒，Clinton Gormley写道：

> On Wed, 2012-05-30 at 00:27 -0700, jackiedong wrote:
> 
> > Hi,  
> > I setup two clusters. each cluster have two nodes(2 shards, 1  
> > replica). One saves document source. Another one doesn't save. Both  
> > cluster already saves about 0.46 billion documents count.  
> > Through the test, I found query performance of saving document  
> > source is much better than not saving document source, almost twice.  
> > One is about 1.5s response time, another is about 3s response time.
> 
> You don't provide your queries, so it is difficult to say. In the query  
> on the cluster that doesn't have \_source enabled, are you requesting  
> stored fields? If so, then factor in 5ms disk seek per field. With  
> \_source enabled, you get your whole doc back with a single disk seek.
> 
> clint
> 
> > I'm not sure this result is correct or not.  
> > Can anyone else help confirm it?  
> > Thank you very much!
> > 
> > -Regards-  
> > -Jackie-

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [May 30, 2012, 10:06am UTC](https://discuss.elastic.co/t/is-the-test-result-correct-for-query-performance-of-saving-document-source-is-much-better-than-not-saving-document-source/7906/4 "2012-05-30T10:06:40Z")

</div>

On Wed, 2012-05-30 at 02:33 -0700, jackiedong wrote:

> Hi, Clinton:  
> I use the default setting. That means no field is saved. Just  
> save the whole document or don't save the whole document.  
> The query is like this, plus some facets.  
> {  
> "size":10,  
> "query":{"query\_string": {  
> "default\_field" : "body",  
> "query":  
> "${errorbody} AND logType:${logtype} AND logTime:[2012-02-04T16:57:53  
> TO 2012-04-04T16:58:23]"  
> }}  
> }

So all you're getting back is the index/type/id? No fields?

---

<div class="post-metadata">

**Author:** ![Dong\_Aihua](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dong_aihua/32/2413_2.png) [@Dong\_Aihua](https://discuss.elastic.co/u/Dong_Aihua)\
**Post date:** [May 31, 2012, 1:37am UTC](https://discuss.elastic.co/t/is-the-test-result-correct-for-query-performance-of-saving-document-source-is-much-better-than-not-saving-document-source/7906/5 "2012-05-31T01:37:38Z")

</div>

Yes, just id, no fields.

在 2012年5月30日星期三UTC+8下午6时06分40秒，Clinton Gormley写道：

> On Wed, 2012-05-30 at 02:33 -0700, jackiedong wrote:
> 
> > Hi, Clinton:  
> > I use the default setting. That means no field is saved. Just  
> > save the whole document or don't save the whole document.  
> > The query is like this, plus some facets.  
> > {  
> > "size":10,  
> > "query":{"query\_string": {  
> > "default\_field" : "body",  
> > "query":  
> > "${errorbody} AND logType:${logtype} AND logTime:[2012-02-04T16:57:53  
> > TO 2012-04-04T16:58:23]"  
> > }}  
> > }
> 
> So all you're getting back is the index/type/id? No fields?

---

<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:** [June 3, 2012, 9:19am UTC](https://discuss.elastic.co/t/is-the-test-result-correct-for-query-performance-of-saving-document-source-is-much-better-than-not-saving-document-source/7906/6 "2012-06-03T09:19:23Z")

</div>

Storing \_source will not speed up searches compared to not storing it. As  
clinton mentioned, usually the comparison is between storing \_source  
compared to either storing specific fields or then fetching the \_source  
from other datastorage, in which case, many times, storing \_source will be  
better.

On Thu, May 31, 2012 at 3:37 AM, jackiedong [jackiedong168@gmail.com](mailto:jackiedong168@gmail.com) wrote:

> Yes, just id, no fields.
> 
> 在 2012年5月30日星期三UTC+8下午6时06分40秒，Clinton Gormley写道：
> 
> > On Wed, 2012-05-30 at 02:33 -0700, jackiedong wrote:
> > 
> > > Hi, Clinton:  
> > > I use the default setting. That means no field is saved. Just  
> > > save the whole document or don't save the whole document.  
> > > The query is like this, plus some facets.  
> > > {  
> > > "size":10,  
> > > "query":{"query\_string": {  
> > > "default\_field" : "body",  
> > > "query":  
> > > "${errorbody} AND logType:${logtype} AND logTime:[2012-02-04T16:57:53  
> > > TO 2012-04-04T16:58:23]"  
> > > }}  
> > > }
> > 
> > So all you're getting back is the index/type/id? No fields?

---

<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:25am UTC](https://discuss.elastic.co/t/is-the-test-result-correct-for-query-performance-of-saving-document-source-is-much-better-than-not-saving-document-source/7906/7 "2017-07-06T03:25:53Z")

</div>


