Dowser.Elasticsearch.Index (Dowser.Elasticsearch v0.1.0)

View Source

The Elasticsearch indices APIs — every endpoint tagged indices in the Elasticsearch OpenAPI specification (index management, mappings, settings, aliases, templates, dangling indices, …) — plus segment/1, the index-target helper used by all API modules.

Built on Dowser.Client. Required Elasticsearch attributes are positional arguments; everything optional lives in opts.

Shared conventions

  • An index target may be nil (all indices), a single index/alias/ data-stream name (string or atom), or a list of them (joined with ,). Endpoints that accept an optional target take it as the :index option; endpoints that require one take it as the first argument.
  • Path parameters such as name, fields or metric accept the same shapes as an index target.
  • Endpoints that accept a request body take it as their first argument, required — pass %{} to send nothing.
  • HEAD existence checks come as a pair where the ? variant plays the bang role: index_exists/2 returns {:ok, boolean()} or {:error, exception}, index_exists?/2 returns the bare boolean (404false) and raises on genuine errors.

All remaining options are forwarded to Dowser.Client.request/4, e.g. :config, :params (query-string parameters), :format, :http_adapter, :json_adapter and :http_opts (including :headers).

On a 2xx response every function returns {:ok, body} with the decoded response body. A non-2xx response returns {:error, %Dowser.Elasticsearch.Error{}}; a transport, encoding or decoding failure returns {:error, exception} from Dowser.Client. Each function has a bang variant that returns the body directly or raises the error exception.

Summary

Types

A path parameter: a single name, or several (joined with ,).

t()

No index (all), a single index, or several indices.

Functions

Adds the block block (e.g. "write", "read_only") to one or several indices (Add block API).

Like add_block/3, but returns the body directly or raises the error exception.

Checks whether one or several aliases exist (Alias exists API).

Like alias_exists/2, but returns the boolean directly (404false) or raises the error exception.

Runs text through an analyzer (Analyze API).

Like analyze/2, but returns the body directly or raises the error exception.

Clears the caches of one, several, or all indices (Clear cache API).

Like clear_cache/1, but returns the body directly or raises the error exception.

Clones the index index into target (Clone index API).

Like clone/4, but returns the body directly or raises the error exception.

Closes one or several indices (Close index API).

Like close/2, but returns the body directly or raises the error exception.

Checks whether the component template name exists (Component template exists API).

Like component_template_exists/2, but returns the boolean directly (404false) or raises the error exception.

Like create_index/3, but returns the body directly or raises the error exception.

Deletes the alias name from one or several indices (Delete alias API).

Like delete_alias/3, but returns the body directly or raises the error exception.

Deletes one or several component templates (Delete component template API).

Like delete_component_template/2, but returns the body directly or raises the error exception.

Like delete_dangling_index/2, but returns the body directly or raises the error exception.

Removes the lifecycle from one or several data streams (Delete data lifecycle API).

Like delete_data_lifecycle/2, but returns the body directly or raises the error exception.

Deletes one or several indices (Delete index API).

Like delete_index/2, but returns the body directly or raises the error exception.

Deletes one or several index templates (Delete index template API).

Like delete_index_template/2, but returns the body directly or raises the error exception.

Deletes the legacy index template name (Delete template API).

Like delete_template/2, but returns the body directly or raises the error exception.

Analyzes the disk usage of each field of one or several indices (Disk usage API).

Like disk_usage/2, but returns the body directly or raises the error exception.

Returns field-usage statistics for one or several indices (Field usage stats API).

Like field_usage_stats/2, but returns the body directly or raises the error exception.

Flushes one, several, or all indices (Flush API).

Like flush/1, but returns the body directly or raises the error exception.

Force-merges the segments of one, several, or all indices (Force merge API).

Like forcemerge/1, but returns the body directly or raises the error exception.

Returns one, several, or all aliases (Get alias API).

Like get_alias/1, but returns the body directly or raises the error exception.

Returns one or several component templates (Get component template API).

Like get_component_template/2, but returns the body directly or raises the error exception.

Returns the mapping of one or several fields (Get field mapping API).

Like get_field_mapping/2, but returns the body directly or raises the error exception.

Returns information about one or several indices (Get index API).

Like get_index/2, but returns the body directly or raises the error exception.

Returns one or several index templates (Get index template API).

Like get_index_template/2, but returns the body directly or raises the error exception.

