7378件のreindexを実行しましたが、宛先indexの Doc count が 1000件のまま変化しなくなっていました。
reindexリクエスト
POST _reindex?wait_for_completion=false
{
"source": {
"index": "idx_text"
},
"dest": {
"index": "text_index",
"pipeline": "test_pipeline"
}
}
タスクを見ると、No search context found for id [1221552]
となりエラーになっていました。
reindexタスクの情報
{
"completed": true,
"task": {
"node": "BLGIYZv8Sw6L3uyERfBW8Q",
"id": 10449910,
"type": "transport",
"action": "indices:data/write/reindex",
"status": {
"total": 7378,
"updated": 0,
"created": 1000,
"deleted": 0,
"batches": 1,
"version_conflicts": 0,
"noops": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"requests_per_second": -1,
"throttled_until_millis": 0
},
"description": "reindex from [idx_text] to [text_index]",
"start_time_in_millis": 1735178547455,
"running_time_in_nanos": 811210880235,
"cancellable": true,
"cancelled": false,
"headers": {
"trace.id": "8558b84f156d284379b656bdc978947c"
}
},
"error": {
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": -1,
"index": null,
"reason": {
"type": "search_context_missing_exception",
"reason": "No search context found for id [1221552]"
}
}
],
"caused_by": {
"type": "search_context_missing_exception",
"reason": "No search context found for id [1221552]"
}
}
}
このエラー No search context found for id
でネット検索すると、scroll search実行が時間内に完了しなかった場合に発生することが多いということがわかりました。
ただ、今回はsearchではなくreindexなので、reindexの設定で対応できないかと調べたところ、reindex に次の記述を見つけました。
By default _reindex uses scroll batches of 1000. You can change the batch size with the size field in the source element:
そこで、batch size
を小さく(今回は100)して試したところ、エラーが発生することなく全 7378件のreindexが完了しました。
reindexリクエスト
POST _reindex?wait_for_completion=false
{
"source": {
"index": "idx_text",
"size": 100
},
"dest": {
"index": "text_index",
"pipeline": "test_pipeline"
}
}
reindexタスクの情報
{
"completed": true,
"task": {
"node": "BLGIYZv8Sw6L3uyERfBW8Q",
"id": 10554735,
"type": "transport",
"action": "indices:data/write/reindex",
"status": {
"total": 7378,
"updated": 1000,
"created": 6378,
"deleted": 0,
"batches": 74,
"version_conflicts": 0,
"noops": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"requests_per_second": -1,
"throttled_until_millis": 0
},
"description": "reindex from [idx_text] to [text_index]",
"start_time_in_millis": 1735185743336,
"running_time_in_nanos": 4010710037946,
"cancellable": true,
"cancelled": false,
"headers": {
"trace.id": "7d383d901968aba236f3513a37209634"
}
},
"response": {
"took": 4010709,
"timed_out": false,
"total": 7378,
"updated": 1000,
"created": 6378,
"deleted": 0,
"batches": 74,
"version_conflicts": 0,
"noops": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled": "0s",
"throttled_millis": 0,
"requests_per_second": -1,
"throttled_until": "0s",
"throttled_until_millis": 0,
"failures": []
}
}