# Deleting documents and inconsistent query behaviour

**URL:** <https://discuss.elastic.co/t/deleting-documents-and-inconsistent-query-behaviour/16471>\
**Category:** Elasticsearch\
**Created:** [March 19, 2014, 3:37pm UTC](https://discuss.elastic.co/t/deleting-documents-and-inconsistent-query-behaviour/16471 "2014-03-19T15:37:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Carrington](https://avatars.discourse-cdn.com/v4/letter/r/0ea827/32.png) [@Robert\_Carrington](https://discuss.elastic.co/u/Robert_Carrington)\
**Post date:** [March 19, 2014, 3:37pm UTC](https://discuss.elastic.co/t/deleting-documents-and-inconsistent-query-behaviour/16471/1 "2014-03-19T15:37:26Z")

</div>

I have an elasticsearch instance running as service on windows server 2008.  
Documents are being inserted by logstash using all the default settings  
which means a different index for each day. I want to delete all documents  
of a certain type across all indices. I'm using Sense in Chrome (having  
tried and failed to get head/inquisitor/browser to do anything useful in  
this respect).

If I run the following:  
DELETE \_all/\_query?q=type:iss

I get the following response:  
{  
"\_indices": {  
"logstash-2014.01.18": {  
"\_shards": {  
"total": 5,  
"successful": 1,  
"failed": 4  
}  
},  
"logstash-2014.01.17": {  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
}  
},  
...  
}

I don't seem to get consistent results with this. When I tried it  
initially it had no successes, I'm not sure what changed but now it seems  
to be mostly successful.

To test if the delete succeeded I ran the following:  
GET \_search?q=type:iis

POST \_search  
{"query":{"match":{"type":"iis"}}}

The 1st query initially returned 0, the 2nd query however returned 376  
which was original number of documents matching that query. Now both  
queries return all 376. Again as far as I'm aware nothing has changed  
(logstash isn't running so nothing is inserting documents currently).

If I look on the Overview page for the head plugin, the index  
logstash-2014.03.19 initially read "docs: 288 (288)". Now it reads "docs:  
3 (7)" so it looks like everything has been deleted (although I don't know  
why there is now a discrepancy between the main number and number in  
brackets now or what they even mean). Also using the Browser after the  
delete, initially only returned 3 documents for that day, now it's  
returning all 376 again.

What am I missing and how do I delete documents across all indices? The  
only actual success I've had so far is deleting the index itself but that's  
obviously not a useful option.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/08b7657b-cb58-4f94-ae0e-e727053c171e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/08b7657b-cb58-4f94-ae0e-e727053c171e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:42am UTC](https://discuss.elastic.co/t/deleting-documents-and-inconsistent-query-behaviour/16471/2 "2017-07-06T01:42:06Z")

</div>

Closed on July 6, 2017, 1:42am UTC


