Struct elastic::client::requests::RequestBuilder [] [src]

pub struct RequestBuilder<'a, TRequest> { /* fields omitted */ }

A builder for a raw request.

This structure wraps up a concrete REST API request type and lets you adjust parameters before sending it.

Methods

impl<'a, TDocument, TBody> RequestBuilder<'a, SearchRequestBuilder<TDocument, TBody>> where
    TDocument: DeserializeOwned,
    TBody: IntoBody
[src]

Search request builder

A request builder for a Search query.

Call Client.search to get a RequestBuilder for a search request.

Set the indices for the search request.

If no index is specified then _all will be used.

Set the types for the search request.

Set the body for the search request.

If no body is specified then an empty query will be used.

Send the search request.

impl<'a, TDocument> RequestBuilder<'a, GetRequestBuilder<TDocument>> where
    TDocument: DeserializeOwned + DocumentType
[src]

Get document builder

A request builder for a Get Document request.

Call Client.get_document to get a RequestBuilder for a get document request.

Set the type for the get request.

Send the get request.

impl<'a, TDocument> RequestBuilder<'a, IndexRequestBuilder<TDocument>> where
    TDocument: Serialize
[src]

Index document builder

A request builder for an Index request.

Call Client.index_document to get a RequestBuilder for an index request.

Set the type for the index request.

Send the index request.

impl<'a, TDocument> RequestBuilder<'a, PutMappingRequestBuilder<TDocument>> where
    TDocument: DocumentType
[src]

Put mapping builder

A request builder for a Put Mapping request.

Call Client.put_mapping to get a RequestBuilder for a put mapping request.

Set the type for the put mapping request.

Send the put mapping request.

impl<'a, TBody> RequestBuilder<'a, CreateIndexRequestBuilder<TBody>> where
    TBody: IntoBody
[src]

Create index builder

A request builder for a Create Index request.

Call Client.create_index to get a RequestBuilder for a create index request.

Set the body for the search request.

If no body is specified then an empty query will be used.

Send the create index request.

impl<'a, TRequest> RequestBuilder<'a, TRequest>
[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(|params| params.url_param("refresh", true));

The params method is available for any request builder.

impl<'a, TRequest, TBody> RequestBuilder<'a, RawRequestBuilder<TRequest, TBody>> where
    TRequest: Into<HttpRequest<'static, TBody>>,
    TBody: IntoBody
[src]

Raw request builder

A request builder for a raw request type.

Call Client.request to get a RequestBuilder for a raw request.

Send this request and return the response.

This method consumes the RequestBuilder and returns a ResponseBuilder that can be used to parse the response.

Examples

Send a raw request and parse it to a concrete response type:

let response = client.request(get_req())
                     .send()
                     .and_then(into_response::<SearchResponse<Value>>)
                     .unwrap();