Skip to main content

Document

Trait Document 

Source
pub trait Document:
    Serialize
    + DeserializeOwned
    + Sized
    + Clone {
Show 14 methods // Required methods fn index_name() -> String; fn id(&self) -> String; fn columns() -> Vec<Field>; // Provided methods fn save<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<IndexResponse, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn get<'life0, 'async_trait>( id: &'life0 str, ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... } fn delete<'life0, 'async_trait>( id: &'life0 str, ) -> Pin<Box<dyn Future<Output = Result<DocumentDeleteResponse, Error>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... } fn update<'life0, 'life1, 'async_trait>( id: &'life0 str, partial_doc: &'life1 Value, ) -> Pin<Box<dyn Future<Output = Result<IndexResponse, Error>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn upsert_doc<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<IndexResponse, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn upsert_value<'life0, 'life1, 'async_trait>( &'life0 self, partial_doc: &'life1 Value, ) -> Pin<Box<dyn Future<Output = Result<IndexResponse, Error>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn refresh<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... } fn find<'async_trait>( search: Search, ) -> Pin<Box<dyn Future<Output = Result<TypedSearchResult<Self>, Error>> + Send + 'async_trait>> where Self: Send + 'async_trait { ... } fn find_all<'async_trait>( limit: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<TypedSearchResult<Self>, Error>> + Send + 'async_trait>> where Self: Send + 'async_trait { ... } fn find_one<'async_trait>( params: Search, ) -> Pin<Box<dyn Future<Output = Result<Option<Self>, Error>> + Send + 'async_trait>> where Self: Send + 'async_trait { ... } fn count<'async_trait>( params: Option<Query>, ) -> Pin<Box<dyn Future<Output = Result<u32, Error>> + Send + 'async_trait>> where Self: Send + 'async_trait { ... }
}

Required Methods§

Source

fn index_name() -> String

The Elasticsearch index name where documents of this type live

Source

fn id(&self) -> String

Return the unique ID of this document

Source

fn columns() -> Vec<Field>

Provided Methods§

Source

fn save<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<IndexResponse, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Create or update this document in Elasticsearch

Source

fn get<'life0, 'async_trait>( id: &'life0 str, ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Fetch a document by ID

Source

fn delete<'life0, 'async_trait>( id: &'life0 str, ) -> Pin<Box<dyn Future<Output = Result<DocumentDeleteResponse, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Delete a document by ID

Source

fn update<'life0, 'life1, 'async_trait>( id: &'life0 str, partial_doc: &'life1 Value, ) -> Pin<Box<dyn Future<Output = Result<IndexResponse, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update a document with partial data and return the updated document

Source

fn upsert_doc<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<IndexResponse, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn upsert_value<'life0, 'life1, 'async_trait>( &'life0 self, partial_doc: &'life1 Value, ) -> Pin<Box<dyn Future<Output = Result<IndexResponse, Error>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn refresh<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Refresh this document instance with the latest data from Elasticsearch

Source

fn find<'async_trait>( search: Search, ) -> Pin<Box<dyn Future<Output = Result<TypedSearchResult<Self>, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait,

Find documents using query parameters

Source

fn find_all<'async_trait>( limit: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<TypedSearchResult<Self>, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait,

Find all documents (with optional limit)

Source

fn find_one<'async_trait>( params: Search, ) -> Pin<Box<dyn Future<Output = Result<Option<Self>, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait,

Find one document matching the query parameters

Source

fn count<'async_trait>( params: Option<Query>, ) -> Pin<Box<dyn Future<Output = Result<u32, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait,

Count documents matching the query

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§