View Source Meilisearch.Task (meilisearch_ex v1.1.2)
Manipulate Meilisearch tasks. Task API
Link to this section Summary
Functions
Cancel tasks of your Meilisearch instance. Meilisearch documentation
Delete tasks of your Meilisearch instance. Meilisearch documentation
Get an Task of your Meilisearch instance. Meilisearch documentation
List tasks of your Meilisearch instance. Meilisearch documentation
Link to this section Types
@type t() :: %Meilisearch.Task{ canceledBy: integer() | nil, details: map() | nil, duration: String.t(), enqueuedAt: DateTime.t(), error: Meilisearch.Error.t(), finishedAt: DateTime.t(), indexUid: String.t() | nil, startedAt: DateTime.t(), status: :enqueued | :processing | :succeeded | :failed | :canceled, type: :indexCreation | :indexUpdate | :indexDeletion | :indexSwap | :documentAdditionOrUpdate | :documentDeletion | :settingsUpdate | :dumpCreation | :taskCancelation | :taskDeletion | :snapshotCreation, uid: integer() }
Link to this section Functions
@spec cancel(Tesla.Client.t(), uids: String.t(), statuses: String.t(), types: String.t(), indexUids: String.t(), beforeEnqueuedAt: String.t(), beforeStartedAt: String.t(), beforeFinishedAt: String.t(), afterEnqueuedAt: String.t(), afterStartedAt: String.t(), afterFinishedAt: String.t() ) :: {:ok, Meilisearch.SummarizedTask.t()} | {:error, Meilisearch.Client.error()}
Cancel tasks of your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Task.cancel(client, uids: "1,2")
{:ok, %{
taskUid: 0,
indexUid: nil,
status: :enqueued,
type: :taskCancelation,
enqueuedAt: ~U[2021-08-12 10:00:00]
}}
@spec delete(Tesla.Client.t(), uids: String.t(), statuses: String.t(), types: String.t(), indexUids: String.t(), canceledBy: String.t(), beforeEnqueuedAt: String.t(), beforeStartedAt: String.t(), beforeFinishedAt: String.t(), afterEnqueuedAt: String.t(), afterStartedAt: String.t(), afterFinishedAt: String.t() ) :: {:ok, Meilisearch.SummarizedTask.t()} | {:error, Meilisearch.Client.error()}
Delete tasks of your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Task.delete(client, uids: "1,2")
{:ok, %{
taskUid: 0,
indexUid: nil,
status: :enqueued,
type: :taskDeletion,
enqueuedAt: ~U[2021-08-12 10:00:00]
}}
@spec get(Tesla.Client.t(), integer()) :: {:ok, t()} | {:error, Meilisearch.Client.error()}
Get an Task of your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Task.get(client, 32)
{:ok, %{
uid: 32,
indexUid: "movies",
status: :succeeded,
type: :settingsUpdate,
canceledBy: nil,
details: %{
"rankingRules" => [
"typo",
"ranking:desc",
"words",
"proximity",
"attribute",
"exactness"
]
},
error: null,
duration: "PT1S",
enqueuedAt: ~U[2021-08-12 10:00:00],
startedAt: ~U[2021-08-12 10:00:01],
finishedAt: ~U[2021-08-12 10:02:11]
}}
@spec list(Tesla.Client.t(), limit: integer(), from: integer(), uids: String.t(), statuses: String.t(), types: String.t(), indexUids: String.t(), canceledBy: String.t(), beforeEnqueuedAt: String.t(), beforeStartedAt: String.t(), beforeFinishedAt: String.t(), afterEnqueuedAt: String.t(), afterStartedAt: String.t(), afterFinishedAt: String.t() ) :: {:ok, Meilisearch.PaginatedTasks.t()} | {:error, Meilisearch.Client.error()}
List tasks of your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Task.list(client, limit: 20, offset: 0)
{:ok, %{offset: 0, limit: 20, total: 1, results: [%{
uid: "movies",
primaryKey: "id",
createdAt: ~U[2021-08-12 10:00:00],
updatedAt: ~U[2021-08-12 10:00:00]
}]}}