Returns the mapping of one, several, or all indices (Get mapping API).

Like get_mapping/1, but returns the body directly or raises the error exception.

Returns the settings of one, several, or all indices (Get index settings API).

Like get_settings/1, but returns the body directly or raises the error exception.

Returns one or several legacy index templates (Get template API).

Like get_template/2, but returns the body directly or raises the error exception.

Like import_dangling_index/2, but returns the body directly or raises the error exception.

Checks whether one or several indices exist (Exists API).

Like index_exists/2, but returns the boolean directly (404false) or raises the error exception.

Checks whether the index template name exists (Index template exists API).

Like index_template_exists/2, but returns the boolean directly (404false) or raises the error exception.

Lists the dangling indices of the cluster (List dangling indices API).

Like list_dangling_indices/1, but returns the body directly or raises the error exception.

Opens one or several closed indices (Open index API).

Like open/2, but returns the body directly or raises the error exception.

Creates or updates the alias name on one or several indices (Create or update alias API).

Like put_alias/4, but returns the body directly or raises the error exception.

Like put_component_template/3, but returns the body directly or raises the error exception.

Like put_index_template/3, but returns the body directly or raises the error exception.

Updates the mapping of one or several indices (Put mapping API).

Like put_mapping/3, but returns the body directly or raises the error exception.

Updates the settings of one, several, or all indices (Update index settings API).

Like put_settings/2, but returns the body directly or raises the error exception.

Creates or updates the legacy index template name (Create or update template API).

Like put_template/3, but returns the body directly or raises the error exception.

Returns shard-recovery information for one, several, or all indices (Index recovery API).

Like recovery/1, but returns the body directly or raises the error exception.

Refreshes one, several, or all indices (Refresh API).

Like refresh/1, but returns the body directly or raises the error exception.

Reloads the search analyzers of one or several indices (Reload search analyzers API).

Like reload_search_analyzers/2, but returns the body directly or raises the error exception.

Removes the block block from one or several indices (Remove block API).

Like remove_block/3, but returns the body directly or raises the error exception.

Resolves cluster expressions (for cross-cluster search) and reports each remote's availability (Resolve cluster API).

Like resolve_cluster/2, but returns the body directly or raises the error exception.

Resolves names (with wildcards) to indices, aliases and data streams (Resolve index API).

Like resolve_index/2, but returns the body directly or raises the error exception.

Rolls the rollover target target (an alias or data stream) over to a new index (Rollover API).

Like rollover/3, but returns the body directly or raises the error exception.

Encodes an index target into a comma-separated, URL-encoded path segment.

Returns the shard segments of one, several, or all indices (Segments API).

Like segments/1, but returns the body directly or raises the error exception.

Returns shard-store information for one, several, or all indices (Shard stores API).

Like shard_stores/1, but returns the body directly or raises the error exception.

Shrinks the index index into target, with fewer primary shards (Shrink index API).

Like shrink/4, but returns the body directly or raises the error exception.

Simulates applying the matching index templates to the index name (Simulate index API).

Like simulate_index_template/3, but returns the body directly or raises the error exception.

Simulates the resolved composition of the index template name (Simulate template API).

Like simulate_template/3, but returns the body directly or raises the error exception.

Splits the index index into target, with more primary shards (Split index API).

Like split/4, but returns the body directly or raises the error exception.

Returns statistics for one, several, or all indices (Index stats API).

Like stats/1, but returns the body directly or raises the error exception.

Checks whether one or several legacy index templates exist (Template exists API).

Like template_exists/2, but returns the boolean directly (404false) or raises the error exception.

Applies several alias actions atomically (Update aliases API).

Like update_aliases/2, but returns the body directly or raises the error exception.

Validates a query without running it (Validate query API).

Like validate_query/2, but returns the body directly or raises the error exception.

Types

body()

@type body() :: term()

exists_result()

@type exists_result() :: {:ok, boolean()} | {:error, Exception.t()}

name()

@type name() :: String.t() | atom() | [String.t() | atom()]

A path parameter: a single name, or several (joined with ,).

result()

@type result() :: {:ok, body()} | {:error, Exception.t()}

t()

@type t() :: nil | String.t() | atom() | [String.t() | atom()]

No index (all), a single index, or several indices.

Functions

add_block(index, block, opts \\ [])

@spec add_block(t(), name(), keyword()) :: result()

