View Source Snap.Indexes (Snap v0.9.0)
Helper functions around index management.
Summary
Functions
Creates an alias for a versioned index, removing any existing aliases.
Deletes older timestamped indexes.
Creates an index.
Deletes an index.
Creates and loads a new index, switching the alias to it with zero-downtime.
Lists all the indexes in the cluster.
Lists all the timestamp versioned indexes starting with the prefix.
Refreshes an index.
Functions
@spec alias(module(), String.t(), String.t(), Keyword.t()) :: :ok | Snap.Cluster.error()
Creates an alias for a versioned index, removing any existing aliases.
@spec cleanup(module(), String.t(), non_neg_integer(), Keyword.t()) :: :ok | Snap.Cluster.error()
Deletes older timestamped indexes.
@spec create(module(), String.t(), map(), Keyword.t()) :: Snap.Cluster.result()
Creates an index.
@spec delete(module(), String.t(), Keyword.t()) :: Snap.Cluster.result()
Deletes an index.
@spec hotswap(Enumerable.t(), module(), String.t(), map(), Keyword.t()) :: :ok | Snap.Cluster.error() | {:error, Snap.BulkError.t()}
Creates and loads a new index, switching the alias to it with zero-downtime.
Takes an Enumerable
of Snap.Bulk
actions, and builds a new index from
it. Refreshes it, updates the alias to it, and cleans up the old indexes,
leaving the previous one behind.
May return Snap.Cluster.error/0
or a Snap.BulkError
containing a list
of failed bulk actions.
@spec list(module(), Keyword.t()) :: {:ok, [String.t()]} | Snap.Cluster.error()
Lists all the indexes in the cluster.
@spec list_starting_with(module(), String.t(), Keyword.t()) :: {:ok, [String.t()]} | Snap.Cluster.error()
Lists all the timestamp versioned indexes starting with the prefix.
@spec refresh(cluster :: module(), index :: String.t(), opts :: Keyword.t()) :: :ok | Snap.Cluster.error()
Refreshes an index.