Timeout on search


(Vik) #1

I am looking to specify a timeout on the search as per the api spec at

http://www.elasticsearch.org/guide/reference/api/search/request-body.html

timeout "A search timeout, bounding the search request to be executed
within the specified time value and bail with the hits accumulated up to
that point when expired. Defaults to no timeout."

So i am assuming this is just a matter of appending the "timeout" param to
the elastic search url?

http://localhost:9200/{indexname}/_search?timeout=5

the spec does not specify what the parameter signifies as in is it
milliseconds/seconds os how does this need to be specified?


(Ivan Brusic) #2

Looking at the source code, the timeout value should be in milliseconds:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java#L201
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/common/unit/TimeValue.java#L228

--
Ivan

On Thu, Jul 5, 2012 at 8:48 AM, Vik vmnadig@gmail.com wrote:

I am looking to specify a timeout on the search as per the api spec at

http://www.elasticsearch.org/guide/reference/api/search/request-body.html

timeout "A search timeout, bounding the search request to be executed within
the specified time value and bail with the hits accumulated up to that point
when expired. Defaults to no timeout."

So i am assuming this is just a matter of appending the "timeout" param to
the elastic search url?

http://localhost:9200/{indexname}/_search?timeout=5

the spec does not specify what the parameter signifies as in is it
milliseconds/seconds os how does this need to be specified?


(José de Zárate) #3

Ok, I've tried it just like Vik said, and got no luck so far:

curl -XGET 'http://localhost:9200/book_store/_search?timeout=40ms&pretty=1'
-d '
{
"query": {
"fuzzy": {
"_all": "dostoyefsk"
}
}
}'

got the answer

{
"took" : 496,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},...

The answer takes about 500ms, and it doesn't seem to care I specified
"50ms" for the timeout.
Is this because of the "fuzzy" search? Or is it because the specified
timeout is way too small?

txs

On Thursday, July 5, 2012 12:12:05 PM UTC-4, Ivan Brusic wrote:

Looking at the source code, the timeout value should be in milliseconds:

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java#L201

https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/common/unit/TimeValue.java#L228

--
Ivan

On Thu, Jul 5, 2012 at 8:48 AM, Vik wrote:

I am looking to specify a timeout on the search as per the api spec at

http://www.elasticsearch.org/guide/reference/api/search/request-body.html

timeout "A search timeout, bounding the search request to be executed
within
the specified time value and bail with the hits accumulated up to that
point
when expired. Defaults to no timeout."

So i am assuming this is just a matter of appending the "timeout" param
to
the elastic search url?

http://localhost:9200/{indexname}/_search?timeout=5

the spec does not specify what the parameter signifies as in is it
milliseconds/seconds os how does this need to be specified?


(Purva Kulkarni) #4

I am facing the same issue and wondering if you figured out the reason or solution for this issue.


(system) #5