I am trying to understand the ES timeout and found different resources which talked about different things.
Timeout param in query String
As per this ES doc:
The timeout parameter tells shards how long they are allowed to process data before returning a response to the coordinating node. If there was not enough time to process all data, results for this shard will be partial, even possibly empty.
And in case of timeout, ES response metadata timed_out
would be true, also it would list the no of failed shards, But when I specify this timeout to a ver low value like 5ms
or 2ms
in my query string param for a match_all
query on big index , Sometime
- My response have this very rare
timed_out
true and number of failed shards are always 0. took
in my response is always very high than the timeout but still most of my response containstimed_out
false.
Both of these contradicts to what is mentioned in ES docs.
Timeout param in search JSON
I also tried to give the timeout
param as part of search JSON mentioned in this, but observed the same points mentioned earlier, so are these both same or they are different and meant for different use case?
PS: Below ES point from same article, is what I am unable to digest, and are my observations due to below fact?
Because the time is once per document, a very long query can execute on a single document and it won’t timeout until the next document is evaluated. This also means poorly written scripts (e.g. ones with infinite loops) will be allowed to execute forever.