DeleteIndex doesn't delete the index folder from disk

I am trying to delete index from elastic search using below code snippet. DeleteIndexResponse returns true, but the folder still exists in the physical location.

DeleteIndexResponse res= client.admin().indices().prepareDelete("dummyIndex").execute().actionGet();
System.out.println("Index deletion status : " + res.isAcknowledged());

ES no longer identifies it as index when i search from REST end point - error": "IndexMissingException[[dummyIndex] missing]"
But it is not deleted from disk. Is there something i missed here?

How do you check it's deleted from disk or not?

When i said disk, i meant the file system directory relative to given path.data value

Can you run please:

curl 127.0.0.1/_cat/indices?v
tree path/to/data/dir

@dadoonet I ran the command and the listed indices doesn't include the deleted index ([dummyIndex] in my case)
http://hostname:9200/_cat/indices?v?tree=G:\IndexDir

green index1 1 0 2914 0 3.3mb 3.3mb
green index2 1 0 0 0 99b 99b
green index3 1 0 175523 0 1.2gb 1.2gb
green index4 1 0 644 24 614.8kb 614.8kb

So you're on windows?

I meant to run a tree command like:

tree G:\IndexDir

yes its windows machine and i checked that the index still exists.

Iirc removing the index from disk is asynchronous from the ack for the
delete. Just that it is gone from the cluster state. Though I think that is
changing a bit in 5.0 but I don't have a link handy.

Can you please give the output of the command?


Highlighted workDummy is the index which is deleted

Can you print what you have in the workdummy\0\index dir?

There is no _state dir for this index. That looks strange.

Please don't use screen shots but copy and paste the output as text.

Which elasticsearch version are you using?

@nik9000
Index is getting deleted from file system as well when i run curl XDelete command from Rest Client, but when deleted using DeleteIndex java API, it is not removed from disk.

This is super strange as the same code is called behind the scene.

See https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java#L53-L53

@dadoonet this is the output after deleting the index using the java, do you need the file structure before index deletion? Elastic search version :1.0.2

I meant: do you have remaining files in workdummy\0\index dir?

Nope that is the end of output

I have hard time to follow.

I'm not talking about the tree command here.

I'm asking to go into the workdummy\0\index, run a dir command so we can see if there are some files left.

BTW you are using a very old version of elasticsearch. Could you please run the same test on a new cleaned and fresh elasticsearch instance running latest 1.7?

yes there is a file left _0.cfs.

Directory of G:\IndexDir\59f92c3bcfadac7eaf599dad8eace0b3\nodes\0\indices\workdummy\0\index

07/12/2016 06:42 PM .
07/12/2016 06:42 PM ..
07/12/2016 06:42 PM 4,820 _0.cfs
1 File(s) 4,820 bytes
2 Dir(s) 26,477,842,432 bytes free

Before deleting the index, do i have to call the closeIndex api- so as to remove references (if any) to the index?
Because before deletion, i am searching with scroll api on this index.

Ha! That makes more sense now.

You have to clear the scroll IMO before deleting the index. See https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-request-scroll.html#_clear_scroll_api

You don't have to close the index.

Thanks David, after clearing the scroll, delete index deleted the folder as well.