# Delete by source

**URL:** <https://discuss.elastic.co/t/delete-by-source/31475>\
**Category:** Elasticsearch\
**Created:** [October 1, 2015, 1:06pm UTC](https://discuss.elastic.co/t/delete-by-source/31475 "2015-10-01T13:06:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juan\_Andres\_Ramirez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_andres_ramirez/32/9467_2.png) [@Juan\_Andres\_Ramirez](https://discuss.elastic.co/u/Juan_Andres_Ramirez)\
**Post date:** [October 1, 2015, 1:06pm UTC](https://discuss.elastic.co/t/delete-by-source/31475/1 "2015-10-01T13:06:28Z")

</div>

Hello Guys!,  
I'm going to try delete documents from specific source, and I have the next struct:

```
"_index" : "graylog2_0",
"_type" : "message",
"_id" : "502a30a1-33a9-11e5-8a4c-005056a9199b",
"_score" : 1.0,
"_source":{ "request_time":"15:16:50","version":"1.1","SourceName":"IIS","sc-substatus":0,"source":"SERVER-NAME","streams":[]}

```

So I need delete every document or message or input with **"source": "SERVER-NAME"**.  
I tried with this command but I had error:

```
curl -XDELETE 'http://10.101.81.199:9200/graylog2_20/_search?source:SERVER-1'
{"error":"ClusterBlockException[blocked by: [FORBIDDEN/8/index write (api)];]","status":403}

```

Someone knows how to delete?.

Thank you.

---

<div class="post-metadata">

**Author:** ![Juan\_Andres\_Ramirez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_andres_ramirez/32/9467_2.png) [@Juan\_Andres\_Ramirez](https://discuss.elastic.co/u/Juan_Andres_Ramirez)\
**Post date:** [October 1, 2015, 2:04pm UTC](https://discuss.elastic.co/t/delete-by-source/31475/2 "2015-10-01T14:04:39Z")

</div>

I tried by query, but I had error too:

```
# curl -XGET 'http://10.101.81.199:9200/graylog2_20/message/_query' -d '{
> "query_string":{
> "default_field" : "source",
> "query": "SERVER-1"
> }
> }'
{"_index":"graylog2_20","_type":"message","_id":"_query","found":false}

```

Thank you.

---

<div class="post-metadata">

**Author:** ![Juan\_Andres\_Ramirez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_andres_ramirez/32/9467_2.png) [@Juan\_Andres\_Ramirez](https://discuss.elastic.co/u/Juan_Andres_Ramirez)\
**Post date:** [October 1, 2015, 5:47pm UTC](https://discuss.elastic.co/t/delete-by-source/31475/3 "2015-10-01T17:47:42Z")

</div>

I used the next command and the problems still there.

```
# curl -XDELETE 'http://10.101.81.199:9200/graylog2_0/_search?pretty' -d '{
"query": { "match": {"source": "SERVER-1"}},
"_source": ["source"]}'

```

And the output:

```
"error" : "TypeMissingException[[_all] type[[_search]] missing: No index has the type.]",
  "status" : 404

```

Thank you.

---

<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:** [July 5, 2017, 11:47pm UTC](https://discuss.elastic.co/t/delete-by-source/31475/4 "2017-07-05T23:47:11Z")

</div>


