[][src]Struct elastic::client::SyncClientBuilder

pub struct SyncClientBuilder { /* fields omitted */ }

A builder for a syncronous client.

Methods

impl SyncClientBuilder[src]

pub fn new() -> Self[src]

Create a new client builder.

By default, a client constructed by this builder will:

  • Send requests to localhost:9200
  • Not use any authentication
  • Not use TLS

pub fn from_params(params: PreRequestParams) -> Self[src]

Create a new client builder with the given default request parameters.

pub fn static_node(self, node: impl Into<NodeAddress>) -> Self[src]

Specify a static node nodes to send requests to.

pub fn static_nodes<I, S>(self, nodes: I) -> Self where
    I: IntoIterator<Item = S>,
    S: Into<NodeAddress>, 
[src]

Specify a set of static node nodes to load balance requests on.

pub fn sniff_nodes(self, builder: impl Into<SniffedNodesBuilder>) -> Self[src]

Specify a node address to sniff other nodes in the cluster from.

Examples

Use a given base url for sniffing the cluster's node addresses from:

let builder = SyncClientBuilder::new()
    .sniff_nodes("http://localhost:9200");

pub fn sniff_nodes_fluent(
    self,
    address: impl Into<NodeAddress>,
    builder: impl Fn(SniffedNodesBuilder) -> SniffedNodesBuilder + 'static
) -> Self
[src]

Specify a node address to sniff other nodes in the cluster from.

Examples

Use a given base url for sniffing the cluster's node addresses from and specify a minimum duration to wait before refreshing:

let builder = SyncClientBuilder::new()
    .sniff_nodes_fluent("http://localhost:9200", |n| n
        .wait(Duration::from_secs(90)));

pub fn params_fluent(
    self,
    builder: impl Fn(PreRequestParams) -> PreRequestParams + 'static
) -> Self
[src]

Specify default request parameters.

Examples

Require all responses use pretty-printing:

let builder = SyncClientBuilder::new()
    .params_fluent(|p| p
        .url_param("pretty", true));

pub fn params(self, params: impl Into<PreRequestParams>) -> Self[src]

Specify default request parameters.

Examples

Require all responses use pretty-printing:

let builder = SyncClientBuilder::new()
    .params(PreRequestParams::default()
        .url_param("pretty", true));

pub fn http_client(self, client: SyncHttpClient) -> Self[src]

Use the given reqwest::Client for sending requests.

pub fn pre_send_raw(
    self,
    pre_send: impl Fn(&mut SyncHttpRequest) -> Result<(), Box<dyn StdError + Send + Sync>> + Send + Sync + 'static
) -> Self
[src]

Specify a function to tweak a raw request before sending.

This function will be applied to all outgoing requests and gives you the chance to perform operations the require the complete raw request, such as request singing. Prefer the params method on the client or individual requests where possible.

pub fn build(self) -> Result<SyncClient, Error>[src]

Construct a SyncClient from this builder.

Trait Implementations

impl Default for SyncClientBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 

impl<T> Erased for T

impl<T, U> TryInto for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err