![](/img/trans.png)
[英]How to know if a reindex from remote task is sucessful or failed in elasticsearch using the java high level rest API
[英]Difference between elasticsearch ReIndex task REST API implementation and Java rest high level client
您好我正在嘗試通過 rest 高級客戶端使用彈性搜索重新索引 api 並比較兩種方法。
Rest API:
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-task-api [![其余 API 文檔截圖][1]][1]
Running reindex asynchronously - If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at _tasks/<task_id>. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space.
rest 高層客戶:
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-document-reindex.html#java-rest-high-document-reindex-task-submission
[![rest high level client Documentation screenshot][2]][2]
Reindex task submission - It is also possible to submit a ReindexRequest and not wait for it completion with the use of Task API. This is an equivalent of a REST request with wait_for_completion flag set to false.
我想弄清楚這個: 來自 Rest API Doc 我知道我應該刪除任務文檔,以便 Elasticsearch 可以回收空間。 由於rest高級客戶端基本上做同樣的事情,如果我選擇使用此客戶端而不是rest API,是否需要“刪除任務文檔”? 如果是這樣,我該怎么做?
感謝 [1]: https://i.stack.imgur.com/OEVHi.png [2]: https://i.stack.imgur.com/sw9Dw.png
任務文檔只是重新索引期間發生的事情的摘要(所以是一個小文檔),因為您指定在 async with wait_for_completion=false
中執行它將在系統.tasks
中創建,因此您可以像查詢任何其他索引一樣查詢此索引找到摘要並將其刪除。
.tasks
在 Elasticsearch 的未來版本中默認不可用,您需要使用鏈接到_tasks
的特定 function 和 java REST api 可在此處獲得
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.