Dowser. Opensearch. IndexSettings
(Dowser.Opensearch v0.1.0)
View Source
The OpenSearch index settings APIs — the endpoints tagged Index Settings in
the OpenSearch OpenAPI specification.
Built on Dowser.Client. Required OpenSearch attributes are positional
arguments; everything optional lives in opts.
OpenSearch tags these separately from the index APIs, so they live here
rather than on Dowser.Opensearch.Index; the index-target helper they share
is Dowser.Opensearch.Target.
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,). Both endpoints accept one as the:indexoption. put_settings/2takes the settings body as its first argument, required.
All remaining options are forwarded to Dowser.Client.request/4, e.g.
:context, :params (query-string parameters), :format, :keys and
:http_opts (including :headers) — plus :codec, this package's own,
which picks the per-field codec for this one request (see
Dowser.Opensearch.Codec).
On a 2xx response every function returns {:ok, body} with the decoded
response body. A non-2xx response returns
{:error, %Dowser.Opensearch.Error{}}; a transport, encoding or decoding
failure returns {:error, exception} from Dowser.Client. A required
argument that is missing or empty is reported the same way, before any
request is made: {:error, %ArgumentError{}}. Each function has a bang
variant that returns the body directly or raises the error exception.
Summary
Functions
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.
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.
Types
@type body() :: term()
@type index() :: Dowser.Opensearch.Target.t()
@type name() :: Dowser.Opensearch.Target.name()
@type result() :: {:ok, body()} | {:error, Exception.t()}
Functions
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, which may include wildcards ("index.number_of_*").
Like get_settings/1, but returns the body directly or raises the error
exception.
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}}.
%{index: %{number_of_replicas: 2}}
|> Dowser.Opensearch.IndexSettings.put_settings(index: "posts")Only dynamic settings can be changed on an open index; a static one needs
the index closed first (Dowser.Opensearch.Index.close/2). Setting a value
to nil resets it to its default, which is how an index block added by
Dowser.Opensearch.Index.add_block/3 is cleared:
%{index: %{blocks: %{write: nil}}}
|> Dowser.Opensearch.IndexSettings.put_settings(index: "posts")Options
:index— index target; absent for all indices.
Like put_settings/2, but returns the body directly or raises the error
exception.