ElasticSearch 学习笔记:Reindex,
1、创建新的索引(Index):
PUT /<indexName>
{
"settings": {
"index": {
"number_of_shards": 5,
"number_of_replicas": 1
}
}
}
2、导入数据(Reindex):
POST /_reindex
{
"source": {
"index": "<sourceIndexName>",
"type": "<sourceTypeName>",
"sort": {
"<fieldName>": "asc/desc"
},
"_source": [
"<fieldName>",
"<fieldName>",
...
]
},
"dest": {
"index": "<destIndexName>"
}
}
3、批量更新(Update by Query):
POST /<indexName>/<typeName>/_update_by_query
{
"query": {
"match_all": {}
},
"script": {
"inline/source": "ctx._source.<fieldName> = ctx._source.<fieldName> + ''"
}
}
inline:ES 5.6版本之前;
source:ES 5.6版本及以后
POST /_aliases
{
"actions": [
{
"add": {
"index": "<indexName>",
"alias": "<alias>"
}
}
]
}
{
"actions": [
{
"remove": {
"index": "<indexName>",
"alias": "<alias>"
}
}
]
}
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。