ESClient v0.1.0 ESClient.Driver behaviour View Source

A behavior that must be implemented by custom Elasticsearch drivers. A driver sends a request to the Elasticsearch endpoint and retrieves the particular response.

Link to this section Summary

Types

A type representing failed response data.

A type representing request headers.

A type representing successful response data.

A type representing response headers.

Callbacks

A callback for implementing an own function to send a request to a HTTP endpoint.

Link to this section Types

Link to this type

error()

View Source
error() :: %{:reason => any(), optional(atom()) => any()}

A type representing failed response data.

Link to this type

req_headers()

View Source
req_headers() ::
  Keyword.t(binary())
  | [{String.t(), binary()}]
  | %{optional(atom() | String.t()) => binary()}

A type representing request headers.

Link to this type

resp()

View Source
resp() :: %{
  :status_code => non_neg_integer(),
  :headers => resp_headers(),
  :body => binary(),
  optional(atom()) => any()
}

A type representing successful response data.

Link to this type

resp_headers()

View Source
resp_headers() :: [{String.t(), binary()}]

A type representing response headers.

Link to this section Callbacks

Link to this callback

request(verb, url, body, headers, opts)

View Source
request(
  verb :: ESClient.verb(),
  url :: URI.t(),
  body :: binary(),
  headers :: req_headers(),
  opts :: Keyword.t()
) :: {:ok, resp()} | {:error, error()}

A callback for implementing an own function to send a request to a HTTP endpoint.