# Took vs profile API time\_in\_nanos

**URL:** <https://discuss.elastic.co/t/took-vs-profile-api-time-in-nanos/144938>\
**Category:** Elasticsearch\
**Created:** [August 17, 2018, 5:26pm UTC](https://discuss.elastic.co/t/took-vs-profile-api-time-in-nanos/144938 "2018-08-17T17:26:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![123](https://avatars.discourse-cdn.com/v4/letter/1/7feea3/32.png) [@123](https://discuss.elastic.co/u/123)\
**Post date:** [August 17, 2018, 5:26pm UTC](https://discuss.elastic.co/t/took-vs-profile-api-time-in-nanos/144938/1 "2018-08-17T17:26:26Z")

</div>

I have a query that I run and it says:  
{  
"took": 1  
...  
}

And then when I tack on "profile": true

It shows me the top-level query (which is inclusive of all children from what I read) has a response of:  
{  
"time": "6.6ms",  
"time\_in\_nanos": 6610556  
...  
}

What's the difference and why does profile say my query takes longer, but took says shorter?

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [August 24, 2018, 10:57am UTC](https://discuss.elastic.co/t/took-vs-profile-api-time-in-nanos/144938/2 "2018-08-24T10:57:19Z")

</div>

Hi,

in the [docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-profile.html) we state:

> The Profile API is a debugging tool and adds significant overhead to search execution.

So the difference is likely caused by the profile API itself.

Daniel

---

<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:** [August 24, 2018, 1:26pm UTC](https://discuss.elastic.co/t/took-vs-profile-api-time-in-nanos/144938/3 "2018-08-24T13:26:45Z")

</div>

Yep, @danielmitterdorfer is exactly correct. Profiling adds a fair amount of overhead, so all profiling results should be considered relative (e.g. the different parts in the query relative to each other), not absolute times.

---

<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:** [September 21, 2018, 1:26pm UTC](https://discuss.elastic.co/t/took-vs-profile-api-time-in-nanos/144938/4 "2018-09-21T13:26:45Z")

</div>

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