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 asynchronous
  • TRequest: the inner request type, for example SearchRequestBuilder.

RequestBuilder contains methods that are common to all request builders.

Methods

impl<TSender, TRequest> RequestBuilder<TSender, TRequest> where
    TSender: Sender
[src]

Methods for any request builder

The following methods can be called on any request builder, whether it's synchronous or asynchronous.

[src]

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.

[src]

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);