# Understanding search response

**URL:** <https://discuss.elastic.co/t/understanding-search-response/14479>\
**Category:** Elasticsearch\
**Created:** [November 20, 2013, 12:46am UTC](https://discuss.elastic.co/t/understanding-search-response/14479 "2013-11-20T00:46:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohit\_Anchlia](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@Mohit\_Anchlia](https://discuss.elastic.co/u/Mohit_Anchlia)\
**Post date:** [November 20, 2013, 12:46am UTC](https://discuss.elastic.co/t/understanding-search-response/14479/1 "2013-11-20T00:46:54Z")

</div>

I am writing perf tool to load test elasticsearch. I have both index and  
search working properly. I noticed that when I query for a term I get the  
response in pretty decent time considering I just have 1 shard with 200M  
docs in it. However, when I set size to 1000 it takes around 10 secs. In  
both cases when I use "size" or not I still get same number of hits.total  
value, which means it is searching through entire shard. Does it mean that  
the extra time, when size is set to 1000, is coming from the fact that it  
has to fetch the source of the document? In other words time to do just  
"search" is always the same for that specific term in both cases?

{

- took: 2671
- timed\_out: false
- \_shards: {
  - total: 3
  - successful: 3
  - failed: 0  
}

- hits: {
  - total: 3047482
  - max\_score: 2.6712089
  - hits: [
    - {
      - \_index: test
      - \_type: test
      - \_id: 81CGcKoHRdCozyo1MRObGg
      - \_score: 2.6712089
      - \_source: {
        - title: Wikipedia: Lynedoch railway station  
}  
}

    - {
      - \_index: test

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [November 20, 2013, 12:40pm UTC](https://discuss.elastic.co/t/understanding-search-response/14479/2 "2013-11-20T12:40:01Z")

</div>

Hi,  
queries are always executed against the relevant shards. Every shard  
returns "size" documents, thus a reduce is needed to resort and return only  
the top "size" documents. With a single shard the reduce is not needed  
though, which means that the additional time is spent on loading the lucene  
fields that need to be returned from disk (\_source by default). From your  
search response I see 3 shards though, not just one.

On Wednesday, November 20, 2013 1:46:54 AM UTC+1, Mo wrote:

> I am writing perf tool to load test elasticsearch. I have both index and  
> search working properly. I noticed that when I query for a term I get the  
> response in pretty decent time considering I just have 1 shard with 200M  
> docs in it. However, when I set size to 1000 it takes around 10 secs. In  
> both cases when I use "size" or not I still get same number of hits.total  
> value, which means it is searching through entire shard. Does it mean that  
> the extra time, when size is set to 1000, is coming from the fact that it  
> has to fetch the source of the document? In other words time to do just  
> "search" is always the same for that specific term in both cases?
> 
> {
> 
> - took: 2671
> - timed\_out: false
> - \_shards: {
> - total: 3
> - successful: 3
> - failed: 0  
> }
> 
> - hits: {
> - total: 3047482
> - max\_score: 2.6712089
> - hits: [
> - {
> - \_index: test
> - \_type: test
> - \_id: 81CGcKoHRdCozyo1MRObGg
> - \_score: 2.6712089
> - \_source: {
> - title: Wikipedia: Lynedoch railway station  
> }  
> }
> 
> - {
> - \_index: test

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:05am UTC](https://discuss.elastic.co/t/understanding-search-response/14479/3 "2017-07-06T02:05:58Z")

</div>


