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

pub struct SyncClientBuilder { /* fields omitted */ }

A builder for a syncronous client.

Methods

impl SyncClientBuilder
[src]

[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

[src]

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

[src]

Set the base url.

The url must be fully qualified. This method is a convenient alternative to using params to specify the base_url.

Examples

Specify a base url for the client to send requests to. In this case, the base url is HTTPS, and not on the root path:

let builder = SyncClientBuilder::new()
    .base_url("https://my_es_cluster/some_path");

[src]

Specify default request parameters.

Examples

Require all responses use pretty-printing:

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

Add an authorization header:

use elastic::http::header::Authorization;

let builder = SyncClientBuilder::new()
    .params(|p| {
        p.header(Authorization("let me in".to_owned()))
    });

Specify a base url (prefer the base_url method on SyncClientBuilder instead):

let builder = SyncClientBuilder::new()
    .params(|p| {
        p.base_url("https://my_es_cluster/some_path")
    });

[src]

Use the given reqwest::Client for sending requests.

[src]

Construct a [SyncClient][SyncClient] from this builder.

Trait Implementations

impl Default for SyncClientBuilder
[src]

[src]

Returns the "default value" for a type. Read more

Auto Trait Implementations