# Long running queries

**URL:** <https://discuss.elastic.co/t/long-running-queries/6245>\
**Category:** Elasticsearch\
**Created:** [December 28, 2011, 6:18am UTC](https://discuss.elastic.co/t/long-running-queries/6245 "2011-12-28T06:18:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oren\_Mazor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oren_mazor/32/2903_2.png) [@Oren\_Mazor](https://discuss.elastic.co/u/Oren_Mazor)\
**Post date:** [December 28, 2011, 6:18am UTC](https://discuss.elastic.co/t/long-running-queries/6245/1 "2011-12-28T06:18:28Z")

</div>

Is there any way for me to kill a long running query?

while exploring various mapping types, on several occasions I've  
attempted to sort a few thousand records, and this resulted in a query  
the appears to run forever.

is there any way to see what ES is doing and/or to kill those actions  
without having to kill the ES process?

thanks  
Oren

---

<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:** [December 28, 2011, 10:35am UTC](https://discuss.elastic.co/t/long-running-queries/6245/2 "2011-12-28T10:35:56Z")

</div>

No, there isn't an option to stop a query that is executing. One of the  
possible reasons why a query with sort takes a long time for the first time  
is because it needs to load the values to be sorted to memory (and check  
the logs to see if there are no failures doing that).

On Wed, Dec 28, 2011 at 8:18 AM, Oren Mazor [oren.mazor@gmail.com](mailto:oren.mazor@gmail.com) wrote:

> Is there any way for me to kill a long running query?
> 
> while exploring various mapping types, on several occasions I've  
> attempted to sort a few thousand records, and this resulted in a query  
> the appears to run forever.
> 
> is there any way to see what ES is doing and/or to kill those actions  
> without having to kill the ES process?
> 
> thanks  
> Oren

---

<div class="post-metadata">

**Author:** ![Oren\_Mazor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oren_mazor/32/2903_2.png) [@Oren\_Mazor](https://discuss.elastic.co/u/Oren_Mazor)\
**Post date:** [December 28, 2011, 2:57pm UTC](https://discuss.elastic.co/t/long-running-queries/6245/3 "2011-12-28T14:57:54Z")

</div>

Got it. so really my only option is to kill ES, when it's become  
completely unresponsive after running a query for 10 hours.

is there a safe way to do that? or do I just kill/restart the process?

On Dec 28, 5:35 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> No, there isn't an option to stop a query that is executing. One of the  
> possible reasons why a query with sort takes a long time for the first time  
> is because it needs to load the values to be sorted to memory (and check  
> the logs to see if there are no failures doing that).
> 
> On Wed, Dec 28, 2011 at 8:18 AM, Oren Mazor [oren.ma...@gmail.com](mailto:oren.ma...@gmail.com) wrote:
> 
> > Is there any way for me to kill a long running query?
> 
> > while exploring various mapping types, on several occasions I've  
> > attempted to sort a few thousand records, and this resulted in a query  
> > the appears to run forever.
> 
> > is there any way to see what ES is doing and/or to kill those actions  
> > without having to kill the ES process?
> 
> > thanks  
> > Oren

---

<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:** [December 28, 2011, 8:24pm UTC](https://discuss.elastic.co/t/long-running-queries/6245/4 "2011-12-28T20:24:24Z")

</div>

10 hours sounds excessive, anything in the logs?

On Wed, Dec 28, 2011 at 4:57 PM, Oren Mazor [oren.mazor@gmail.com](mailto:oren.mazor@gmail.com) wrote:

> Got it. so really my only option is to kill ES, when it's become  
> completely unresponsive after running a query for 10 hours.
> 
> is there a safe way to do that? or do I just kill/restart the process?
> 
> On Dec 28, 5:35 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > No, there isn't an option to stop a query that is executing. One of the  
> > possible reasons why a query with sort takes a long time for the first  
> > time  
> > is because it needs to load the values to be sorted to memory (and check  
> > the logs to see if there are no failures doing that).
> > 
> > On Wed, Dec 28, 2011 at 8:18 AM, Oren Mazor [oren.ma...@gmail.com](mailto:oren.ma...@gmail.com)  
> > wrote:
> > 
> > > Is there any way for me to kill a long running query?
> > 
> > > while exploring various mapping types, on several occasions I've  
> > > attempted to sort a few thousand records, and this resulted in a query  
> > > the appears to run forever.
> > 
> > > is there any way to see what ES is doing and/or to kill those actions  
> > > without having to kill the ES process?
> > 
> > > thanks  
> > > Oren

---

<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, 3:44am UTC](https://discuss.elastic.co/t/long-running-queries/6245/5 "2017-07-06T03:44:13Z")

</div>


