# Sql query cannot be cancelled and long running

**URL:** <https://discuss.elastic.co/t/sql-query-cannot-be-cancelled-and-long-running/299070>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [March 8, 2022, 10:05am UTC](https://discuss.elastic.co/t/sql-query-cannot-be-cancelled-and-long-running/299070 "2022-03-08T10:05:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sathish\_smart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sathish_smart/32/99794_2.png) [@Sathish\_smart](https://discuss.elastic.co/u/Sathish_smart)\
**Post date:** [March 8, 2022, 10:05am UTC](https://discuss.elastic.co/t/sql-query-cannot-be-cancelled-and-long-running/299070/1 "2022-03-08T10:05:13Z")

</div>

I am unable to cancel the Elasticsearch sql query which is long running and I would like to know whether there is any option to make 'cancellable' true in the sql API.

{  
"completed": false,  
"task": {  
"node": "5yiolpwu7l-nMcu3UoeUUg",  
"id": 739961139,  
"type": "transport",  
"action": "indices:data/read/sql",  
"description": "SQL [SELECT "product" AS "column1", "cursor" AS "column2" FROM "product\_data" AS "cb3f008d95474444354567866"\r \r WHERE ( ( ("date" \>= '2021-12-02' AND "date" \<= '2022-02-28')) AND ( (CAST("product" AS VARCHAR) IN( 'India', 'India', 'India', 'India', 'China' ))))\r GROUP BY "skills", "cursor"\r ORDER BY COUNT( DISTINCT "cursor" ) DESC, "column1" ASC, "column2" ASC LIMIT 1][null]",  
"start\_time\_in\_millis": 1645698398116,  
"running\_time\_in\_nanos": 496370826338275,  
"cancellable": false,  
"headers": {}  
}  
}

---

<div class="post-metadata">

**Author:** ![casterQ](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/casterq/32/93257_2.png) [@casterQ](https://discuss.elastic.co/u/casterQ)\
**Post date:** [March 8, 2022, 10:26am UTC](https://discuss.elastic.co/t/sql-query-cannot-be-cancelled-and-long-running/299070/2 "2022-03-08T10:26:26Z")

</div>

I don't think this can be modified，but maybe you can find out which `coordinating node`(don't have data on it) the task runs on，and restart this node(Make sure you have multiple `coordinating nodes` and there is no service only connect this one node)

---

<div class="post-metadata">

**Author:** ![bogdan.pintea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bogdan.pintea/32/45740_2.png) [@bogdan.pintea](https://discuss.elastic.co/u/bogdan.pintea)\
**Post date:** [March 16, 2022, 1:39pm UTC](https://discuss.elastic.co/t/sql-query-cannot-be-cancelled-and-long-running/299070/3 "2022-03-16T13:39:35Z")

</div>

> [@Sathish\_smart](#):
>
> I would like to know whether there is any option to make 'cancellable' true in the sql API.

Elasticsearch version 7.14 and later support SQL tasks cancelation, but not the prior versions.

---

<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:** [April 13, 2022, 1:39pm UTC](https://discuss.elastic.co/t/sql-query-cannot-be-cancelled-and-long-running/299070/4 "2022-04-13T13:39:55Z")

</div>

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