# How to get query time?

**URL:** <https://discuss.elastic.co/t/how-to-get-query-time/4472>\
**Category:** Elasticsearch\
**Created:** [May 25, 2011, 9:02am UTC](https://discuss.elastic.co/t/how-to-get-query-time/4472 "2011-05-25T09:02:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maho](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@maho](https://discuss.elastic.co/u/maho)\
**Post date:** [May 25, 2011, 9:02am UTC](https://discuss.elastic.co/t/how-to-get-query-time/4472/1 "2011-05-25T09:02:23Z")

</div>

Hi,

is it possible to get the query time for searching and indexing?

One year ago it was discussed: In  
[http://elasticsearch-users.115913.n3.nabble.com/Elapsed-query-time-td428663.html](http://elasticsearch-users.115913.n3.nabble.com/Elapsed-query-time-td428663.html)

---

<div class="post-metadata">

**Author:** ![maho](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@maho](https://discuss.elastic.co/u/maho)\
**Post date:** [May 25, 2011, 9:24am UTC](https://discuss.elastic.co/t/how-to-get-query-time/4472/2 "2011-05-25T09:24:18Z")

</div>

I have just seen that BulkResponse has a getTookInMillis-Method.  
So I'll use BulkResponse instead of IndexResponse.

Maybe it will be better to provide the getTookInMillis-Method in every  
Response-Class.

On 25 Mai, 11:02, maho [mathias.hod...@gmail.com](mailto:mathias.hod...@gmail.com) wrote:

> Hi,
> 
> is it possible to get the query time for searching and indexing?
> 
> One year ago it was discussed: Inhttp://elasticsearch-users.115913.n3.nabble.com/Elapsed-query-time-td...

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [May 25, 2011, 10:04am UTC](https://discuss.elastic.co/t/how-to-get-query-time/4472/3 "2011-05-25T10:04:12Z")

</div>

Hi,

you get millis in search response. As for the indexing operations I can not  
speak for Shay but I think you have to keep in mind that when you get the  
response back it does not have to mean that the operation itself has been  
propagated to all shard replicas in the cluster (you can opt between sync  
and async operations per request). So it depends what specifically you are  
after.

just my 2cents  
Lukas

On Wed, May 25, 2011 at 11:24 AM, maho [mathias.hodler@gmail.com](mailto:mathias.hodler@gmail.com) wrote:

> I have just seen that BulkResponse has a getTookInMillis-Method.  
> So I'll use BulkResponse instead of IndexResponse.
> 
> Maybe it will be better to provide the getTookInMillis-Method in every  
> Response-Class.
> 
> On 25 Mai, 11:02, maho [mathias.hod...@gmail.com](mailto:mathias.hod...@gmail.com) wrote:
> 
> > Hi,
> > 
> > is it possible to get the query time for searching and indexing?
> > 
> > One year ago it was discussed: Inhttp://  
> > [elasticsearch-users.115913.n3.nabble.com/Elapsed-query-time-td](http://elasticsearch-users.115913.n3.nabble.com/Elapsed-query-time-td)...

---

<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:** [May 25, 2011, 1:25pm UTC](https://discuss.elastic.co/t/how-to-get-query-time/4472/4 "2011-05-25T13:25:16Z")

</div>

Search already has it. Index operation is something that you need to track, I don't see a reason why you would really need in typical operations, and adding the overhead does not seem reasonable (to me :), open to other people opinions).

Replication is, by default, sync.  
On Wednesday, May 25, 2011 at 1:04 PM, LukÃ¡Å¡ VlÄek wrote:  
Hi,

> you get millis in search response. As for the indexing operations I can not speak for Shay but I think you have to keep in mind that when you get the response back it does not have to mean that the operation itself has been propagated to all shard replicas in the cluster (you can opt between sync and async operations per request). So it depends what specifically you are after.
> 
> just my 2cents  
> Lukas
> 
> On Wed, May 25, 2011 at 11:24 AM, maho [mathias.hodler@gmail.com](mailto:mathias.hodler@gmail.com) wrote:
> 
> > I have just seen that BulkResponse has a getTookInMillis-Method.  
> > So I'll use BulkResponse instead of IndexResponse.
> > 
> > Maybe it will be better to provide the getTookInMillis-Method in every  
> > Response-Class.
> > 
> > On 25 Mai, 11:02, maho [mathias.hod...@gmail.com](mailto:mathias.hod...@gmail.com) wrote:
> > 
> > > Hi,
> > > 
> > > is it possible to get the query time for searching and indexing?
> > > 
> > > One year ago it was discussed: Inhttp://elasticsearch-users.115913.n3.nabble.com/Elapsed-query-time-td...

---

<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, 4:05am UTC](https://discuss.elastic.co/t/how-to-get-query-time/4472/5 "2017-07-06T04:05:22Z")

</div>


