Client documentation
Client is a base struct, that parse hosts and create connections to Elastic cluster. After initialization it can be passed to api methods to perform requests.
Example
using ElasticsearchClient
client = ElasticsearchClient.Client(host=(host="localhost", port=9200, scheme="http"))
perform_request(client, "GET", "/_search")
ElasticsearchClient.ElasticTransport.Client
— TypeElasticSearch client. Handling hosts configuration, verify elasticsearch and delegate requests to Transport
function Client(;http_client::Module, kwargs...)
Create a client connected to an Elastic cluster.
Possible arguments
http_client::Module
: A module that implement request method. Maybe useful if you need custom http layers. HTTP.jl used bu default.hosts
: Single host passed as a String, Dict or NamedTuple, or multiple hosts passed as an Array;host
,url
,urls
keys are also validserializer
: Function to serialise the body to JSON. JSON.json by defaultdeserializer
: Function to deserialise response body to Dict. JSON.parse by defaultresurrect_after::Integer
: After how many seconds a dead connection should be tried againreload_connection::Bool
: Reload connections after X requests (false by default)randomize_hosts::Bool
: Shuffle connections on initialization and reload (false by default)sniffer_timeout::Integer
: Timeout for reloading connections in seconds (1 by default)retry_on_failure::Bool
: Retry X times when request fails before raising and exception (false by default)delay_on_retry::Integer
: Delay in milliseconds between each retry (0 by default)retry_on_status::Vector{Integer}
: Retry when specific status codes are returnedreload_on_failure::Bool
: Reload connections after failure (false by default)request_timeout::Integer
: The request timeout to be passed to transport in optionstransport_options
: Options to be passed to Connection. Now work onlyheaders
optionselector::Connections.AbstractSelector
A struct type of selector strategy.send_get_body_as
: Specify the HTTP method to use for GET requests with a body. (Default: GET)compression
Whether to compress requests. Gzip compression will be used. The default is false. Responses will automatically be inflated if they are compressed.
ElasticsearchClient.ElasticTransport.perform_request
— FunctionLow-level request to Elastic cluster.
Arguments
client::ElasticTransport.Client
method::String
path::String
: elastic endpoint. Must start with /
Keyword arguments
params::Dict
: Query paramsbody::Union{Nothing, Dict}
: HTTP body, default Nothingheaders::Union{Nothing, Dict}
: HTTP headers. They are merged with default headers. Default Nothing