Dowser. Elasticsearch. Cat
(Dowser.Elasticsearch v0.4.1)
View Source
The Elasticsearch compact and aligned text (CaT) APIs — every endpoint tagged
cat in the
Elasticsearch OpenAPI specification.
Built on Dowser.Client. The cat endpoints take no request body and no
required attribute: each one's optional path parameter is an option, so every
function has the same opts-only signature.
JSON, not text
The cat APIs are meant for humans at a terminal and answer in aligned text by
default — but they honour the accept header Dowser.Client already sends,
so the response comes back as JSON and is decoded like every other endpoint:
a list of maps, one per row.
Dowser.Elasticsearch.Cat.indices!(index: "posts*")
#=> [%{"index" => "posts", "health" => "green", "docs.count" => "42", ...}]Every value in those maps is a string — that is what the cat APIs emit, JSON
or not. For the aligned text a terminal wants, ask for it explicitly: the
format query parameter wins over the header, and resp_format: :raw keeps
the body from being parsed as JSON.
Dowser.Elasticsearch.Cat.indices!(params: [format: "text", v: true], resp_format: :raw)Shared options
Most cat endpoints accept the same query parameters, passed through :params:
v— add the column headers.h— the columns to return, e.g.h: "index,docs.count".s— the columns to sort on, e.g.s: "docs.count:desc".bytes/time— the unit sizes and durations are expressed in ("kb","gb","s","ms", …).format— see above.
Use help/1 to ask an endpoint which columns it supports.
All remaining options are forwarded to Dowser.Client.request/4, e.g.
:context, :params (query-string parameters), :format, :keys 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
Functions
Returns the aliases of one, several, or all indices (Cat aliases API).
Like aliases/1, but returns the body directly or raises the error
exception.
Returns the disk space and shard count of each node (Cat allocation API).
Like allocation/1, but returns the body directly or raises the error
exception.
Returns the circuit breaker statistics of each node (Cat circuit breaker API).
Like circuit_breaker/1, but returns the body directly or raises the error
exception.
Returns the component templates (Cat component templates API).
Like component_templates/1, but returns the body directly or raises the
error exception.
Counts the documents of one, several, or all indices (Cat count API).
Like count/1, but returns the body directly or raises the error exception.
Returns the heap memory each field's fielddata uses, per node (Cat fielddata API).
Like fielddata/1, but returns the body directly or raises the error
exception.
Returns the cluster health (Cat health API).
Like health/1, but returns the body directly or raises the error exception.
Lists the available cat APIs — GET /_cat
(Cat help API).
Like help/1, but returns the endpoints directly or raises the error
exception.
Returns high-level information about one, several, or all indices (Cat indices API).
Like indices/1, but returns the body directly or raises the error
exception.
Returns the elected master node (Cat master API).
Like master/1, but returns the body directly or raises the error exception.
Returns the data frame analytics jobs (Cat data frame analytics API).
Like ml_data_frame_analytics/1, but returns the body directly or raises the
error exception.
Returns the datafeeds of the anomaly detection jobs (Cat datafeeds API).
Like ml_datafeeds/1, but returns the body directly or raises the error
exception.
Returns the anomaly detection jobs (Cat anomaly detectors API).
Like ml_jobs/1, but returns the body directly or raises the error
exception.
Returns the trained models and their allocations (Cat trained model API).
Like ml_trained_models/1, but returns the body directly or raises the error
exception.
Returns the custom node attributes (Cat nodeattrs API).
Like nodeattrs/1, but returns the body directly or raises the error
exception.
Returns the nodes of the cluster (Cat nodes API).
Like nodes/1, but returns the body directly or raises the error exception.
Returns the cluster-level changes not yet executed (Cat pending tasks API).
Like pending_tasks/1, but returns the body directly or raises the error
exception.
Returns the plugins installed on each node (Cat plugins API).
Like plugins/1, but returns the body directly or raises the error
exception.
Returns the shard recoveries — ongoing and completed — of one, several, or all indices (Cat recovery API).
Like recovery/1, but returns the body directly or raises the error
exception.
Returns the snapshot repositories of the cluster (Cat repositories API).
Like repositories/1, but returns the body directly or raises the error
exception.
Returns the low-level Lucene segments of one, several, or all indices (Cat segments API).
Like segments/1, but returns the body directly or raises the error
exception.
Returns the shards of one, several, or all indices, and the node each sits on (Cat shards API).
Like shards/1, but returns the body directly or raises the error exception.
Returns the snapshots held by one or several repositories (Cat snapshots API).
Like snapshots/1, but returns the body directly or raises the error
exception.
Returns the tasks currently running on the nodes (Cat task management API).
Like tasks/1, but returns the body directly or raises the error exception.
Returns the index templates (Cat templates API).
Like templates/1, but returns the body directly or raises the error
exception.
Returns the thread pools of each node (Cat thread pool API).
Like thread_pool/1, but returns the body directly or raises the error
exception.
Returns the transforms of the cluster (Cat transforms API).
Like transforms/1, but returns the body directly or raises the error
exception.
Types
@type body() :: term()
@type index() :: Dowser.Elasticsearch.Index.t()
@type name() :: Dowser.Elasticsearch.Index.name()
A path parameter: a single name, or several (joined with ,).
@type result() :: {:ok, body()} | {:error, Exception.t()}
Functions
Returns the aliases of one, several, or all indices (Cat aliases API).
Options
:name— restrict the result to one or several alias names.
Like aliases/1, but returns the body directly or raises the error
exception.
Returns the disk space and shard count of each node (Cat allocation API).
Options
:node_id— restrict the result to one or several node ids.
Like allocation/1, but returns the body directly or raises the error
exception.
Returns the circuit breaker statistics of each node (Cat circuit breaker API).
Options
:circuit_breaker_patterns— restrict the result to one or several circuit breaker names or patterns.
Like circuit_breaker/1, but returns the body directly or raises the error
exception.
Returns the component templates (Cat component templates API).
Options
:name— restrict the result to one or several component template names or patterns.
Like component_templates/1, but returns the body directly or raises the
error exception.
Counts the documents of one, several, or all indices (Cat count API).
Options
:index— index target; absent for all indices.
Like count/1, but returns the body directly or raises the error exception.
Returns the heap memory each field's fielddata uses, per node (Cat fielddata API).
Options
:fields— restrict the result to one or several field names.
Like fielddata/1, but returns the body directly or raises the error
exception.
Returns the cluster health (Cat health API).
Like health/1, but returns the body directly or raises the error exception.
@spec help(keyword()) :: {:ok, [String.t()]} | {:error, Exception.t()}
Lists the available cat APIs — GET /_cat
(Cat help API).
This one endpoint answers in plain text whatever the accept header says —
a banner line, then one endpoint per line — so the response format defaults
to :raw and the body is parsed here into the list of endpoints:
Dowser.Elasticsearch.Cat.help!()
#=> ["/_cat/allocation", "/_cat/shards", "/_cat/shards/{index}", ...]Pass resp_format: :json (or :ndjson) to opt out of both the :raw
default and the parsing, and get whatever Dowser.Client decodes instead.
Like help/1, but returns the endpoints directly or raises the error
exception.
Returns high-level information about one, several, or all indices (Cat indices API).
Options
:index— index target; absent for all indices.
Like indices/1, but returns the body directly or raises the error
exception.
Returns the elected master node (Cat master API).
Like master/1, but returns the body directly or raises the error exception.
Returns the data frame analytics jobs (Cat data frame analytics API).
Options
:id— restrict the result to one data frame analytics job id.
Like ml_data_frame_analytics/1, but returns the body directly or raises the
error exception.
Returns the datafeeds of the anomaly detection jobs (Cat datafeeds API).
Options
:datafeed_id— restrict the result to one datafeed id.
Like ml_datafeeds/1, but returns the body directly or raises the error
exception.
Returns the anomaly detection jobs (Cat anomaly detectors API).
Options
:job_id— restrict the result to one job id.
Like ml_jobs/1, but returns the body directly or raises the error
exception.
Returns the trained models and their allocations (Cat trained model API).
Options
:model_id— restrict the result to one trained model id.
Like ml_trained_models/1, but returns the body directly or raises the error
exception.
Returns the custom node attributes (Cat nodeattrs API).
Like nodeattrs/1, but returns the body directly or raises the error
exception.
Returns the nodes of the cluster (Cat nodes API).
Like nodes/1, but returns the body directly or raises the error exception.
Returns the cluster-level changes not yet executed (Cat pending tasks API).
Like pending_tasks/1, but returns the body directly or raises the error
exception.
Returns the plugins installed on each node (Cat plugins API).
Like plugins/1, but returns the body directly or raises the error
exception.
Returns the shard recoveries — ongoing and completed — of one, several, or all indices (Cat recovery API).
Options
:index— index target; absent for all indices.
Like recovery/1, but returns the body directly or raises the error
exception.
Returns the snapshot repositories of the cluster (Cat repositories API).
Like repositories/1, but returns the body directly or raises the error
exception.
Returns the low-level Lucene segments of one, several, or all indices (Cat segments API).
Options
:index— index target; absent for all indices.
Like segments/1, but returns the body directly or raises the error
exception.
Returns the shards of one, several, or all indices, and the node each sits on (Cat shards API).
Options
:index— index target; absent for all indices.
Like shards/1, but returns the body directly or raises the error exception.
Returns the snapshots held by one or several repositories (Cat snapshots API).
Options
:repository— restrict the result to one or several repository names; absent for all repositories.
Like snapshots/1, but returns the body directly or raises the error
exception.
Returns the tasks currently running on the nodes (Cat task management API).
Like tasks/1, but returns the body directly or raises the error exception.
Returns the index templates (Cat templates API).
Options
:name— restrict the result to one or several template names or patterns.
Like templates/1, but returns the body directly or raises the error
exception.
Returns the thread pools of each node (Cat thread pool API).
Options
:thread_pool_patterns— restrict the result to one or several thread pool names or patterns.
Like thread_pool/1, but returns the body directly or raises the error
exception.
Returns the transforms of the cluster (Cat transforms API).
Options
:transform_id— restrict the result to one transform id.
Like transforms/1, but returns the body directly or raises the error
exception.