Rya*_* R. 16 lucene rest json elasticsearch
我试图找出一种方法来删除elasticsearch索引中特定属性的所有条目,并删除该属性的所有类型映射.
我一直在查看以下两个doc页面:put mapping和delete mapping
从第二个链接:
"允许删除映射(类型)及其数据.REST端点是/ {index}/{type},带有DELETE方法."
我认为我需要的是/{index}/{type}/{property}什么?
我是否需要重新创建整个索引来完成此操作,即在类型之间移动和操作数据?
例如,在映射上调用GET:
curl -XGET 'http://.../some_index/some_type/_mapping'
Run Code Online (Sandbox Code Playgroud)
结果:
{
"some_type": {
"properties": {
"propVal1": {
"type": "double",
"index": "analyzed"
},
"propVal2": {
"type": "string",
"analyzer": "keyword"
},
"propVal3": {
"type": "string",
"analyzer": "keyword"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在此删除操作之后propVal3将返回:
curl -XGET 'http://.../some_index/some_type/_mapping'
Run Code Online (Sandbox Code Playgroud)
结果:
{
"some_type": {
"properties": {
"propVal1": {
"type": "double",
"index": "analyzed"
},
"propVal2": {
"type": "string",
"analyzer": "keyword"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
并且propVal3将通过索引删除所有数据.
你可以使用新的_reindexapi,你甚至可以_mapping在运行reindex之前将一个新的去掉dest索引,这样你就可以改变索引中字段的属性.
要执行重新索引并删除属性,您可以执行以下操作:
POST /_reindex
{
"source": {
"index": "twitter"
},
"dest": {
"index": "new_twitter",
},
"script": {
"inline": "ctx._source.remove('whatever')"
}
}
Run Code Online (Sandbox Code Playgroud)
如果你将它与_aliases API结合使用,你可以修改索引而不会有任何"停机时间"
| 归档时间: |
|
| 查看次数: |
16282 次 |
| 最近记录: |