Elasticsearch.API behaviour (elasticsearch v1.1.0) View Source

Behaviour for interacting with the Elasticsearch JSON API.

Link to this section Summary

Types

A payload of data to send, relevant to :put and :post requests

An HTTP method

A keyword list of options to pass to HTTPoison/Hackney

The URL to request from the API

Callbacks

Makes a request to an Elasticsearch JSON API URl using the given method.

Link to this section Types

Specs

data() :: binary() | map() | Keyword.t()

A payload of data to send, relevant to :put and :post requests

Specs

method() :: :get | :put | :post | :delete | :head

An HTTP method

Specs

opts() :: Keyword.t()

A keyword list of options to pass to HTTPoison/Hackney

Specs

response() ::
  {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()}
  | {:error, HTTPoison.Error.t()}

Specs

url() :: String.t()

The URL to request from the API

Link to this section Callbacks

Link to this callback

request(config, method, url, data, opts)

View Source

Specs

request(
  config :: Elasticsearch.Cluster.config(),
  method(),
  url(),
  data(),
  opts()
) :: response()

Makes a request to an Elasticsearch JSON API URl using the given method.