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§
Sourcefn index_name() -> &'static str
fn index_name() -> &'static str
The Elasticsearch index name where documents of this type live
Provided Methods§
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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<'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
Sourcefn 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_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)
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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,
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.