# Delete by query api command line not working

**URL:** <https://discuss.elastic.co/t/delete-by-query-api-command-line-not-working/162783>\
**Category:** Elasticsearch\
**Created:** [January 3, 2019, 10:43am UTC](https://discuss.elastic.co/t/delete-by-query-api-command-line-not-working/162783 "2019-01-03T10:43:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elk\_dni\_1](https://avatars.discourse-cdn.com/v4/letter/e/82dd89/32.png) [@elk\_dni\_1](https://discuss.elastic.co/u/elk_dni_1)\
**Post date:** [January 3, 2019, 10:43am UTC](https://discuss.elastic.co/t/delete-by-query-api-command-line-not-working/162783/1 "2019-01-03T10:43:27Z")

</div>

curl -s -XPOST [http://localhost:9200/xxxlog-\*/delete\_by\_query?q=xxx:"xxxx"](http://localhost:9200/xxxlog-*/delete_by_query?q=xxx:%22xxxx%22)  
throwing error -

{"error":{"root\_cause":[{"type":"parse\_exception","reason":"request body is required"}],"type":"parse\_exception","reason":"request body is required"},"status":400}

In kibana -\> Dev tools 'POST xxxlog-\*/delete\_by\_query?q=xxx:"xxxx" ' worked although.

Please help

---

<div class="post-metadata">

**Author:** ![LGans316](https://avatars.discourse-cdn.com/v4/letter/l/cab0a1/32.png) [@LGans316](https://discuss.elastic.co/u/LGans316)\
**Post date:** [January 3, 2019, 10:56am UTC](https://discuss.elastic.co/t/delete-by-query-api-command-line-not-working/162783/3 "2019-01-03T10:56:19Z")

</div>

Works for me.

**Request**

`curl -XPOST "http://es.xxx.com:9200/xxx/_delete_by_query?q=id:2"`

**Response**

{"took":64,"timed\_out":false,"total":1,"deleted":1,"batches":1,"version\_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled\_millis":0,"requests\_per\_second":-1.0,"throttled\_until\_millis":  
0,"failures":}

---

<div class="post-metadata">

**Author:** ![elk\_dni\_1](https://avatars.discourse-cdn.com/v4/letter/e/82dd89/32.png) [@elk\_dni\_1](https://discuss.elastic.co/u/elk_dni_1)\
**Post date:** [January 3, 2019, 3:23pm UTC](https://discuss.elastic.co/t/delete-by-query-api-command-line-not-working/162783/4 "2019-01-03T15:23:26Z")

</div>

Thanks I missed "\_"(underscore) before 'delete\_by\_query' api name. 🙂

---

<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:** [January 31, 2019, 3:23pm UTC](https://discuss.elastic.co/t/delete-by-query-api-command-line-not-working/162783/5 "2019-01-31T15:23:31Z")

</div>

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