View Source Meilisearch.Stats (meilisearch_ex v1.1.2)
Get Stats about your Meilisearch indexes. Key API
Link to this section Summary
Functions
Get stats about all indexes of your Meilisearch instance. Meilisearch documentation
Get stats about a specific index of your Meilisearch instance. Meilisearch documentation
Link to this section Types
@type t() :: %Meilisearch.Stats{ databaseSize: integer() | nil, indexes: %{required(String.t()) => Meilisearch.Stats.Stat.t()}, lastUpdate: DateTime.t() | nil }
Link to this section Functions
@spec all(Tesla.Client.t(), offset: integer(), limit: integer()) :: {:ok, t()} | {:error, Meilisearch.Client.error()}
Get stats about all indexes of your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Stats.all(client)
{:ok, %{
databaseSize: 447819776,
lastUpdate: ~U[2021-08-12 10:00:00],
indexes: %{
"movies" => %{
numberOfDocuments: 19654,
isIndexing: false,
fieldDistribution: %{
"poster" => 19654,
"overview" => 19654,
"title" => 19654,
"id" => 19654,
"release_date" => 19654
}
},
"books" => %{
numberOfDocuments: 5,
isIndexing: false,
fieldDistribution: %{
"id" => 5,
"title" => 5,
"author" => 5,
"price" => 5,
"genres" => 5
}
}
}
}}
@spec get(Tesla.Client.t(), String.t()) :: {:ok, Meilisearch.Stats.Stat.t()} | {:error, Meilisearch.Client.error()}
Get stats about a specific index of your Meilisearch instance. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Stats.get(client, "movies")
{:ok, %{
numberOfDocuments: 19654,
isIndexing: false,
fieldDistribution: &{
"poster" => 19654,
"release_date" => 19654,
"title" => 19654,
"id" => 19654,
"overview" => 19654
}
}}