xProgramery
xProgramery

Reputation: 517

Does deleting Elasticsearch index (or all indecies) delete the actual data as well?

I am new to ElasticSearch, and need to know if deleting index/mapping deletes all the actual data as well? And if yes, is there a way to recover the data?

Thank you

Upvotes: 7

Views: 4964

Answers (2)

saurabh
saurabh

Reputation: 681

Deleting an index deletes the index as well as data. There's no way to delete a mapping on elastic search. You can update mapping using PUT api for mapping.

To delete an index, either use DELETE in Sense.

DELETE index_name

Sometimes(eg- AWS ES as service), that doesn't work where you can use the curl command to delete the index/documents.

curl -XDELETE 'hostname:port/index_name?pretty'

I hope that helps!

Upvotes: 3

jay
jay

Reputation: 2077

It depends on which version of Elasticsearch you are using. Till 1.7, deleting mapping deletes the documents also. https://www.elastic.co/guide/en/elasticsearch/reference/1.7/indices-delete-mapping.html

From 2.0 onwards, you cannot delete a mapping directly. You can only delete the index. https://www.elastic.co/guide/en/elasticsearch/reference/2.0/indices-delete-mapping.html

As far as I know it is not possible to recover docs once the index / mapping is deleted. (Although I am not a 100% sure).

Upvotes: 2

Related Questions