前言
- 本文对 Elasticsearch 7.17 适用
- 需要通过 reindex 给数据添加字段,查官方文档估摸 set 和 append 两种 processor 实现,试验之
试验过程
idx_1
POST idx_1/_doc/1
{
"author": "qbit"
}
idx_2
PUT _ingest/pipeline/addtag
{
"processors" : [
{
"set" : {
"field" : "tag",
"value": "set"
}
}
]
}
POST _reindex?wait_for_completion=false
{
"source": {
"index": "idx_1",
"size": 5000
},
"dest": {
"index": "idx_2",
"pipeline": "addtag"
}
}
GET idx_2/_search
{
"_index" : "idx_2",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"author" : "qbit",
"tag" : "set"
}
}
idx_3
PUT _ingest/pipeline/appendtag
{
"processors" : [
{
"append" : {
"field" : "tag",
"value": "append"
}
}
]
}
POST _reindex?wait_for_completion=false
{
"source": {
"index": "idx_2",
"size": 5000
},
"dest": {
"index": "idx_3",
"pipeline": "appendtag"
}
}
GET idx_3/_search
{
"_index" : "idx_3",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"author" : "qbit",
"tag" : [
"set",
"append"
]
}
}
相关阅读
本文出自 qbit snap
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。