gpt4 book ai didi

elasticsearch - 重新索引并更新联接字段

转载 作者:行者123 更新时间:2023-12-02 23:54:28 25 4
gpt4 key购买 nike

INTRO

我的IndexA没有任何join字段,我想添加一个。

为此,我创建了带有扩展映射的IndexB,其中包括一个新字段。我正在尝试将IndexA重新索引为IndexB
问题

如何通过重新索引将IndexB中的每个文档更新为父文档?

this示例中,为了使文档成为父文档,必须像这样设置连接字段:

"my_join_field": {
"name": "question"
}
question是已定义关系中的父类型

最佳答案

找到一个解决方案:

POST _reindex
{
"source": {
"index": "IndexA"
},
"dest": {
"index": "IndexB",
"routing": "=1"
},
"script": {
"source": "ctx._source.my_join_field = params.j",
"params": {
"j": {
"name" : "parent_relationship_name"
}
},
"lang": "painless"
}
}

关于elasticsearch - 重新索引并更新联接字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54791197/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com