Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to kill the thread of searching request on elasticsearch cluster? Is there some API to do this?

I made a elasticsearch cluster with big data, and the client can send searching request to it. Sometimes, the cluster costs much time to deal with one request. My question is, is there any API to kill the specified thread which cost too much time?

like image 984
Hoony Avatar asked Feb 21 '13 05:02

Hoony


2 Answers

I wanted to follow up on this answer now that elasticsearch 1.0.0 has been released. I am happy to announce that there is new functionality that has been introduced that implements some protection for the heap, called the circuit breaker.

With the current implementation, the circuit breaker tries to anticipate how much data is going to be loaded into the field data cache, and if it's greater than the limit (80% by default) it will trip the circuit breaker and there by kill your query.

There are two parameters for you to set if you want to modify them:

indices.fielddata.breaker.limit

indices.fielddata.breaker.overhead

The overhead is the constant that is used to estimate how much data will be loaded into the field cache; this is 1.03 by default.

This is an exciting development to elasticsearch and a feature I have been waiting to be implemented for months.

This is the pull request if interested in seeing how it was made; thanks to dakrone for getting this done!

https://github.com/elasticsearch/elasticsearch/pull/4261

Hope this helps, MatthewJ

like image 148
MatthewJ Avatar answered Sep 21 '22 18:09

MatthewJ


Currently it is not possible to kill or stop the long running queries, But Elasticsearch is going to add a task management api to do this. The API is likely to be added in Elasticsearch 5.0, maybe in 2016 or later.

see Task management 1 and Task management 2.

like image 24
Gary Gauh Avatar answered Sep 21 '22 18:09

Gary Gauh