[][src]Type Definition elastic::client::requests::document_delete::DeleteRequestBuilder

type DeleteRequestBuilder<TSender, TDocument> = RequestBuilder<TSender, DeleteRequestInner<TDocument>>;

A delete document request builder that can be configured before sending.

Call Client.document_delete to get a DeleteRequestBuilder. The send method will either send the request synchronously or asynchronously, depending on the Client it was created from.

Methods

impl<TSender, TDocument> DeleteRequestBuilder<TSender, TDocument> where
    TSender: Sender
[src]

Builder methods

Configure a DeleteRequestBuilder before sending it.

pub fn index(self, index: impl Into<Index<'static>>) -> Self[src]

Set the index for the delete request.

pub fn ty(self, ty: impl Into<Type<'static>>) -> Self[src]

Set the type for the delete request.

impl<TDocument> DeleteRequestBuilder<SyncSender, TDocument>[src]

pub fn send(self) -> Result<DeleteResponse>[src]

Send a DeleteRequestBuilder synchronously using a SyncClient.

This will block the current thread until a response arrives and is deserialised.

Examples

Delete a DocumentType called MyType with an id of 1:

let response = client.document::<MyType>()
                     .delete(1)
                     .send()?;

assert!(response.deleted());

impl<TDocument> DeleteRequestBuilder<AsyncSender, TDocument>[src]

pub fn send(self) -> Pending[src]

Send a DeleteRequestBuilder asynchronously using an AsyncClient.

This will return a future that will resolve to the deserialised delete document response.

Examples

Delete a DocumentType called MyType with an id of 1:

let future = client.document::<MyType>()
                   .delete(1)
                   .ty("mytype")
                   .send();

future.and_then(|response| {
    assert!(response.deleted());

    Ok(())
});