# Delete documents in Elasticsearch from Logstash

**URL:** https://discuss.elastic.co/t/delete-documents-in-elasticsearch-from-logstash/328679
**Category:** Logstash
**Created:** [March 28, 2023, 7:04am UTC](https://discuss.elastic.co/t/delete-documents-in-elasticsearch-from-logstash/328679 "2023-03-28T07:04:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![oo\_eyad](https://avatars.discourse-cdn.com/v4/letter/o/ed8c4c/32.png) [@oo\_eyad](https://discuss.elastic.co/u/oo_eyad)
#### Post date: [March 28, 2023, 7:04am UTC](https://discuss.elastic.co/t/delete-documents-in-elasticsearch-from-logstash/328679/1 "2023-03-28T07:04:59Z")

</div>

I have an index in Elasticsearch where the UID is automatically generated, I want to delete documents by query but from Logstash. I am trying different ways like http output plugin, is it the correct option to do so? or Is there any other ways to do it from Logstash?  
'input {

stdin {  
type =\> "foo"  
}  
}

output {   
http {  
url =\> "\*\*\*\*\*/test\_ind/\_delete\_by\_query?conflicts=proceed"  
http\_method =\> "post"  
format =\> "message"  
content\_type =\> "application/json; charset=UTF-8"  
message =\> '{"query": { "match\_all": {}}}'   
headers =\> {"Authorization" =\> "ApiKey \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"}  
ssl\_supported\_protocols =\> "['TLSv1.2', 'TLSv1.3', 'TLSv1.1']"

```
}

```

}'

---

<div class="post-metadata">

### Author: ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)
#### Post date: [March 29, 2023, 2:36pm UTC](https://discuss.elastic.co/t/delete-documents-in-elasticsearch-from-logstash/328679/2 "2023-03-29T14:36:53Z")

</div>

I suppose using http output plugin is a good option.  
Is there any problem?

---

<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 26, 2023, 2:37pm UTC](https://discuss.elastic.co/t/delete-documents-in-elasticsearch-from-logstash/328679/3 "2023-04-26T14:37:50Z")

</div>

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