Adds the block block (e.g. "write", "read_only") to one or several indices (Add block API).

add_block!(index, block, opts \\ [])

@spec add_block!(t(), name(), keyword()) :: body()

Like add_block/3, but returns the body directly or raises the error exception.

alias_exists(name, opts \\ [])

@spec alias_exists(
  name(),
  keyword()
) :: exists_result()

Checks whether one or several aliases exist (Alias exists API).

Returns {:ok, true}, {:ok, false} or {:error, exception}.

Options

  • :index — index target; absent for all indices.

alias_exists?(name, opts \\ [])

@spec alias_exists?(
  name(),
  keyword()
) :: boolean()

Like alias_exists/2, but returns the boolean directly (404false) or raises the error exception.

analyze(body, opts \\ [])

@spec analyze(
  map(),
  keyword()
) :: result()

Runs text through an analyzer (Analyze API).

body is the request body, e.g. %{analyzer: "standard", text: "hello"}.

Options

  • :index — index whose analyzers to use; absent for the cluster default.

analyze!(body, opts \\ [])

@spec analyze!(
  map(),
  keyword()
) :: body()

Like analyze/2, but returns the body directly or raises the error exception.

clear_cache(opts \\ [])

@spec clear_cache(keyword()) :: result()

Clears the caches of one, several, or all indices (Clear cache API).

Options

  • :index — index target; absent for all indices.

clear_cache!(opts \\ [])

@spec clear_cache!(keyword()) :: body()

Like clear_cache/1, but returns the body directly or raises the error exception.

clone(body, index, target, opts \\ [])

@spec clone(map(), t(), name(), keyword()) :: result()

Clones the index index into target (Clone index API).

body is the request body (e.g. settings, aliases); pass %{} to send nothing.

clone!(body, index, target, opts \\ [])

@spec clone!(map(), t(), name(), keyword()) :: body()

Like clone/4, but returns the body directly or raises the error exception.

close(index, opts \\ [])

@spec close(
  t(),
  keyword()
) :: result()

Closes one or several indices (Close index API).

close!(index, opts \\ [])

@spec close!(
  t(),
  keyword()
) :: body()

Like close/2, but returns the body directly or raises the error exception.

component_template_exists(name, opts \\ [])

@spec component_template_exists(
  name(),
  keyword()
) :: exists_result()

Checks whether the component template name exists (Component template exists API).

Returns {:ok, true}, {:ok, false} or {:error, exception}.

component_template_exists?(name, opts \\ [])

@spec component_template_exists?(
  name(),
  keyword()
) :: boolean()

Like component_template_exists/2, but returns the boolean directly (404false) or raises the error exception.

create_index(body, index, opts \\ [])

@spec create_index(map(), t(), keyword()) :: result()

Creates the index index (Create index API).

body is the request body (e.g. settings, mappings, aliases); pass %{} to send nothing.

create_index!(body, index, opts \\ [])

@spec create_index!(map(), t(), keyword()) :: body()

Like create_index/3, but returns the body directly or raises the error exception.

delete_alias(index, name, opts \\ [])

@spec delete_alias(t(), name(), keyword()) :: result()

Deletes the alias name from one or several indices (Delete alias API).

delete_alias!(index, name, opts \\ [])

@spec delete_alias!(t(), name(), keyword()) :: body()

Like delete_alias/3, but returns the body directly or raises the error exception.

delete_component_template(name, opts \\ [])

@spec delete_component_template(
  name(),
  keyword()
) :: result()

Deletes one or several component templates (Delete component template API).

delete_component_template!(name, opts \\ [])

@spec delete_component_template!(
  name(),
  keyword()
) :: body()

Like delete_component_template/2, but returns the body directly or raises the error exception.

delete_dangling_index(index_uuid, opts \\ [])

@spec delete_dangling_index(
  id :: String.t(),
  keyword()
) :: result()

Deletes the dangling index index_uuid (Delete dangling index API).

Requires params: [accept_data_loss: true].

delete_dangling_index!(index_uuid, opts \\ [])

@spec delete_dangling_index!(
  id :: String.t(),
  keyword()
) :: body()

Like delete_dangling_index/2, but returns the body directly or raises the error exception.

delete_data_lifecycle(name, opts \\ [])

@spec delete_data_lifecycle(
  name(),
  keyword()
) :: result()

