# 'took' field on the ES response

**URL:** <https://discuss.elastic.co/t/took-field-on-the-es-response/127147>\
**Category:** Elasticsearch\
**Created:** [April 6, 2018, 11:31pm UTC](https://discuss.elastic.co/t/took-field-on-the-es-response/127147 "2018-04-06T23:31:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yiliang](https://avatars.discourse-cdn.com/v4/letter/y/a87d85/32.png) [@yiliang](https://discuss.elastic.co/u/yiliang)\
**Post date:** [April 6, 2018, 11:31pm UTC](https://discuss.elastic.co/t/took-field-on-the-es-response/127147/1 "2018-04-06T23:31:22Z")

</div>

Hi,  
I have a question on the 'took' filed from ES response. I run a profile request to one specific index And get following response(partial).

{  
"took": 944,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"skipped": 0,  
"failed": 0  
},  
"hits": {.... },  
"profile": {  
"shards": [  
{  
"id": "[-xxx][xxx][0]",  
"searches": [  
{  
"query": [  
{  
"type": "BooleanQuery",  
"description": "",  
"time": "1048.008013ms",  
"time\_in\_nanos": 1048008013,  
"breakdown": {  
"score": 271966,  
"build\_scorer\_count": 10,  
"match\_count": 477947,  
"create\_weight": 171001,  
"next\_doc": 660148889,  
"match": 386081410,  
"create\_weight\_count": 1,  
"next\_doc\_count": 477991,  
"score\_count": 2278,  
"build\_scorer": 376520,  
"advance": 0,  
"advance\_count": 0  
},  
"children": []  
....  
},

You can see that time on one shard is 1048.008013ms, but the overall 'took' field only takes 944ms.  
I just wonder this 'took' filed is not so accurate. It should larger then time spent on one shard.

Thanks

---

<div class="post-metadata">

**Author:** ![yiliang](https://avatars.discourse-cdn.com/v4/letter/y/a87d85/32.png) [@yiliang](https://discuss.elastic.co/u/yiliang)\
**Post date:** [April 9, 2018, 5:19pm UTC](https://discuss.elastic.co/t/took-field-on-the-es-response/127147/2 "2018-04-09T17:19:21Z")

</div>

@Igor_Motov, Sorry to ping you, but I saw you reply similar message. Could you help to take a look at above topic. I just wonder why the processing time on one shard larger than the time on 'took' field, which might be the processing time for whole index. Thanks

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [April 9, 2018, 6:31pm UTC](https://discuss.elastic.co/t/took-field-on-the-es-response/127147/3 "2018-04-09T18:31:12Z")

</div>

Hi @yiliang. I'm not entirely sure what's going on here, but I suspect it's a caching issue. Unfortunately, profiled queries are eligible for request caching. So the first time you try to profile, it takes a long time and the response is cached. The second time you profile, the response is served from the cache which gives a small(er) `took` time... but the profile response itself is from before when it was slower.

It's a bug... we shouldn't let profiled queries enter the cache. You can fix this issue by clearing the cache manually before running the profile.

There's an issue on github tracking this, if you want to watch it: [https://github.com/elastic/elasticsearch/issues/29024](https://github.com/elastic/elasticsearch/issues/29024)

---

<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:** [May 7, 2018, 6:31pm UTC](https://discuss.elastic.co/t/took-field-on-the-es-response/127147/4 "2018-05-07T18:31:14Z")

</div>

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