# Kibana can't cancel long-running queries — "action \[cluster:admin/tasks/cancel\[n\]\] is unauthorized for user \[\_async\_search\]"

**URL:** <https://discuss.elastic.co/t/kibana-cant-cancel-long-running-queries-action-cluster-admin-tasks-cancel-n-is-unauthorized-for-user-async-search/272225>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [May 5, 2021, 9:04pm UTC](https://discuss.elastic.co/t/kibana-cant-cancel-long-running-queries-action-cluster-admin-tasks-cancel-n-is-unauthorized-for-user-async-search/272225 "2021-05-05T21:04:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![smokris](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smokris/32/10817_2.png) [@smokris](https://discuss.elastic.co/u/smokris)\
**Post date:** [May 5, 2021, 9:04pm UTC](https://discuss.elastic.co/t/kibana-cant-cancel-long-running-queries-action-cluster-admin-tasks-cancel-n-is-unauthorized-for-user-async-search/272225/1 "2021-05-05T21:04:18Z")

</div>

I'm seeing a lot of exceptions like this while making changes to Kibana Dashboards:

> ElasticsearchSecurityException[action [cluster:admin/tasks/cancel[n]] is unauthorized for user [\_async\_search], this action is granted by the cluster privileges [manage,all]]

…and long-running queries are piling up. How can I fix that, so that Kibana can successfully cancel its no-longer-needed queries?

I tried granting the missing privilege, but the `_async_search` user doesn't seem to exist, through the public API at least:

```console
$ curl -s -XPUT 0:9200/_security/user/_async_search -H 'Content-Type: application/json' -d'{"roles":["manage"]}' | jq
{
  "error": {
    "type": "validation_exception",
    "reason": "Validation Failed: 1: password must be specified unless you are updating an existing user;"
  },
  "status": 400
}

```

---

<div class="post-metadata">

**Author:** ![TimV](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timv/32/13162_2.png) [@TimV](https://discuss.elastic.co/u/TimV)\
**Post date:** [May 6, 2021, 7:17am UTC](https://discuss.elastic.co/t/kibana-cant-cancel-long-running-queries-action-cluster-admin-tasks-cancel-n-is-unauthorized-for-user-async-search/272225/2 "2021-05-06T07:17:36Z")

</div>

This issue should be fixed in 7.12 and above - what version are you using?

---

<div class="post-metadata">

**Author:** ![smokris](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smokris/32/10817_2.png) [@smokris](https://discuss.elastic.co/u/smokris)\
**Post date:** [May 6, 2021, 2:10pm UTC](https://discuss.elastic.co/t/kibana-cant-cancel-long-running-queries-action-cluster-admin-tasks-cancel-n-is-unauthorized-for-user-async-search/272225/3 "2021-05-06T14:10:20Z")

</div>

Thanks, @TimV. This is happening with Elasticsearch 7.12.1 and Kibana 7.12.1.

```auto
$ curl -s 0:9200 | jq .version
{
  "number": "7.12.1",
  "build_flavor": "default",
  "build_type": "rpm",
  "build_hash": "3186837139b9c6b6d23c3200870651f10d3343b7",
  "build_date": "2021-04-20T20:56:39.040728659Z",
  "build_snapshot": false,
  "lucene_version": "8.8.0",
  "minimum_wire_compatibility_version": "6.8.0",
  "minimum_index_compatibility_version": "6.0.0-beta1"
}

```

---

<div class="post-metadata">

**Author:** ![jimczi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jimczi/32/47985_2.png) [@jimczi](https://discuss.elastic.co/u/jimczi)\
**Post date:** [May 10, 2021, 7:27am UTC](https://discuss.elastic.co/t/kibana-cant-cancel-long-running-queries-action-cluster-admin-tasks-cancel-n-is-unauthorized-for-user-async-search/272225/4 "2021-05-10T07:27:39Z")

</div>

Thanks for reporting @smokris . A [PR](https://github.com/elastic/elasticsearch/pull/72840#issuecomment-834105327) has been opened to fix this issue.

---

<div class="post-metadata">

**Author:** ![smokris](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smokris/32/10817_2.png) [@smokris](https://discuss.elastic.co/u/smokris)\
**Post date:** [May 10, 2021, 9:11pm UTC](https://discuss.elastic.co/t/kibana-cant-cancel-long-running-queries-action-cluster-admin-tasks-cancel-n-is-unauthorized-for-user-async-search/272225/5 "2021-05-10T21:11:53Z")

</div>

Wonderful. Thanks.

---

<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:** [June 7, 2021, 9:12pm UTC](https://discuss.elastic.co/t/kibana-cant-cancel-long-running-queries-action-cluster-admin-tasks-cancel-n-is-unauthorized-for-user-async-search/272225/6 "2021-06-07T21:12:49Z")

</div>

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