View Source Snap.Indexes (Snap v0.11.3)

Helper functions around index management.

Summary

Functions

Creates an alias for a versioned index, removing any existing aliases.

Deletes older timestamped indexes.

Get an index's mapping.

Get an index's setting using a comma separate list or wildcard expression

Get an index's stats using a metric. Metric is a comma separated list of metrics.

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.

Updates the given index's mapping.

Functions

Link to this function

alias(cluster, index, alias, opts \\ [])

View Source
@spec alias(module(), String.t(), String.t(), Keyword.t()) ::
  :ok | Snap.Cluster.error()

Creates an alias for a versioned index, removing any existing aliases.

Link to this function

cleanup(cluster, alias, preserve \\ 2, opts \\ [])

View Source
@spec cleanup(module(), String.t(), non_neg_integer(), Keyword.t()) ::
  :ok | Snap.Cluster.error()

Deletes older timestamped indexes.

Link to this function

close(cluster, index, params \\ [], opts \\ [])

View Source
@spec close(module(), String.t(), Keyword.t(), Keyword.t()) :: Snap.Cluster.result()

Closes an open index.

See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-close.html

Link to this function

create(cluster, index, mapping, opts \\ [])

View Source
@spec create(module(), String.t(), map(), Keyword.t()) :: Snap.Cluster.result()

Creates an index.

Link to this function

delete(cluster, index, opts \\ [])

View Source
@spec delete(module(), String.t(), Keyword.t()) :: Snap.Cluster.result()

Deletes an index.

Link to this function

get_mapping(cluster, index, opts \\ [])

View Source
@spec get_mapping(module(), String.t(), Keyword.t()) :: Snap.Cluster.result()

Get an index's mapping.

Link to this function

get_setting(cluster, index, setting, params \\ [], opts \\ [])

View Source
@spec get_setting(module(), String.t(), String.t(), Keyword.t(), Keyword.t()) ::
  Snap.Cluster.result()

Get an index's setting using a comma separate list or wildcard expression

See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html

Link to this function

get_settings(cluster, index, params \\ [], opts \\ [])

View Source
@spec get_settings(module(), String.t(), Keyword.t(), Keyword.t()) ::
  Snap.Cluster.result()

Get all of the index's settings.

See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html

Link to this function

get_shard_stores(cluster, index, params \\ [], opts \\ [])

View Source
@spec get_shard_stores(module(), String.t(), Keyword.t(), Keyword.t()) ::
  Snap.Cluster.result()

Get an index's shard stores.

See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shards-stores.html

Link to this function

get_stat(cluster, index, metric, params \\ [], opts \\ [])

View Source
@spec get_stat(module(), String.t(), String.t(), Keyword.t(), Keyword.t()) ::
  Snap.Cluster.result()

Get an index's stats using a metric. Metric is a comma separated list of metrics.

See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html

Link to this function

get_stats(cluster, index, params \\ [], opts \\ [])

View Source
@spec get_stats(module(), String.t(), Keyword.t(), Keyword.t()) ::
  Snap.Cluster.result()

Get an index's stats.

See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html

Link to this function

hotswap(stream, cluster, alias, mapping, opts \\ [])

View Source
@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.

Link to this function

list(cluster, opts \\ [])

View Source
@spec list(module(), Keyword.t()) :: {:ok, [String.t()]} | Snap.Cluster.error()

Lists all the indexes in the cluster.

Link to this function

list_starting_with(cluster, prefix, opts \\ [])

View Source
@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.

Link to this function

open(cluster, index, params \\ [], opts \\ [])

View Source
@spec open(module(), String.t(), Keyword.t(), Keyword.t()) :: Snap.Cluster.result()

Opens a closed index.

See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html

Link to this function

refresh(cluster, index, opts \\ [])

View Source
@spec refresh(cluster :: module(), index :: String.t(), opts :: Keyword.t()) ::
  :ok | Snap.Cluster.error()

Refreshes an index.

Link to this function

update_mapping(cluster, index, mapping, opts \\ [])

View Source
@spec update_mapping(module(), String.t(), map(), Keyword.t()) ::
  Snap.Cluster.result()

Updates the given index's mapping.

See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html

Link to this function

update_settings(cluster, index, settings, params \\ [], opts \\ [])

View Source
@spec update_settings(module(), String.t(), map(), Keyword.t(), Keyword.t()) ::
  Snap.Cluster.result()

Update an index's settings.

See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html