Dowser. Elasticsearch. Reindex
(Dowser.Elasticsearch v0.4.1)
View Source
The Elasticsearch reindex task APIs — every endpoint tagged reindex in the
Elasticsearch OpenAPI specification:
listing the reindex tasks that are running, following one, and cancelling
one.
These track a reindex; they don't start one. The reindex itself is
Dowser.Elasticsearch.Document.reindex/2 (POST /_reindex), which the
specification tags document, and so is its
Dowser.Elasticsearch.Document.reindex_rethrottle/3. Run it with
params: [wait_for_completion: false] to get back the task these
functions take.
A task is followed by its id across node-shutdown relocations, so the id the reindex returned stays the one to ask about for the lifetime of the operation.
Built on Dowser.Client. The task id is a positional argument where the
endpoint requires one; everything optional lives in opts.
All options are forwarded to Dowser.Client.request/4, e.g. :context,
:params (query-string parameters), :format, :keys and :http_opts
(including :headers).
On a 2xx response every function returns {:ok, body} with the decoded
response body. A non-2xx response returns
{:error, %Dowser.Elasticsearch.Error{}}; a transport, encoding or decoding
failure returns {:error, exception} from Dowser.Client. A required
argument that is missing or empty is reported the same way, before any
request is made: {:error, %ArgumentError{}}. Each function has a bang
variant that returns the body directly or raises the error exception.
Summary
Functions
Cancels the reindex task task_id — POST /_reindex/{task_id}/_cancel
(Cancel reindex task API).
Like cancel/2, but returns the body directly or raises the error
exception.
Returns the status and progress of the reindex task task_id — GET /_reindex/{task_id}
(Get reindex task API).
Like get/2, but returns the body directly or raises the error exception.
Lists the reindex tasks currently running — GET /_reindex
(List reindex tasks API).
Like list/1, but returns the body directly or raises the error exception.
Types
@type body() :: term()
@type result() :: {:ok, body()} | {:error, Exception.t()}
A reindex task id, as returned by POST /_reindex.
Functions
Cancels the reindex task task_id — POST /_reindex/{task_id}/_cancel
(Cancel reindex task API).
The documents already reindexed stay where they are; cancelling stops the task from writing any more.
Options
:params—wait_for_completionistrueby default, and the response is the task's final state after cancellation;falseanswersacknowledged: trueright away.
Like cancel/2, but returns the body directly or raises the error
exception.
Returns the status and progress of the reindex task task_id — GET /_reindex/{task_id}
(Get reindex task API).
{:ok, task} = Dowser.Elasticsearch.Reindex.get("node-1:12345")
task["completed"]
#=> falseOptions
:params—wait_for_completion: truewaits for the task to finish before answering,timeoutcaps that wait.
Like get/2, but returns the body directly or raises the error exception.
Lists the reindex tasks currently running — GET /_reindex
(List reindex tasks API).
A task mid-relocation between nodes is reported once, under its original id, so a relocation never shows up as a duplicate.
Options
:params—detailed: trueadds each task's progress and sub-tasks.
Like list/1, but returns the body directly or raises the error exception.