java - Delete entire index in ElasticSearch -


i'm approaching elastichsearch java client. i'm trying delete entire index. i'm able delete single document following code:

deleteresponse response = client.preparedelete("twitter", "tweet", "1").get(); 

i delete documents given index in single instruction. note i'm using version 2.2.

thanks

edit: i've found similar question refers old api version. i'm working version 2.2.

the easiest way delete index, recreate it.

deleteindexresponse deleteresponse = client.admin().indices().delete(new deleteindexrequest("your-index")).actionget() 

then

client.admin().indices().preparecreate("your-index").get(); 

this work 2.2 api


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -