View Source Meilisearch.Index (meilisearch_ex v1.1.2)
Manipulate Meilisearch indexes. Index API
Link to this section Summary
Functions
Create a new Index in your Meilisearch instance. Meilisearch documentation
Delete an existing Index in your Meilisearch instance. Meilisearch documentation
Get an Index of your Meilisearch instance. Meilisearch documentation
List indexes of your Meilisearch instance. Meilisearch documentation
Create a new Index in your Meilisearch instance. Meilisearch documentation
Update an existing Index in your Meilisearch instance. Meilisearch documentation
Link to this section Types
@type t() :: %Meilisearch.Index{ createdAt: DateTime.t(), primaryKey: String.t(), uid: String.t(), updatedAt: DateTime.t() }
Link to this section Functions
@spec create(Tesla.Client.t(), %{uid: String.t(), primaryKey: String.t() | nil}) :: {:ok, Meilisearch.SummarizedTask.t()} | {:error, Meilisearch.Client.error()}
Create a new Index in your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Index.create(client, %{uid: "movies", primaryKey: "id"})
{:ok, %{
taskUid: 0,
indexUid: "movies",
status: :enqueued,
type: :indexCreation,
enqueuedAt: ~U[2021-08-12 10:00:00]
}}
@spec delete(Tesla.Client.t(), String.t()) :: {:ok, Meilisearch.SummarizedTask.t()} | {:error, Meilisearch.Client.error()}
Delete an existing Index in your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Index.delete(client, "movies")
{:ok, %{
taskUid: 0,
indexUid: "movies",
status: :enqueued,
type: :indexDeletion,
enqueuedAt: ~U[2021-08-12 10:00:00]
}}
@spec get(Tesla.Client.t(), String.t()) :: {:ok, t()} | {:error, Meilisearch.Client.error()}
Get an Index of your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Index.get(client, "movies")
{:ok, %{
uid: "movies",
primaryKey: "id",
createdAt: ~U[2021-08-12 10:00:00],
updatedAt: ~U[2021-08-12 10:00:00]
}}
@spec list(Tesla.Client.t(), offset: integer(), limit: integer()) :: {:ok, Meilisearch.Pagination.t(t())} | {:error, Meilisearch.Client.error()}
List indexes of your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Index.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]
}]}}
@spec swap(Tesla.Client.t(), [%{indexes: [String.t()]}]) :: {:ok, Meilisearch.SummarizedTask.t()} | {:error, Meilisearch.Client.error()}
Create a new Index in your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Index.swap(client, [%{indexes: ["movies", "actors"]}])
{:ok, %{
taskUid: 0,
indexUid: nil,
status: :enqueued,
type: :indexSwap,
enqueuedAt: ~U[2021-08-12 10:00:00]
}}
@spec update(Tesla.Client.t(), String.t(), %{primaryKey: String.t() | nil}) :: {:ok, Meilisearch.SummarizedTask.t()} | {:error, Meilisearch.Client.error()}
Update an existing Index in your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Index.update(client, "movies", %{primaryKey: "id"})
{:ok, %{
taskUid: 0,
indexUid: "movies",
status: :enqueued,
type: :indexUpdate,
enqueuedAt: ~U[2021-08-12 10:00:00]
}}