Removes the lifecycle from one or several data streams (Delete data lifecycle API).

delete_data_lifecycle!(name, opts \\ [])

@spec delete_data_lifecycle!(
  name(),
  keyword()
) :: body()

Like delete_data_lifecycle/2, but returns the body directly or raises the error exception.

delete_index(index, opts \\ [])

@spec delete_index(
  t(),
  keyword()
) :: result()

Deletes one or several indices (Delete index API).

delete_index!(index, opts \\ [])

@spec delete_index!(
  t(),
  keyword()
) :: body()

Like delete_index/2, but returns the body directly or raises the error exception.

delete_index_template(name, opts \\ [])

@spec delete_index_template(
  name(),
  keyword()
) :: result()

Deletes one or several index templates (Delete index template API).

delete_index_template!(name, opts \\ [])

@spec delete_index_template!(
  name(),
  keyword()
) :: body()

Like delete_index_template/2, but returns the body directly or raises the error exception.

delete_template(name, opts \\ [])

This function is deprecated. Use delete_index_template/2 instead.
@spec delete_template(
  name(),
  keyword()
) :: result()

Deletes the legacy index template name (Delete template API).

delete_template!(name, opts \\ [])

This function is deprecated. Use delete_index_template!/2 instead.
@spec delete_template!(
  name(),
  keyword()
) :: body()

Like delete_template/2, but returns the body directly or raises the error exception.

disk_usage(index, opts \\ [])

@spec disk_usage(
  t(),
  keyword()
) :: result()

Analyzes the disk usage of each field of one or several indices (Disk usage API).

disk_usage!(index, opts \\ [])

@spec disk_usage!(
  t(),
  keyword()
) :: body()

Like disk_usage/2, but returns the body directly or raises the error exception.

field_usage_stats(index, opts \\ [])

@spec field_usage_stats(
  t(),
  keyword()
) :: result()

Returns field-usage statistics for one or several indices (Field usage stats API).

field_usage_stats!(index, opts \\ [])

@spec field_usage_stats!(
  t(),
  keyword()
) :: body()

Like field_usage_stats/2, but returns the body directly or raises the error exception.

flush(opts \\ [])

@spec flush(keyword()) :: result()

Flushes one, several, or all indices (Flush API).

Options

  • :index — index target; absent for all indices.

flush!(opts \\ [])

@spec flush!(keyword()) :: body()

Like flush/1, but returns the body directly or raises the error exception.

forcemerge(opts \\ [])

@spec forcemerge(keyword()) :: result()

Force-merges the segments of one, several, or all indices (Force merge API).

Options

  • :index — index target; absent for all indices.

forcemerge!(opts \\ [])

@spec forcemerge!(keyword()) :: body()

Like forcemerge/1, but returns the body directly or raises the error exception.

get_alias(opts \\ [])

@spec get_alias(keyword()) :: result()

Returns one, several, or all aliases (Get alias API).

Options

  • :index — index target; absent for all indices.
  • :name — restrict the result to one or several alias names.

get_alias!(opts \\ [])

@spec get_alias!(keyword()) :: body()

Like get_alias/1, but returns the body directly or raises the error exception.

get_component_template(name, opts \\ [])

@spec get_component_template(
  name(),
  keyword()
) :: result()

Returns one or several component templates (Get component template API).

get_component_template!(name, opts \\ [])

@spec get_component_template!(
  name(),
  keyword()
) :: body()

Like get_component_template/2, but returns the body directly or raises the error exception.

get_field_mapping(fields, opts \\ [])

@spec get_field_mapping(
  name(),
  keyword()
) :: result()

Returns the mapping of one or several fields (Get field mapping API).

Options

  • :index — index target; absent for all indices.

get_field_mapping!(fields, opts \\ [])

@spec get_field_mapping!(
  name(),
  keyword()
) :: body()

Like get_field_mapping/2, but returns the body directly or raises the error exception.

get_index(index, opts \\ [])

@spec get_index(
  t(),
  keyword()
) :: result()

Returns information about one or several indices (Get index API).

get_index!(index, opts \\ [])

@spec get_index!(
  t(),
  keyword()
) :: body()

Like get_index/2, but returns the body directly or raises the error exception.

get_index_template(name, opts \\ [])

@spec get_index_template(
  name(),
  keyword()
) :: result()

Returns one or several index templates (Get index template API).

