[−][src]Struct elastic::client::SyncClientBuilder
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]
I: IntoIterator<Item = S>,
S: Into<NodeAddress>,
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]
self,
address: impl Into<NodeAddress>,
builder: impl Fn(SniffedNodesBuilder) -> SniffedNodesBuilder + 'static
) -> Self
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]
self,
builder: impl Fn(PreRequestParams) -> PreRequestParams + 'static
) -> Self
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]
self,
pre_send: impl Fn(&mut SyncHttpRequest) -> Result<(), Box<dyn StdError + Send + Sync>> + Send + Sync + 'static
) -> Self
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
impl !Send for SyncClientBuilder
impl !Sync for SyncClientBuilder
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Same for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T> Erased for T
impl<T, U> TryInto for T where
U: TryFrom<T>,
U: TryFrom<T>,