es环境
- Elasticsearch 7.1x
使用方法
- 将通过 convert processor 实现
index准备
POST index_src_1/_doc/1 { "id":"111111", "author": "zlh" }
GET index_src_1/_search查询得到字符串id
"_source" : { "id" : "111111", "author" : "zlh" }
_reindex复制index
POST /_reindex { "source": { "index": "index_src_1", "size": 10 }, "dest": { "index": "index_src_2" } }
GET index_src_2/_search查询得到字符串id
"_source" : { "id" : "111111", "author" : "zlh" }
希望将原index index_src_1中id为string类型转为目标index中long类型
运用 convert 创建 pipeline
PUT _ingest/pipeline/zlh-pipeline-id { "description": "描述:运用convert创建pipeline,将id字段的内容转换为long", "processors" : [ { "convert" : { "field" : "id", "type": "long" } } ] }
_reindex复制index
POST /_reindex { "source": { "index": "index_src_1", "size": 10 }, "dest": { "index": "index_src_2", "pipeline": "zlh-pipeline-id" } }
GET index_src_2/_search查询得到long型id
"_source" : { "author" : "zlh", "id" : 111111 }
- 将通过 convert processor 实现
还没有评论,来说两句吧...