Struct meilisearch_sdk::indexes::IndexUpdater
source · pub struct IndexUpdater<'a> {
pub client: &'a Client,
pub uid: String,
pub primary_key: Option<String>,
}Expand description
An IndexUpdater used to update the specifics of an index
Example
let task = IndexUpdater::new("index_updater", &client)
.with_primary_key("special_id")
.execute()
.await
.unwrap()
.wait_for_completion(&client, None, None)
.await
.unwrap();
let index = client.get_index("index_updater").await.unwrap();
assert_eq!(index.primary_key, Some("special_id".to_string()));Fields§
§client: &'a Client§uid: String§primary_key: Option<String>Implementations§
source§impl<'a> IndexUpdater<'a>
impl<'a> IndexUpdater<'a>
pub fn new(uid: impl AsRef<str>, client: &Client) -> IndexUpdater<'_>
sourcepub fn with_primary_key(&mut self, primary_key: impl AsRef<str>) -> &mut Self
pub fn with_primary_key(&mut self, primary_key: impl AsRef<str>) -> &mut Self
Define the new primary_key to set on the Index
Example
let task = IndexUpdater::new("index_updater_with_primary_key", &client)
.with_primary_key("special_id")
.execute()
.await
.unwrap()
.wait_for_completion(&client, None, None)
.await
.unwrap();
let index = client.get_index("index_updater_with_primary_key").await.unwrap();
assert_eq!(index.primary_key, Some("special_id".to_string()));sourcepub async fn execute(&'a self) -> Result<TaskInfo, Error>
pub async fn execute(&'a self) -> Result<TaskInfo, Error>
Execute the update of an Index using the IndexUpdater
Example
let task = IndexUpdater::new("index_updater_execute", &client)
.with_primary_key("special_id")
.execute()
.await
.unwrap()
.wait_for_completion(&client, None, None)
.await
.unwrap();
let index = client.get_index("index_updater_execute").await.unwrap();
assert_eq!(index.primary_key, Some("special_id".to_string()));Trait Implementations§
source§impl<'a> AsRef<IndexUpdater<'a>> for IndexUpdater<'a>
impl<'a> AsRef<IndexUpdater<'a>> for IndexUpdater<'a>
source§fn as_ref(&self) -> &IndexUpdater<'a>
fn as_ref(&self) -> &IndexUpdater<'a>
Converts this type into a shared reference of the (usually inferred) input type.
source§impl AsRef<str> for IndexUpdater<'_>
impl AsRef<str> for IndexUpdater<'_>
source§impl<'a> Clone for IndexUpdater<'a>
impl<'a> Clone for IndexUpdater<'a>
source§fn clone(&self) -> IndexUpdater<'a>
fn clone(&self) -> IndexUpdater<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more