get_index_template!(name, opts \\ [])

@spec get_index_template!(
  name(),
  keyword()
) :: body()

Like get_index_template/2, but returns the body directly or raises the error exception.

get_mapping(opts \\ [])

@spec get_mapping(keyword()) :: result()

Returns the mapping of one, several, or all indices (Get mapping API).

Options

  • :index — index target; absent for all indices.

get_mapping!(opts \\ [])

@spec get_mapping!(keyword()) :: body()

Like get_mapping/1, but returns the body directly or raises the error exception.

get_settings(opts \\ [])

@spec get_settings(keyword()) :: result()

Returns the settings of one, several, or all indices (Get index settings API).

Options

  • :index — index target; absent for all indices.
  • :name — restrict the result to one or several setting names.

get_settings!(opts \\ [])

@spec get_settings!(keyword()) :: body()

Like get_settings/1, but returns the body directly or raises the error exception.

get_template(name, opts \\ [])

This function is deprecated. Use get_index_template/2 instead.
@spec get_template(
  name(),
  keyword()
) :: result()

Returns one or several legacy index templates (Get template API).

get_template!(name, opts \\ [])

This function is deprecated. Use get_index_template!/2 instead.
@spec get_template!(
  name(),
  keyword()
) :: body()

Like get_template/2, but returns the body directly or raises the error exception.

import_dangling_index(index_uuid, opts \\ [])

@spec import_dangling_index(
  id :: String.t(),
  keyword()
) :: result()

Imports the dangling index index_uuid (Import dangling index API).

Requires params: [accept_data_loss: true].

import_dangling_index!(index_uuid, opts \\ [])

@spec import_dangling_index!(
  id :: String.t(),
  keyword()
) :: body()

Like import_dangling_index/2, but returns the body directly or raises the error exception.

index_exists(index, opts \\ [])

@spec index_exists(
  t(),
  keyword()
) :: exists_result()

Checks whether one or several indices exist (Exists API).

Returns {:ok, true}, {:ok, false} or {:error, exception}.

index_exists?(index, opts \\ [])

@spec index_exists?(
  t(),
  keyword()
) :: boolean()

Like index_exists/2, but returns the boolean directly (404false) or raises the error exception.

index_template_exists(name, opts \\ [])

@spec index_template_exists(
  name(),
  keyword()
) :: exists_result()

Checks whether the index template name exists (Index template exists API).

Returns {:ok, true}, {:ok, false} or {:error, exception}.

index_template_exists?(name, opts \\ [])

@spec index_template_exists?(
  name(),
  keyword()
) :: boolean()

Like index_template_exists/2, but returns the boolean directly (404false) or raises the error exception.

list_dangling_indices(opts \\ [])

@spec list_dangling_indices(keyword()) :: result()

Lists the dangling indices of the cluster (List dangling indices API).

list_dangling_indices!(opts \\ [])

@spec list_dangling_indices!(keyword()) :: body()

Like list_dangling_indices/1, but returns the body directly or raises the error exception.

open(index, opts \\ [])

@spec open(
  t(),
  keyword()
) :: result()

Opens one or several closed indices (Open index API).

open!(index, opts \\ [])

@spec open!(
  t(),
  keyword()
) :: body()

Like open/2, but returns the body directly or raises the error exception.

put_alias(body, index, name, opts \\ [])

@spec put_alias(map(), t(), name(), keyword()) :: result()

Creates or updates the alias name on one or several indices (Create or update alias API).

body is the request body (e.g. filter, routing); pass %{} to send nothing.

put_alias!(body, index, name, opts \\ [])

@spec put_alias!(map(), t(), name(), keyword()) :: body()

Like put_alias/4, but returns the body directly or raises the error exception.

put_component_template(template, name, opts \\ [])

@spec put_component_template(map(), name(), keyword()) :: result()

Creates or updates the component template name (Create or update component template API).

template is the request body, e.g. %{template: %{settings: %{...}}}.

put_component_template!(template, name, opts \\ [])

@spec put_component_template!(map(), name(), keyword()) :: body()

Like put_component_template/3, but returns the body directly or raises the error exception.

put_index_template(template, name, opts \\ [])

@spec put_index_template(map(), name(), keyword()) :: result()

Creates or updates the index template name (Create or update index template API).

template is the request body, e.g. %{index_patterns: ["posts-*"], template: %{...}}.

