Struct elastic::client::requests::RequestBuilder
[−]
[src]
pub struct RequestBuilder<TSender, TRequest> where
TSender: Sender, { /* fields omitted */ }
A builder for a request.
This structure wraps up a concrete REST API request type and lets you adjust parameters before sending it.
The RequestBuilder
has two generic parameters:
TSender
: the kind of request sender. This can be either synchronous or asynchronousTRequest
: the inner request type, for exampleSearchRequestBuilder
.
RequestBuilder
contains methods that are common to all request builders.
Methods
impl<TSender, TRequest> RequestBuilder<TSender, TRequest> where
TSender: Sender,
[src]
TSender: Sender,
Methods for any request builder
The following methods can be called on any request builder, whether it's synchronous or asynchronous.
fn params<F>(self, builder: F) -> Self where
F: Fn(RequestParams) -> RequestParams,
[src]
F: Fn(RequestParams) -> RequestParams,
Override the parameters for this request.
This method will clone the RequestParams
on the Client
and pass
them to the closure.
Examples
Add a url param to force an index refresh:
let builder = client.request(get_req()) .params(|p| p.url_param("refresh", true));
impl<TRequest> RequestBuilder<AsyncSender, TRequest>
[src]
Methods for asynchronous request builders
The following methods can be called on any asynchronous request builder.
fn serde_pool<P>(self, pool: P) -> Self where
P: Into<Option<CpuPool>>,
[src]
P: Into<Option<CpuPool>>,
Override the thread pool used for deserialisation for this request.
Examples
Use the given thread pool to deserialise the response:
let pool = CpuPool::new(4); let builder = client.request(get_req()) .serde_pool(pool.clone());
Never deserialise the response on a thread pool:
let builder = client.request(get_req()) .serde_pool(None);