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§
Sourcefn index_name() -> String
fn index_name() -> String
The Elasticsearch index name where documents of this type live
fn columns() -> Vec<Field>
Provided Methods§
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
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,
Sourcefn 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 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
Sourcefn find<'async_trait>(
search: Search,
) -> Pin<Box<dyn Future<Output = Result<TypedSearchResult<Self>, Error>> + Send + 'async_trait>>where
Self: Send + '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,
Find documents using query parameters
Sourcefn 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_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)
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.