删除Elasticsearch中类型的文档 [英] Delete documents of type in Elasticsearch

查看:156
本文介绍了删除Elasticsearch中类型的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用HTTP / REST api删除Elasticsearch类型中所有索引的所有文档,但我不想删除此类型的映射



如何在URL中构建查询以执行此操作?

解决方案

在执行命令之前, (从弹性搜索头插件获取的截图 web界面)









命令;

  curl -XDELETE'http: / localhost:9200 / publishercategoryeu / autocomplete / _query'-d'
{
查询:{
bool:{
必须:[
{
match_all:{}
}
]
}
}
}
'

结果;





执行命令后,索引/映射状态;









我们可以看到,我们删除了所有在类型(映射)中索引的文档,而没有删除索引或类型(映射)。


I want to delete all the documents indexed within a type in Elasticsearch, using the HTTP/REST api, but I don't want to delete the mapping for this type

How can I build the query in the URL to do this?

解决方案

Before executing command, index/mapping state; (screenshots taken from elasticsearch head plugin web interface)

Command;

curl -XDELETE 'http://localhost:9200/publishercategoryeu/autocomplete/_query' -d '
{
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        }
      ]
    }
  }
}
'

Result;

After executing command, index/mapping state;

As we can see we deleted all the documents indexed within a type(mapping) without delete index or type(mapping).

这篇关于删除Elasticsearch中类型的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