Trait Document

Source
pub trait Document:
    Serialize
    + DeserializeOwned
    + Sized {
Show 13 methods // Required methods fn index_name() -> &'static str; fn id(&self) -> &str; // Provided methods fn save<'life0, 'life1, 'async_trait>( &'life0 self, client: &'life1 Elasticsearch, ) -> Pin<Box<dyn Future<Output = Result<Self, EsOrmError>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get<'life0, 'life1, 'async_trait>( client: &'life0 Elasticsearch, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Self, EsOrmError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn delete<'life0, 'life1, 'async_trait>( client: &'life0 Elasticsearch, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<DeleteResponse, EsOrmError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn update<'life0, 'life1, 'life2, 'async_trait>( client: &'life0 Elasticsearch, id: &'life1 str, partial_doc: &'life2 Value, ) -> Pin<Box<dyn Future<Output = Result<Self, EsOrmError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn refresh<'life0, 'life1, 'async_trait>( &'life0 mut self, client: &'life1 Elasticsearch, ) -> Pin<Box<dyn Future<Output = Result<(), EsOrmError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn find<'life0, 'async_trait>( client: &'life0 Elasticsearch, params: QueryParams, ) -> Pin<Box<dyn Future<Output = Result<SearchResults<Self>, EsOrmError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... } fn find_all<'life0, 'async_trait>( client: &'life0 Elasticsearch, limit: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<SearchResults<Self>, EsOrmError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... } fn find_one<'life0, 'async_trait>( client: &'life0 Elasticsearch, params: QueryParams, ) -> Pin<Box<dyn Future<Output = Result<Option<Self>, EsOrmError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... } fn custom_query<'life0, 'async_trait>( client: &'life0 Elasticsearch, query_body: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, EsOrmError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... } fn aggregate<'life0, 'async_trait>( client: &'life0 Elasticsearch, aggs: Value, query: Option<Value>, size: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Value, EsOrmError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... } fn count<'life0, 'async_trait>( client: &'life0 Elasticsearch, params: Option<QueryParams>, ) -> Pin<Box<dyn Future<Output = Result<u64, EsOrmError>> + Send + 'async_trait>> where Self: Send + 'async_trait, 'life0: 'async_trait { ... }
}

Required Methods§

Source

fn index_name() -> &'static str

The Elasticsearch index name where documents of this type live

Source

fn id(&self) -> &str

Return the unique ID of this document

Provided Methods§

Source

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

Create or update this document in Elasticsearch and return the saved document

Source

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

Fetch a document by ID

Source

fn delete<'life0, 'life1, 'async_trait>( client: &'life0 Elasticsearch, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<DeleteResponse, EsOrmError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a document by ID

Source

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

Update a document with partial data and return the updated document

Source

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

Refresh this document instance with the latest data from Elasticsearch

Source

fn find<'life0, 'async_trait>( client: &'life0 Elasticsearch, params: QueryParams, ) -> Pin<Box<dyn Future<Output = Result<SearchResults<Self>, EsOrmError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Find documents using query parameters

Source

fn find_all<'life0, 'async_trait>( client: &'life0 Elasticsearch, limit: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<SearchResults<Self>, EsOrmError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Find all documents (with optional limit)

Source

fn find_one<'life0, 'async_trait>( client: &'life0 Elasticsearch, params: QueryParams, ) -> Pin<Box<dyn Future<Output = Result<Option<Self>, EsOrmError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Find one document matching the query parameters

Source

fn custom_query<'life0, 'async_trait>( client: &'life0 Elasticsearch, query_body: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, EsOrmError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Execute a custom query and return raw response

Source

fn aggregate<'life0, 'async_trait>( client: &'life0 Elasticsearch, aggs: Value, query: Option<Value>, size: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<Value, EsOrmError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Execute an aggregation query

Source

fn count<'life0, 'async_trait>( client: &'life0 Elasticsearch, params: Option<QueryParams>, ) -> Pin<Box<dyn Future<Output = Result<u64, EsOrmError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: '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§