简体   繁体   English

Elastic Search Head插件-删除索引中的所有记录

[英]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 http:// ElasticSearchServerURL / entities / entityName / uniqueIdentifierOfRecord

and then select DELETE from the GET/PUT/POST/DELETE drop down. 然后从GET / PUT / POST / DELETE下拉菜单中选择DELETE。

Now I want to delete all records of a particular entityName. 现在,我要删除特定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. 我尝试引用弹性搜索删除操作https://www.elastic.co/guide/zh-cn/elasticsearch/guide/current/_deleting_an_index.html,但是这些操作无法解决我的问题,因为这不是我们在头插件。 I also tried to find documentation but all I could find was some curl queries, which I again do not know how to use. 我也尝试查找文档,但是我只能找到一些curl查询,而我又不知道该如何使用。

Any pointers will be of great help. 任何指针都会有很大帮助。

I hope you know about curl or ES Marvel sense to perform REST actions 我希望您了解执行REST操作的curl或ES Marvel感觉

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 如果要删除所有数据,包括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 我经常使用的一种非常快捷的方法是使用按查询删除API

In the location field of your /head/ plugin you can input the following /head/插件的location字段中,您可以输入以下内容

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

and then select the DELETE HTTP method from the drop down and click on the "Request" button. 然后从下拉列表中选择DELETE HTTP方法,然后单击“请求”按钮。 Voilà. 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. 此方法的唯一缺点是,自ES 1.5.3起不推荐使用此方法,并且将在ES 2.0中将其删除,但在此之前它仍然可供您偶尔用于开发需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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