简体   繁体   中英

Elastic Search head plugin - Delete all records in an index

Can anyone please give me pointers on how to delete all records of an index using the head plugin of the elastic search?

What we usually do is form the query like

http://ElasticSearchServerURL/entities/entityName/uniqueIdentifierOfRecord

and then select DELETE from the GET/PUT/POST/DELETE drop down.

Now I want to delete all records of a particular entityName.

I tried referring to Elastic search delete operation and https://www.elastic.co/guide/en/elasticsearch/guide/current/_deleting_an_index.html but these do not resolve my issue, since this is not how we do it in the Head plug-in. I also tried to find documentation but all I could find was some curl queries, which I again do not know how to use.

Any pointers will be of great help.

I hope you know about curl or ES Marvel sense to perform REST actions

The below command will delete all the data and mapping from the index

 DELETE /<index-name>/

If you like to delete all the data including metadata created by ES

DELETE /_all

If you like to delete only the data but not the mapping and other meta information about the index

 DELETE <index-name/_query
 {
       "query": {
                "match_all" : {}
        }
 }

One way I often used and which is quite fast is by using the delete by query API

In the location field of your /head/ plugin you can input the following

`/entities/entityName/_query?q=*`

and then select the DELETE HTTP method from the drop down and click on the "Request" button. Voilà.

The only downside with this method is that it is deprecated since ES 1.5.3 and will be removed in ES 2.0, but until then it's still there for you to use occasionnally for your development needs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM