[英]reindex a type on another one in ElasticSearch 2.x onward
I've updated to ElasticSearch 2.1. 我已经更新到ElasticSearch 2.1。 Deleting a mapping type is not supported anymore since 2.0 onward.
从2.0开始,不再支持删除映射类型。
Before, it was very useful to simply remove a type, and created it again. 以前,简单地删除一个类型并再次创建它非常有用。
So, the question is waht should I do in order to reach it out on ElasticSearch 2.1? 因此,问题是我应该怎么做才能在ElasticSearch 2.1上达到目标?
Imagine I've an index idx
with a type tp
. 想象一下,我有一个索引
idx
,类型为tp
。 I supose I shall use alias
, however I don't know how to do it. 我认为我将使用
alias
,但是我不知道该怎么做。 Does exists alias
for index-level
? 不存在
alias
为index-level
? Does exist alias
for type-level
? 是否存在
type-level
alias
?
Oh,since 2.x,the elasticsearch cannot delete the mapping .It is no longer possible to delete the mapping for a type. 哦,从2.x版本开始,elasticsearch无法删除映射。不再可能删除类型的映射。 Instead you should delete the index and recreate it with the new mappings.
相反,您应该删除索引并使用新的映射重新创建它。
[You can refer to the link as follow ! [您可以参考以下链接! ]
]
https://www.elastic.co/guide/en/elasticsearch/reference/2.2/indices-delete-mapping.html https://www.elastic.co/guide/zh-CN/elasticsearch/reference/2.2/indices-delete-mapping.html
As mentioned in my answer to your other question , you can proceed in a similar way as before, just on a totally new index (which I called myindex
below): 如我对其他问题的回答中所述 ,您可以按照与以前类似的方式进行操作,只是使用一个全新的索引(我在下面将其称为
myindex
):
First create a new index with your mapping 首先使用您的映射创建一个新索引
curl -XPUT localhost:9200/myindex -d '{
"mappings": {
"mytype": {
"properties": {
...
}
}
}
}'
Then re-index your data in your new index 然后在新索引中重新索引数据
curl -XPUT localhost:9200/myindex/mytype/1 -d '{"field":"value"}'
Finally, you can run your queries on your new index myindex
, you can also delete the previous index: 最后,您可以在新索引
myindex
上运行查询,也可以删除以前的索引:
curl -XDELETE localhost:9200/oldindex
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.