ElasticSearch Reindex API 未分析新字段
ElasticSearch Reindex API not analyzing the new field
我有一个名为 "Docs" 的现有索引,其中包含文档。
我正在创建一个名为 "Docs1" 的新索引,与 "Docs" 完全相同,只有一个额外的字段和一个 属性 中的分析器,我想将其用于自动完成目的。
属性 在 "Docs" 索引
"name": {
"type": "text",
"analyzer": "text_standard_analyzer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
属性 在 "Docs1" 索引中将是
{
"name": {
"type": "text",
"analyzer": "text_standard_analyzer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"pmatch": {
"type": "text",
"analyzer": "text_partialmatching_analyzer"
}
}
}
}
我正在使用 Reindex API 将记录从 "Docs" 复制到 "Docs1"
POST_reindex
{
"source":{
"index": "Docs"
},
"dest":{
"index": "Docs1"
}
}
当我重建索引时,我希望旧文档包含新字段以及该字段中的信息。
我注意到目标索引 "Docs1" 中的新字段未针对现有数据进行分析。但它会针对我添加的任何新文档进行分析。
请推荐
通过添加重新索引 "type" 有效
POST _reindex
{
"source":
{ "index": "sourceindex" },
"dest":
{ "index": "destindex",
"type":"desttype"
}
}
我有一个名为 "Docs" 的现有索引,其中包含文档。 我正在创建一个名为 "Docs1" 的新索引,与 "Docs" 完全相同,只有一个额外的字段和一个 属性 中的分析器,我想将其用于自动完成目的。
属性 在 "Docs" 索引
"name": {
"type": "text",
"analyzer": "text_standard_analyzer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
属性 在 "Docs1" 索引中将是
{
"name": {
"type": "text",
"analyzer": "text_standard_analyzer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
},
"pmatch": {
"type": "text",
"analyzer": "text_partialmatching_analyzer"
}
}
}
}
我正在使用 Reindex API 将记录从 "Docs" 复制到 "Docs1"
POST_reindex { "source":{ "index": "Docs" }, "dest":{ "index": "Docs1" } }
当我重建索引时,我希望旧文档包含新字段以及该字段中的信息。
我注意到目标索引 "Docs1" 中的新字段未针对现有数据进行分析。但它会针对我添加的任何新文档进行分析。
请推荐
通过添加重新索引 "type" 有效
POST _reindex { "source": { "index": "sourceindex" }, "dest": { "index": "destindex", "type":"desttype" } }