put_index_template!(template, name, opts \\ [])

@spec put_index_template!(map(), name(), keyword()) :: body()

Like put_index_template/3, but returns the body directly or raises the error exception.

put_mapping(mapping, index, opts \\ [])

@spec put_mapping(map(), t(), keyword()) :: result()

Updates the mapping of one or several indices (Put mapping API).

mapping is the mapping body, e.g. %{properties: %{title: %{type: "text"}}}.

put_mapping!(mapping, index, opts \\ [])

@spec put_mapping!(map(), t(), keyword()) :: body()

Like put_mapping/3, but returns the body directly or raises the error exception.

put_settings(settings, opts \\ [])

@spec put_settings(
  map(),
  keyword()
) :: result()

Updates the settings of one, several, or all indices (Update index settings API).

settings is the settings body, e.g. %{index: %{number_of_replicas: 2}}.

Options

  • :index — index target; absent for all indices.

put_settings!(settings, opts \\ [])

@spec put_settings!(
  map(),
  keyword()
) :: body()

Like put_settings/2, but returns the body directly or raises the error exception.

put_template(template, name, opts \\ [])

This function is deprecated. Use put_index_template/3 instead.
@spec put_template(map(), name(), keyword()) :: result()

Creates or updates the legacy index template name (Create or update template API).

put_template!(template, name, opts \\ [])

This function is deprecated. Use put_index_template!/3 instead.
@spec put_template!(map(), name(), keyword()) :: body()

Like put_template/3, but returns the body directly or raises the error exception.

recovery(opts \\ [])

@spec recovery(keyword()) :: result()

Returns shard-recovery information for one, several, or all indices (Index recovery API).

Options

  • :index — index target; absent for all indices.

recovery!(opts \\ [])

@spec recovery!(keyword()) :: body()

Like recovery/1, but returns the body directly or raises the error exception.

refresh(opts \\ [])

@spec refresh(keyword()) :: result()

Refreshes one, several, or all indices (Refresh API).

Options

  • :index — index target; absent for all indices.

refresh!(opts \\ [])

@spec refresh!(keyword()) :: body()

Like refresh/1, but returns the body directly or raises the error exception.

reload_search_analyzers(index, opts \\ [])

@spec reload_search_analyzers(
  t(),
  keyword()
) :: result()

Reloads the search analyzers of one or several indices (Reload search analyzers API).

reload_search_analyzers!(index, opts \\ [])

@spec reload_search_analyzers!(
  t(),
  keyword()
) :: body()

Like reload_search_analyzers/2, but returns the body directly or raises the error exception.

remove_block(index, block, opts \\ [])

@spec remove_block(t(), name(), keyword()) :: result()

Removes the block block from one or several indices (Remove block API).

remove_block!(index, block, opts \\ [])

@spec remove_block!(t(), name(), keyword()) :: body()

Like remove_block/3, but returns the body directly or raises the error exception.

resolve_cluster(name, opts \\ [])

@spec resolve_cluster(
  name(),
  keyword()
) :: result()

Resolves cluster expressions (for cross-cluster search) and reports each remote's availability (Resolve cluster API).

resolve_cluster!(name, opts \\ [])

@spec resolve_cluster!(
  name(),
  keyword()
) :: body()

Like resolve_cluster/2, but returns the body directly or raises the error exception.

resolve_index(name, opts \\ [])

@spec resolve_index(
  name(),
  keyword()
) :: result()

Resolves names (with wildcards) to indices, aliases and data streams (Resolve index API).

resolve_index!(name, opts \\ [])

@spec resolve_index!(
  name(),
  keyword()
) :: body()

Like resolve_index/2, but returns the body directly or raises the error exception.

rollover(body, target, opts \\ [])

@spec rollover(map(), name(), keyword()) :: result()

Rolls the rollover target target (an alias or data stream) over to a new index (Rollover API).

body is the request body (e.g. conditions, settings, mappings, aliases); pass %{} to send nothing.

Options

  • :new_index — explicit name for the new index; absent to let Elasticsearch derive it.

rollover!(body, target, opts \\ [])

@spec rollover!(map(), name(), keyword()) :: body()

Like rollover/3, but returns the body directly or raises the error exception.

segment(index)

@spec segment(t()) :: String.t() | nil

Encodes an index target into a comma-separated, URL-encoded path segment.

