# Get task ids after executing search query

**URL:** https://discuss.elastic.co/t/get-task-ids-after-executing-search-query/281719
**Category:** Elasticsearch
**Created:** [August 17, 2021, 3:55pm UTC](https://discuss.elastic.co/t/get-task-ids-after-executing-search-query/281719 "2021-08-17T15:55:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![NLSVTN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nlsvtn/32/84889_2.png) [@NLSVTN](https://discuss.elastic.co/u/NLSVTN)
#### Post date: [August 17, 2021, 3:55pm UTC](https://discuss.elastic.co/t/get-task-ids-after-executing-search-query/281719/1 "2021-08-17T15:55:20Z")

</div>

I need to give a user an ability to terminate a query initiated by Elasticsearch-DSL or Elasticsearch-py. I know how to get a list of tasks running on the server but I can't just terminate all of them since there is a chance that one user will terminate task query for another user. So, how could I get task id to store it to terminate later after we execute a query:

[https://elasticsearch-dsl.readthedocs.io/en/latest/search\_dsl.html](https://elasticsearch-dsl.readthedocs.io/en/latest/search_dsl.html)

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 17, 2021, 4:46pm UTC](https://discuss.elastic.co/t/get-task-ids-after-executing-search-query/281719/2 "2021-08-17T16:46:37Z")

</div>

I would look at this,

> **[Async search | Elasticsearch Guide \[7.14\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html)**

---

<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: [September 14, 2021, 4:46pm UTC](https://discuss.elastic.co/t/get-task-ids-after-executing-search-query/281719/3 "2021-09-14T16:46:53Z")

</div>

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