Meili.Index (Meili v0.1.0)

Copy Markdown View Source

Manages Meilisearch indexes.

Summary

Functions

Triggers compaction of a specific index.

Triggers compaction of a specific index, raising on error.

Creates a new index, raising on error.

Deletes an index, raising on error.

Retrieves a single index.

Retrieves a single index, raising on error.

Lists all indexes, raising on error.

Gets stats of a specific index.

Gets stats of a specific index, raising on error.

Swaps the contents of two or more indexes.

Swaps the contents of indexes, raising on error.

Updates an index (currently, only the primaryKey can be updated).

Updates an index, raising on error.

Functions

compact(client_or_uid, uid_or_nil \\ nil)

Triggers compaction of a specific index.

Examples

Meili.Index.compact("movies")
Meili.Index.compact(client, "movies")

compact!(client_or_uid, uid_or_nil \\ nil)

Triggers compaction of a specific index, raising on error.

create(client_or_uid, uid_or_opts \\ [], opts \\ [])

Creates a new index.

Options can be a primary key string, a keyword list, or a map.

Examples

Meili.Index.create("movies")
Meili.Index.create("movies", "id")
Meili.Index.create("movies", primary_key: "id")
Meili.Index.create(client, "movies", primary_key: "id")

create!(client_or_uid, uid_or_opts \\ [], opts \\ [])

Creates a new index, raising on error.

delete(client_or_uid, uid_or_nil \\ nil)

Deletes an index.

Examples

Meili.Index.delete("movies")
Meili.Index.delete(client, "movies")

delete!(client_or_uid, uid_or_nil \\ nil)

Deletes an index, raising on error.

get(client_or_uid, uid_or_nil \\ nil)

Retrieves a single index.

Examples

Meili.Index.get("movies")
Meili.Index.get(client, "movies")

get!(client_or_uid, uid_or_nil \\ nil)

Retrieves a single index, raising on error.

list(client_or_opts \\ nil, opts \\ [])

Lists all indexes.

Supports optional query params:

  • limit: The maximum number of indexes to return.
  • offset: The number of indexes to skip.

Examples

Meili.Index.list()
Meili.Index.list(limit: 10)
Meili.Index.list(client, limit: 10)

list!(client_or_opts \\ nil, opts \\ [])

Lists all indexes, raising on error.

stats(client_or_uid, uid_or_nil \\ nil)

Gets stats of a specific index.

Examples

Meili.Index.stats("movies")
Meili.Index.stats(client, "movies")

stats!(client_or_uid, uid_or_nil \\ nil)

Gets stats of a specific index, raising on error.

swap(client_or_indexes, indexes_or_nil \\ nil)

Swaps the contents of two or more indexes.

Examples

Meili.Index.swap([%{indexes: ["movies_a", "movies_b"]}])
Meili.Index.swap(client, [%{indexes: ["movies_a", "movies_b"]}])

swap!(client_or_indexes, indexes_or_nil \\ nil)

Swaps the contents of indexes, raising on error.

update(client_or_uid, uid_or_opts \\ [], opts \\ [])

Updates an index (currently, only the primaryKey can be updated).

Examples

Meili.Index.update("movies", "new_id")
Meili.Index.update("movies", primary_key: "new_id")
Meili.Index.update(client, "movies", primary_key: "new_id")

update!(client_or_uid, uid_or_opts \\ [], opts \\ [])

Updates an index, raising on error.