如何在弹性搜索中删除文档类型? [英] How to delete document types in elasticsearch?

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

问题描述

我使用指定的文档类型mytype创建一个索引myindex。我可以删除索引,但是似乎mytype仍然存在而不被绑定到索引。

I create an index "myindex" with a specified document type "mytype". I am able to delete the index, but it appears that "mytype" still exists without being tied to the index.

如何摆脱mytype?

How do I get rid of "mytype"?

推荐答案

如果您真的删除了索引,则该索引中的映射不应该再存在了。
您的群集中有没有其他索引具有相似的类型名称?

If you really deleted the index, the mapping in this index should not exist anymore. Do you have any other index in your cluster with a similar type name?

要回答以下问题:如何删除文档在弹性搜索中使用类型?,请使用删除映射API

To answer to the question: How to delete document types in elasticsearch?, use Delete Mapping API:

curl -XDELETE http://localhost:9200/index/type

编辑:从elasticsearch 2.0开始,不可能再有。请参见映射更改。您必须安装按查询删除插件,并运行一个查询,将删除您的文档,但映射仍将存在。所以最有可能更好的是将您的文档重新编入另一个索引而不用旧的类型。

EDIT: From elasticsearch 2.0, it won't be possible anymore. See Mapping changes. You will have to install the Delete By Query plugin and run a query which will remove your documents but the mapping will still exist. So it will most likely better to reindex your documents in another index without the old type.

但是,如@mguillemin和@javanna所说,当你删除索引时,附加到此索引也被删除:

But as @mguillemin and @javanna said, when you delete an index, every mapping attached to this index is deleted as well:

curl -XDELETE http://localhost:9200/index

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

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