pub enum Mapping {
// some variants omitted
}Expand description
An Elasticsearch field mapping.
Generally speaking, this will be serialised and sent to Elasticsearch via the update mapping
API. The default serde_json representation of this type is a valid request
body for that API.
To use this with the elasticsearch crate:
ⓘ
use elasticsearch::{http::transport::Transport, indices::IndicesPutMappingParts, Elasticsearch};
use mapstic::ToMapping;
#[derive(ToMapping)]
struct MyIndex {
id: i64,
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = Elasticsearch::new(Transport::single_node("http://localhost:9200")?);
let response = client
.indices()
.put_mapping(IndicesPutMappingParts::Index(&["my-index"]))
.body(MyIndex::to_mapping())
.send()
.await?;
dbg!(response);
Ok(())
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mapping
impl RefUnwindSafe for Mapping
impl Send for Mapping
impl Sync for Mapping
impl Unpin for Mapping
impl UnwindSafe for Mapping
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more