Returns nil when the target is empty (nil, "" or []), so callers can choose between /_search and /posts/_search.

Examples

iex> Dowser.Elasticsearch.Index.segment(nil)
nil

iex> Dowser.Elasticsearch.Index.segment("posts")
"posts"

iex> Dowser.Elasticsearch.Index.segment(["posts", "my comments"])
"posts,my%20comments"

segments(opts \\ [])

@spec segments(keyword()) :: result()

Returns the shard segments of one, several, or all indices (Segments API).

Options

  • :index — index target; absent for all indices.

segments!(opts \\ [])

@spec segments!(keyword()) :: body()

Like segments/1, but returns the body directly or raises the error exception.

shard_stores(opts \\ [])

@spec shard_stores(keyword()) :: result()

Returns shard-store information for one, several, or all indices (Shard stores API).

Options

  • :index — index target; absent for all indices.

shard_stores!(opts \\ [])

@spec shard_stores!(keyword()) :: body()

Like shard_stores/1, but returns the body directly or raises the error exception.

shrink(body, index, target, opts \\ [])

@spec shrink(map(), t(), name(), keyword()) :: result()

Shrinks the index index into target, with fewer primary shards (Shrink index API).

body is the request body (e.g. settings, aliases); pass %{} to send nothing.

shrink!(body, index, target, opts \\ [])

@spec shrink!(map(), t(), name(), keyword()) :: body()

Like shrink/4, but returns the body directly or raises the error exception.

simulate_index_template(body, name, opts \\ [])

@spec simulate_index_template(map(), name(), keyword()) :: result()

Simulates applying the matching index templates to the index name (Simulate index API).

body is an optional template body to simulate alongside the existing ones; pass %{} to send nothing.

simulate_index_template!(body, name, opts \\ [])

@spec simulate_index_template!(map(), name(), keyword()) :: body()

Like simulate_index_template/3, but returns the body directly or raises the error exception.

simulate_template(body, name, opts \\ [])

@spec simulate_template(map(), name(), keyword()) :: result()

Simulates the resolved composition of the index template name (Simulate template API).

body is an optional template body to simulate instead of a stored one; pass %{} to send nothing.

simulate_template!(body, name, opts \\ [])

@spec simulate_template!(map(), name(), keyword()) :: body()

Like simulate_template/3, but returns the body directly or raises the error exception.

split(body, index, target, opts \\ [])

@spec split(map(), t(), name(), keyword()) :: result()

Splits the index index into target, with more primary shards (Split index API).

body is the request body (e.g. settings, aliases); pass %{} to send nothing.

split!(body, index, target, opts \\ [])

@spec split!(map(), t(), name(), keyword()) :: body()

Like split/4, but returns the body directly or raises the error exception.

stats(opts \\ [])

@spec stats(keyword()) :: result()

Returns statistics for one, several, or all indices (Index stats API).

Options

  • :index — index target; absent for all indices.
  • :metric — restrict the result to one or several metrics.

stats!(opts \\ [])

@spec stats!(keyword()) :: body()

Like stats/1, but returns the body directly or raises the error exception.

template_exists(name, opts \\ [])

@spec template_exists(
  name(),
  keyword()
) :: exists_result()

Checks whether one or several legacy index templates exist (Template exists API).

Returns {:ok, true}, {:ok, false} or {:error, exception}.

template_exists?(name, opts \\ [])

@spec template_exists?(
  name(),
  keyword()
) :: boolean()

Like template_exists/2, but returns the boolean directly (404false) or raises the error exception.

update_aliases(actions, opts \\ [])

@spec update_aliases(
  [map()],
  keyword()
) :: result()

Applies several alias actions atomically (Update aliases API).

actions is the list of actions, sent as %{actions: actions}, e.g. [%{add: %{index: "posts", alias: "blog"}}].

update_aliases!(actions, opts \\ [])

@spec update_aliases!(
  [map()],
  keyword()
) :: body()

Like update_aliases/2, but returns the body directly or raises the error exception.

validate_query(query, opts \\ [])

@spec validate_query(
  map(),
  keyword()
) :: result()

Validates a query without running it (Validate query API).

query is the validate body (query DSL map).

Options

  • :index — index target; absent for all indices.

validate_query!(query, opts \\ [])

@spec validate_query!(
  map(),
  keyword()
) :: body()

Like validate_query/2, but returns the body directly or raises the error exception.