Dowser. Opensearch. DataStream
(Dowser.Opensearch v0.1.0)
View Source
The OpenSearch data stream APIs — every endpoint tagged Data Streams in the
OpenSearch OpenAPI specification.
Built on Dowser.Client. Required OpenSearch attributes are positional
arguments; everything optional lives in opts.
A data stream is an append-only, time-series abstraction over a set of hidden
backing indices. Creating one needs a matching index template with a
data_stream section already in place — see
Dowser.Opensearch.IndexTemplate.put_index_template/3 — because the template
is what tells OpenSearch how to build the backing indices. Rolling a stream
over to a fresh backing index is Dowser.Opensearch.Index.rollover/3.
Shared conventions
- A stream
nameis a required path parameter where an endpoint takes one, and may be several names (joined with,) or a wildcard on the reads. modify/2takes its action list as the first argument.
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
Creates the data stream name
(Create data stream API).
Like create_data_stream/2, but returns the body directly or raises the
error exception.
Returns statistics for one, several, or all data streams (Data stream stats API).
Like data_streams_stats/1, but returns the body directly or raises the
error exception.
Deletes one or several data streams, and their backing indices with them (Delete data stream API).
Like delete_data_stream/2, but returns the body directly or raises the
error exception.
Returns one, several, or all data streams (Get data stream API).
Like get_data_stream/1, but returns the body directly or raises the error
exception.
Changes which backing indices belong to which data streams (Modify data streams API).
Like modify/2, but returns the body directly or raises the error exception.
Types
@type body() :: term()
@type name() :: Dowser.Opensearch.Target.name()
@type result() :: {:ok, body()} | {:error, Exception.t()}
Functions
Creates the data stream name
(Create data stream API).
The endpoint takes no request body: everything about the stream comes from
the index template whose index_patterns match name, so that template has
to exist first.
Like create_data_stream/2, but returns the body directly or raises the
error exception.
Returns statistics for one, several, or all data streams (Data stream stats API).
Options
:name— restrict the result to one or several stream names; absent for all of them.
Like data_streams_stats/1, but returns the body directly or raises the
error exception.
Deletes one or several data streams, and their backing indices with them (Delete data stream API).
Like delete_data_stream/2, but returns the body directly or raises the
error exception.
Returns one, several, or all data streams (Get data stream API).
Options
:name— restrict the result to one or several stream names, which may include wildcards; absent for all of them.
Like get_data_stream/1, but returns the body directly or raises the error
exception.
Changes which backing indices belong to which data streams (Modify data streams API).
actions is the list of actions, sent as %{actions: actions} and applied
atomically, so a backing index never belongs to two streams or to none in
between:
Dowser.Opensearch.DataStream.modify([
%{remove_backing_index: %{data_stream: "logs", index: ".ds-logs-000001"}},
%{add_backing_index: %{data_stream: "logs-archive", index: ".ds-logs-000001"}}
])
Like modify/2, but returns the body directly or raises the error exception.