[英]How ignore missing fields while reindexing in Elasticsearch
If I have a destination index with only portion of source index, and I only want to reindex these fields from source index to destination index, Can I still using the reindex API or what should I do with this situation?如果我有一个只有部分源索引的目标索引,并且我只想将这些字段从源索引重新索引到目标索引,我是否仍可以使用重新索引 API 或者我应该如何处理这种情况? Any solutions or suggestions thanks!任何解决方案或建议谢谢!
You can consider also excludes
option to exclude undesired fields:您还可以考虑excludes
选项以排除不需要的字段:
curl -X POST "localhost:9200/_reindex?pretty" -H 'Content-Type: application/json' -d'
{
"source": {
"index": "source-index",
"_source": {
"excludes": ["exclude_a", "exclude_b"]
}
},
"dest": {
"index": "dest-index"
}
}
'
When reindexing, you are able to apply many operations like renaming fields, reindex only docs matching a query or - and that's what you are looking for - reindex only specific fields.重新索引时,您可以应用许多操作,例如重命名字段、仅重新索引与查询匹配的文档,或者 - 这就是您正在寻找的 - 仅重新索引特定字段。
POST _reindex
{
"source": {
"index": "old_index_name",
"_source": ["field-a", "field-b", "other_field"]
},
"dest": {
"index": "target_index_name"
}
}
Here is the documentation of the feature discussed here: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-filter-source这是此处讨论的功能的文档: https : //www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-filter-source
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.