Elasticsearch 删除映射属性 [英] Elasticsearch Delete Mapping Property
问题描述
我正在尝试找出一种方法来删除弹性搜索索引中特定属性的所有条目并删除该属性的所有类型映射.
I am trying to figure out an approach to delete all entries for a specific property in an elasticsearch index and remove all type mappings for that property.
I have been looking at the following two doc pages: put mapping and delete mapping
来自第二个链接:
允许删除映射(类型)及其数据.REST端点是/{index}/{type} 和 DELETE 方法."
"Allow to delete a mapping (type) along with its data. The REST endpoint is /{index}/{type} with DELETE method."
我认为我需要的是 /{index}/{type}/{property}
?
我是否需要重新创建整个索引来完成此操作,即在类型之间移动和操作数据?
Do I need to recreate the whole index to accomplish this, i.e. moving and manipulating data between types?
例如,在映射上调用 GET:
For Example, calling GET on the mapping:
curl -XGET 'http://.../some_index/some_type/_mapping'
结果:
{
"some_type": {
"properties": {
"propVal1": {
"type": "double",
"index": "analyzed"
},
"propVal2": {
"type": "string",
"analyzer": "keyword"
},
"propVal3": {
"type": "string",
"analyzer": "keyword"
}
}
}
}
在 propVal3
上执行此删除操作后将返回:
after this delete operation on propVal3
would return:
curl -XGET 'http://.../some_index/some_type/_mapping'
结果:
{
"some_type": {
"properties": {
"propVal1": {
"type": "double",
"index": "analyzed"
},
"propVal2": {
"type": "string",
"analyzer": "keyword"
}
}
}
}
propVal3
的所有数据都将通过索引删除.
and all data for propVal3
would be removed through the index.
推荐答案
你不能那样做.只是忘记这个值存在...... ;-)如果您确实需要删除它,则必须重新索引您的文档.
You can not do that. Just forget that this value exists... ;-) If you really need to remove it, you will have to reindex your documents.
这篇关于Elasticsearch 删除映射属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!