Type Definition elastic::client::requests::document_get::GetRequestBuilder
[−]
[src]
type GetRequestBuilder<TSender, TDocument> = RequestBuilder<TSender, GetRequestInner<TDocument>>;
A get document request builder that can be configured before sending.
Call Client.document_get
to get a GetRequestBuilder
.
The send
method will either send the request synchronously or asynchronously, depending on the Client
it was created from.
Methods
impl<TSender, TDocument> GetRequestBuilder<TSender, TDocument> where
TSender: Sender,
[src]
TSender: Sender,
Builder methods
Configure a GetRequestBuilder
before sending it.
pub fn ty<I>(self, ty: I) -> Self where
I: Into<Type<'static>>,
[src]
I: Into<Type<'static>>,
Set the type for the get request.
impl<TDocument> GetRequestBuilder<SyncSender, TDocument> where
TDocument: DeserializeOwned,
[src]
TDocument: DeserializeOwned,
pub fn send(self) -> Result<GetResponse<TDocument>>
[src]
Send a GetRequestBuilder
synchronously using a SyncClient
.
This will block the current thread until a response arrives and is deserialised.
Examples
Get a document from an index called myindex
with an id of 1
:
let response = client.document_get::<Value>(index("myindex"), id(1)) .ty("mytype") .send()?; if let Some(doc) = response.into_document() { println!("{:?}", doc); }
impl<TDocument> GetRequestBuilder<AsyncSender, TDocument> where
TDocument: DeserializeOwned + Send + 'static,
[src]
TDocument: DeserializeOwned + Send + 'static,
pub fn send(self) -> Pending<TDocument>
[src]
Send a GetRequestBuilder
asynchronously using an AsyncClient
.
This will return a future that will resolve to the deserialised get document response.
Examples
Get a document from an index called myindex
with an id of 1
:
let future = client.document_get::<Value>(index("myindex"), id(1)) .ty("mytype") .send(); future.and_then(|response| { if let Some(doc) = response.into_document() { println!("{:?}", doc); } Ok(()) });