![](/img/trans.png)
[英]Ignore indexing existing document while reindexing in ElasticSearch
[英]How ignore missing fields while reindexing in Elasticsearch
如果我有一個只有部分源索引的目標索引,並且我只想將這些字段從源索引重新索引到目標索引,我是否仍可以使用重新索引 API 或者我應該如何處理這種情況? 任何解決方案或建議謝謝!
您還可以考慮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"
}
}
'
重新索引時,您可以應用許多操作,例如重命名字段、僅重新索引與查詢匹配的文檔,或者 - 這就是您正在尋找的 - 僅重新索引特定字段。
POST _reindex
{
"source": {
"index": "old_index_name",
"_source": ["field-a", "field-b", "other_field"]
},
"dest": {
"index": "target_index_name"
}
}
這是此處討論的功能的文檔: https : //www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-filter-source
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.