How timeout control work

I add timeout param in search body, then the response shows this query is timeout, took 233 ms. I'm wondering about whether the timeout control did work.

I Javadoc, it describes this param as a time limiter in searching:

/**
 * An optional timeout to control how long search is allowed to take.
 */
public SearchSourceBuilder timeout(TimeValue timeout) {
    this.timeout = timeout;
    return this;
}

If the timeout limit work, whether the response will something like following:

  "took" : 200,
  "timed_out" : true

I my mind, the took shows the actual time this searching spend. therefore, If the timeout param work, why took > timeout is allowed?

took is measured when the request comes into the coordinating node, where the timeout value is only applicable for search, not for the fetch phase for example. So there are some additional tasks that are not the pure search, that are done as well.

hope that helps!

1 Like

Thanks!

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