meilisearch_sdk/
settings.rs

1use crate::{
2    errors::Error,
3    indexes::Index,
4    request::{HttpClient, Method},
5    task_info::TaskInfo,
6};
7use serde::{Deserialize, Serialize};
8use std::collections::{BTreeMap, HashMap};
9
10#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq, Copy)]
11#[serde(rename_all = "camelCase")]
12pub struct PaginationSetting {
13    pub max_total_hits: usize,
14}
15
16#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)]
17#[serde(rename_all = "camelCase")]
18pub struct MinWordSizeForTypos {
19    pub one_typo: Option<u8>,
20    pub two_typos: Option<u8>,
21}
22
23#[derive(Serialize, Deserialize, Default, Debug, Clone, PartialEq, Eq)]
24#[serde(rename_all = "camelCase")]
25#[serde(default)]
26pub struct TypoToleranceSettings {
27    pub enabled: Option<bool>,
28    pub disable_on_attributes: Option<Vec<String>>,
29    pub disable_on_words: Option<Vec<String>>,
30    pub min_word_size_for_typos: Option<MinWordSizeForTypos>,
31}
32
33#[derive(Debug, Deserialize, Clone, Eq, PartialEq, Serialize)]
34#[serde(rename_all = "camelCase")]
35pub enum FacetSortValue {
36    Alpha,
37    Count,
38}
39
40#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)]
41#[serde(rename_all = "camelCase")]
42pub enum PrefixSearchSettings {
43    /// Calculate prefix search during indexing.
44    /// This is the default behavior
45    IndexingTime,
46
47    /// Do not calculate prefix search.
48    /// May speed up indexing, but will severely impact search result relevancy
49    Disabled,
50
51    /// Any other value that might be added to Meilisearch in the future but that is not supported by this SDK.
52    /// If you see one, please open a PR
53    #[serde(untagged)]
54    Unknown(String),
55}
56
57#[derive(Serialize, Deserialize, Default, Debug, Clone, Eq, PartialEq)]
58#[serde(rename_all = "camelCase")]
59pub struct FacetingSettings {
60    /// Maximum number of facet values returned for each facet. Values are sorted in ascending lexicographical order
61    pub max_values_per_facet: usize,
62    /// Customize facet order to sort by descending value count (count) or ascending alphanumeric order (alpha)
63    #[serde(skip_serializing_if = "Option::is_none")]
64    pub sort_facet_values_by: Option<BTreeMap<String, FacetSortValue>>,
65}
66
67#[derive(Serialize, Deserialize, Default, Debug, Clone, Eq, PartialEq)]
68#[serde(rename_all = "camelCase")]
69pub enum EmbedderSource {
70    #[default]
71    UserProvided,
72    HuggingFace,
73    OpenAi,
74    Ollama,
75    Rest,
76    Composite,
77}
78
79#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
80#[serde(rename_all = "camelCase")]
81pub struct EmbedderDistribution {
82    pub mean: f64,
83    pub sigma: f64,
84}
85
86#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
87#[serde(rename_all = "camelCase")]
88pub struct Embedder {
89    /// The third-party tool that will generate embeddings from documents
90    pub source: EmbedderSource,
91
92    /// The URL Meilisearch contacts when querying the embedder
93    #[serde(skip_serializing_if = "Option::is_none")]
94    pub url: Option<String>,
95
96    /// Authentication token Meilisearch should send with each request to the embedder.
97    /// If not present, Meilisearch will attempt to read it from environment variables
98    #[serde(skip_serializing_if = "Option::is_none")]
99    pub api_key: Option<String>,
100
101    /// The model your embedder uses when generating vectors
102    #[serde(skip_serializing_if = "Option::is_none")]
103    pub model: Option<String>,
104
105    /// Model revision hash
106    #[serde(skip_serializing_if = "Option::is_none")]
107    pub revision: Option<String>,
108
109    /// Pooling method for Hugging Face embedders
110    #[serde(skip_serializing_if = "Option::is_none")]
111    pub pooling: Option<String>,
112
113    /// Template defining the data Meilisearch sends to the embedder
114    #[serde(skip_serializing_if = "Option::is_none")]
115    pub document_template: Option<String>,
116
117    /// Maximum allowed size of rendered document template
118    #[serde(skip_serializing_if = "Option::is_none")]
119    pub document_template_max_bytes: Option<usize>,
120
121    /// Number of dimensions in the chosen model.
122    /// If not supplied, Meilisearch tries to infer this value
123    #[serde(skip_serializing_if = "Option::is_none")]
124    pub dimensions: Option<usize>,
125
126    /// Describes the natural distribution of search results.
127    #[serde(skip_serializing_if = "Option::is_none")]
128    pub distribution: Option<EmbedderDistribution>,
129
130    /// A JSON value representing the request Meilisearch makes to the remote embedder
131    #[serde(skip_serializing_if = "Option::is_none")]
132    pub request: Option<serde_json::Value>,
133
134    /// A JSON value representing the response Meilisearch expects from the remote embedder
135    #[serde(skip_serializing_if = "Option::is_none")]
136    pub response: Option<serde_json::Value>,
137
138    /// Once set to true, irreversibly converts all vector dimensions to 1-bit values
139    #[serde(skip_serializing_if = "Option::is_none")]
140    pub binary_quantized: Option<bool>,
141
142    /// Configures embedder to vectorize documents during indexing (composite embedders only)
143    #[serde(skip_serializing_if = "Option::is_none")]
144    pub indexing_embedder: Option<Box<Embedder>>,
145
146    /// Configures embedder to vectorize search queries (composite embedders only)
147    #[serde(skip_serializing_if = "Option::is_none")]
148    pub search_embedder: Option<Box<Embedder>>,
149
150    /// Configures multimodal embedding generation at indexing time.
151    #[serde(skip_serializing_if = "Option::is_none")]
152    pub indexing_fragments: Option<HashMap<String, EmbedderFragment>>,
153
154    /// Configures incoming media fragments for multimodal search queries.
155    #[serde(skip_serializing_if = "Option::is_none")]
156    pub search_fragments: Option<HashMap<String, EmbedderFragment>>,
157}
158
159#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
160#[serde(rename_all = "camelCase")]
161pub struct EmbedderFragment {
162    pub value: serde_json::Value,
163}
164
165#[derive(Serialize, Deserialize, Default, Debug, Clone, Eq, PartialEq)]
166#[serde(rename_all = "camelCase")]
167pub struct LocalizedAttributes {
168    pub locales: Vec<String>,
169    pub attribute_patterns: Vec<String>,
170}
171
172/// Struct representing a set of settings.
173///
174/// You can build this struct using the builder syntax.
175///
176/// # Example
177///
178/// ```
179/// # use meilisearch_sdk::settings::Settings;
180/// let settings = Settings::new()
181///     .with_stop_words(["a", "the", "of"]);
182///
183/// // OR
184///
185/// let stop_words: Vec<String> = vec!["a".to_string(), "the".to_string(), "of".to_string()];
186/// let mut settings = Settings::new();
187/// settings.stop_words = Some(stop_words);
188///
189/// // OR
190///
191/// let stop_words: Vec<String> = vec!["a".to_string(), "the".to_string(), "of".to_string()];
192/// let settings = Settings {
193///     stop_words: Some(stop_words),
194///     ..Settings::new()
195/// };
196/// ```
197#[derive(Serialize, Deserialize, Default, Debug, Clone)]
198#[serde(rename_all = "camelCase")]
199pub struct Settings {
200    /// List of associated words treated similarly.
201    #[serde(skip_serializing_if = "Option::is_none")]
202    pub synonyms: Option<HashMap<String, Vec<String>>>,
203    /// List of words ignored by Meilisearch when present in search queries.
204    #[serde(skip_serializing_if = "Option::is_none")]
205    pub stop_words: Option<Vec<String>>,
206    /// List of [ranking rules](https://www.meilisearch.com/docs/learn/core_concepts/relevancy#order-of-the-rules) sorted by order of importance.
207    #[serde(skip_serializing_if = "Option::is_none")]
208    pub ranking_rules: Option<Vec<String>>,
209    /// Attributes to use for [filtering](https://www.meilisearch.com/docs/learn/advanced/filtering).
210    #[serde(skip_serializing_if = "Option::is_none")]
211    pub filterable_attributes: Option<Vec<String>>,
212    /// Attributes to sort.
213    #[serde(skip_serializing_if = "Option::is_none")]
214    pub sortable_attributes: Option<Vec<String>>,
215    /// Search returns documents with distinct (different) values of the given field.
216    #[serde(skip_serializing_if = "Option::is_none")]
217    pub distinct_attribute: Option<Option<String>>,
218    /// Fields in which to search for matching query words sorted by order of importance.
219    #[serde(skip_serializing_if = "Option::is_none")]
220    pub searchable_attributes: Option<Vec<String>>,
221    /// Fields displayed in the returned documents.
222    #[serde(skip_serializing_if = "Option::is_none")]
223    pub displayed_attributes: Option<Vec<String>>,
224    /// Pagination settings.
225    #[serde(skip_serializing_if = "Option::is_none")]
226    pub pagination: Option<PaginationSetting>,
227    /// Faceting settings.
228    #[serde(skip_serializing_if = "Option::is_none")]
229    pub faceting: Option<FacetingSettings>,
230    /// TypoTolerance settings
231    #[serde(skip_serializing_if = "Option::is_none")]
232    pub typo_tolerance: Option<TypoToleranceSettings>,
233    /// Dictionary settings.
234    #[serde(skip_serializing_if = "Option::is_none")]
235    pub dictionary: Option<Vec<String>>,
236    /// Proximity precision settings.
237    #[serde(skip_serializing_if = "Option::is_none")]
238    pub proximity_precision: Option<String>,
239    /// Embedders translate documents and queries into vector embeddings
240    #[serde(skip_serializing_if = "Option::is_none")]
241    pub embedders: Option<HashMap<String, Embedder>>,
242    /// SearchCutoffMs settings.
243    #[serde(skip_serializing_if = "Option::is_none")]
244    pub search_cutoff_ms: Option<u64>,
245    /// Configure strings as custom separator tokens indicating where a word ends and begins.
246    #[serde(skip_serializing_if = "Option::is_none")]
247    pub separator_tokens: Option<Vec<String>>,
248    /// Remove tokens from Meilisearch's default [list of word separators](https://www.meilisearch.com/docs/learn/engine/datatypes#string).
249    #[serde(skip_serializing_if = "Option::is_none")]
250    pub non_separator_tokens: Option<Vec<String>>,
251    /// LocalizedAttributes settings.
252    #[serde(skip_serializing_if = "Option::is_none")]
253    pub localized_attributes: Option<Vec<LocalizedAttributes>>,
254}
255
256#[allow(missing_docs)]
257impl Settings {
258    /// Create undefined settings.
259    #[must_use]
260    pub fn new() -> Settings {
261        Self::default()
262    }
263
264    #[must_use]
265    pub fn with_synonyms<S, U, V>(self, synonyms: HashMap<S, U>) -> Settings
266    where
267        S: AsRef<str>,
268        V: AsRef<str>,
269        U: IntoIterator<Item = V>,
270    {
271        Settings {
272            synonyms: Some(
273                synonyms
274                    .into_iter()
275                    .map(|(key, value)| {
276                        (
277                            key.as_ref().to_string(),
278                            value.into_iter().map(|v| v.as_ref().to_string()).collect(),
279                        )
280                    })
281                    .collect(),
282            ),
283            ..self
284        }
285    }
286
287    #[must_use]
288    pub fn with_stop_words(
289        self,
290        stop_words: impl IntoIterator<Item = impl AsRef<str>>,
291    ) -> Settings {
292        Settings {
293            stop_words: Some(
294                stop_words
295                    .into_iter()
296                    .map(|v| v.as_ref().to_string())
297                    .collect(),
298            ),
299            ..self
300        }
301    }
302
303    #[must_use]
304    pub fn with_pagination(self, pagination_settings: PaginationSetting) -> Settings {
305        Settings {
306            pagination: Some(pagination_settings),
307            ..self
308        }
309    }
310
311    #[must_use]
312    pub fn with_typo_tolerance(self, typo_tolerance_settings: TypoToleranceSettings) -> Settings {
313        Settings {
314            typo_tolerance: Some(typo_tolerance_settings),
315            ..self
316        }
317    }
318
319    #[must_use]
320    pub fn with_ranking_rules(
321        self,
322        ranking_rules: impl IntoIterator<Item = impl AsRef<str>>,
323    ) -> Settings {
324        Settings {
325            ranking_rules: Some(
326                ranking_rules
327                    .into_iter()
328                    .map(|v| v.as_ref().to_string())
329                    .collect(),
330            ),
331            ..self
332        }
333    }
334
335    #[must_use]
336    pub fn with_filterable_attributes(
337        self,
338        filterable_attributes: impl IntoIterator<Item = impl AsRef<str>>,
339    ) -> Settings {
340        Settings {
341            filterable_attributes: Some(
342                filterable_attributes
343                    .into_iter()
344                    .map(|v| v.as_ref().to_string())
345                    .collect(),
346            ),
347            ..self
348        }
349    }
350
351    #[must_use]
352    pub fn with_sortable_attributes(
353        self,
354        sortable_attributes: impl IntoIterator<Item = impl AsRef<str>>,
355    ) -> Settings {
356        Settings {
357            sortable_attributes: Some(
358                sortable_attributes
359                    .into_iter()
360                    .map(|v| v.as_ref().to_string())
361                    .collect(),
362            ),
363            ..self
364        }
365    }
366
367    #[must_use]
368    pub fn with_distinct_attribute(self, distinct_attribute: Option<impl AsRef<str>>) -> Settings {
369        Settings {
370            distinct_attribute: Some(
371                distinct_attribute.map(|distinct| distinct.as_ref().to_string()),
372            ),
373            ..self
374        }
375    }
376
377    #[must_use]
378    pub fn with_searchable_attributes(
379        self,
380        searchable_attributes: impl IntoIterator<Item = impl AsRef<str>>,
381    ) -> Settings {
382        Settings {
383            searchable_attributes: Some(
384                searchable_attributes
385                    .into_iter()
386                    .map(|v| v.as_ref().to_string())
387                    .collect(),
388            ),
389            ..self
390        }
391    }
392
393    #[must_use]
394    pub fn with_displayed_attributes(
395        self,
396        displayed_attributes: impl IntoIterator<Item = impl AsRef<str>>,
397    ) -> Settings {
398        Settings {
399            displayed_attributes: Some(
400                displayed_attributes
401                    .into_iter()
402                    .map(|v| v.as_ref().to_string())
403                    .collect(),
404            ),
405            ..self
406        }
407    }
408
409    #[must_use]
410    pub fn with_faceting(self, faceting: FacetingSettings) -> Settings {
411        Settings {
412            faceting: Some(faceting),
413            ..self
414        }
415    }
416
417    #[must_use]
418    pub fn with_max_values_per_facet(mut self, max_values_per_facet: usize) -> Settings {
419        let mut faceting = self.faceting.take().unwrap_or_default();
420        faceting.max_values_per_facet = max_values_per_facet;
421        Settings {
422            faceting: Some(faceting),
423            ..self
424        }
425    }
426
427    #[must_use]
428    pub fn with_sort_facet_values_by(
429        mut self,
430        sort_facet_values_by: BTreeMap<String, FacetSortValue>,
431    ) -> Settings {
432        let mut faceting = self.faceting.take().unwrap_or_default();
433        faceting.sort_facet_values_by = Some(sort_facet_values_by);
434        Settings {
435            faceting: Some(faceting),
436            ..self
437        }
438    }
439
440    #[must_use]
441    pub fn with_dictionary(
442        self,
443        dictionary: impl IntoIterator<Item = impl AsRef<str>>,
444    ) -> Settings {
445        Settings {
446            dictionary: Some(
447                dictionary
448                    .into_iter()
449                    .map(|v| v.as_ref().to_string())
450                    .collect(),
451            ),
452            ..self
453        }
454    }
455
456    pub fn with_proximity_precision(self, proximity_precision: impl AsRef<str>) -> Settings {
457        Settings {
458            proximity_precision: Some(proximity_precision.as_ref().to_string()),
459            ..self
460        }
461    }
462
463    /// Set the [embedders](https://www.meilisearch.com/docs/learn/vector_search) of the [Index].
464    #[must_use]
465    pub fn with_embedders<S>(self, embedders: HashMap<S, Embedder>) -> Settings
466    where
467        S: Into<String>,
468    {
469        Settings {
470            embedders: Some(
471                embedders
472                    .into_iter()
473                    .map(|(key, value)| (key.into(), value))
474                    .collect(),
475            ),
476            ..self
477        }
478    }
479
480    pub fn with_search_cutoff(self, search_cutoff_ms: u64) -> Settings {
481        Settings {
482            search_cutoff_ms: Some(search_cutoff_ms),
483            ..self
484        }
485    }
486
487    #[must_use]
488    pub fn with_separation_tokens(
489        self,
490        separator_tokens: impl IntoIterator<Item = impl AsRef<str>>,
491    ) -> Settings {
492        Settings {
493            separator_tokens: Some(
494                separator_tokens
495                    .into_iter()
496                    .map(|v| v.as_ref().to_string())
497                    .collect(),
498            ),
499            ..self
500        }
501    }
502
503    #[must_use]
504    pub fn with_non_separation_tokens(
505        self,
506        non_separator_tokens: impl IntoIterator<Item = impl AsRef<str>>,
507    ) -> Settings {
508        Settings {
509            non_separator_tokens: Some(
510                non_separator_tokens
511                    .into_iter()
512                    .map(|v| v.as_ref().to_string())
513                    .collect(),
514            ),
515            ..self
516        }
517    }
518
519    #[must_use]
520    pub fn with_localized_attributes(
521        self,
522        localized_attributes: impl IntoIterator<Item = LocalizedAttributes>,
523    ) -> Settings {
524        Settings {
525            localized_attributes: Some(localized_attributes.into_iter().collect()),
526            ..self
527        }
528    }
529}
530
531impl<Http: HttpClient> Index<Http> {
532    /// Get [Settings] of the [Index].
533    ///
534    /// # Example
535    ///
536    /// ```
537    /// # use meilisearch_sdk::{client::*, indexes::*};
538    /// #
539    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
540    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
541    /// #
542    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
543    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
544    /// # client.create_index("get_settings", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
545    /// let index = client.index("get_settings");
546    ///
547    /// let settings = index.get_settings().await.unwrap();
548    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
549    /// # });
550    /// ```
551    pub async fn get_settings(&self) -> Result<Settings, Error> {
552        self.client
553            .http_client
554            .request::<(), (), Settings>(
555                &format!("{}/indexes/{}/settings", self.client.host, self.uid),
556                Method::Get { query: () },
557                200,
558            )
559            .await
560    }
561
562    /// Get [synonyms](https://www.meilisearch.com/docs/reference/api/settings#get-synonyms) of the [Index].
563    ///
564    /// # Example
565    ///
566    ///
567    /// ```
568    /// # use meilisearch_sdk::{client::*, indexes::*};
569    /// #
570    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
571    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
572    /// #
573    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
574    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
575    /// # client.create_index("get_synonyms", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
576    /// let index = client.index("get_synonyms");
577    ///
578    /// let synonyms = index.get_synonyms().await.unwrap();
579    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
580    /// # });
581    /// ```
582    pub async fn get_synonyms(&self) -> Result<HashMap<String, Vec<String>>, Error> {
583        self.client
584            .http_client
585            .request::<(), (), HashMap<String, Vec<String>>>(
586                &format!(
587                    "{}/indexes/{}/settings/synonyms",
588                    self.client.host, self.uid
589                ),
590                Method::Get { query: () },
591                200,
592            )
593            .await
594    }
595
596    /// Get [pagination](https://www.meilisearch.com/docs/reference/api/settings#pagination) of the [Index].
597    ///
598    /// # Example
599    ///
600    ///
601    /// ```
602    /// # use meilisearch_sdk::{client::*, indexes::*};
603    /// #
604    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
605    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
606    /// #
607    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
608    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
609    /// # client.create_index("get_pagination", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
610    /// let index = client.index("get_pagination");
611    ///
612    /// let pagination = index.get_pagination().await.unwrap();
613    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
614    /// # });
615    /// ```
616    pub async fn get_pagination(&self) -> Result<PaginationSetting, Error> {
617        self.client
618            .http_client
619            .request::<(), (), PaginationSetting>(
620                &format!(
621                    "{}/indexes/{}/settings/pagination",
622                    self.client.host, self.uid
623                ),
624                Method::Get { query: () },
625                200,
626            )
627            .await
628    }
629
630    /// Get [stop-words](https://www.meilisearch.com/docs/reference/api/settings#stop-words) of the [Index].
631    ///
632    /// # Example
633    ///
634    /// ```
635    /// # use meilisearch_sdk::{client::*, indexes::*};
636    /// #
637    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
638    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
639    /// #
640    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
641    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
642    /// # client.create_index("get_stop_words", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
643    /// let index = client.index("get_stop_words");
644    ///
645    /// let stop_words = index.get_stop_words().await.unwrap();
646    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
647    /// # });
648    /// ```
649    pub async fn get_stop_words(&self) -> Result<Vec<String>, Error> {
650        self.client
651            .http_client
652            .request::<(), (), Vec<String>>(
653                &format!(
654                    "{}/indexes/{}/settings/stop-words",
655                    self.client.host, self.uid
656                ),
657                Method::Get { query: () },
658                200,
659            )
660            .await
661    }
662
663    /// Get [ranking rules](https://www.meilisearch.com/docs/reference/api/settings#ranking-rules) of the [Index].
664    ///
665    /// # Example
666    ///
667    ///
668    /// ```
669    /// # use meilisearch_sdk::{client::*, indexes::*};
670    /// #
671    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
672    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
673    /// #
674    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
675    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
676    /// # client.create_index("get_ranking_rules", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
677    /// let index = client.index("get_ranking_rules");
678    ///
679    /// let ranking_rules = index.get_ranking_rules().await.unwrap();
680    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
681    /// # });
682    /// ```
683    pub async fn get_ranking_rules(&self) -> Result<Vec<String>, Error> {
684        self.client
685            .http_client
686            .request::<(), (), Vec<String>>(
687                &format!(
688                    "{}/indexes/{}/settings/ranking-rules",
689                    self.client.host, self.uid
690                ),
691                Method::Get { query: () },
692                200,
693            )
694            .await
695    }
696
697    /// Get [filterable attributes](https://www.meilisearch.com/docs/reference/api/settings#filterable-attributes) of the [Index].
698    ///
699    /// # Example
700    ///
701    ///
702    /// ```
703    /// # use meilisearch_sdk::{client::*, indexes::*};
704    /// #
705    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
706    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
707    /// #
708    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
709    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
710    /// # client.create_index("get_filterable_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
711    /// let index = client.index("get_filterable_attributes");
712    ///
713    /// let filterable_attributes = index.get_filterable_attributes().await.unwrap();
714    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
715    /// # });
716    /// ```
717    pub async fn get_filterable_attributes(&self) -> Result<Vec<String>, Error> {
718        self.client
719            .http_client
720            .request::<(), (), Vec<String>>(
721                &format!(
722                    "{}/indexes/{}/settings/filterable-attributes",
723                    self.client.host, self.uid
724                ),
725                Method::Get { query: () },
726                200,
727            )
728            .await
729    }
730
731    /// Get [sortable attributes](https://www.meilisearch.com/docs/reference/api/settings#sortable-attributes) of the [Index].
732    ///
733    /// # Example
734    ///
735    ///
736    /// ```
737    /// # use meilisearch_sdk::{client::*, indexes::*};
738    /// #
739    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
740    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
741    /// #
742    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
743    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
744    /// # client.create_index("get_sortable_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
745    /// let index = client.index("get_sortable_attributes");
746    ///
747    /// let sortable_attributes = index.get_sortable_attributes().await.unwrap();
748    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
749    /// # });
750    /// ```
751    pub async fn get_sortable_attributes(&self) -> Result<Vec<String>, Error> {
752        self.client
753            .http_client
754            .request::<(), (), Vec<String>>(
755                &format!(
756                    "{}/indexes/{}/settings/sortable-attributes",
757                    self.client.host, self.uid
758                ),
759                Method::Get { query: () },
760                200,
761            )
762            .await
763    }
764
765    /// Get the [distinct attribute](https://www.meilisearch.com/docs/reference/api/settings#distinct-attribute) of the [Index].
766    ///
767    /// # Example
768    ///
769    ///
770    /// ```
771    /// # use meilisearch_sdk::{client::*, indexes::*};
772    /// #
773    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
774    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
775    /// #
776    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
777    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
778    /// # client.create_index("get_distinct_attribute", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
779    /// let index = client.index("get_distinct_attribute");
780    ///
781    /// let distinct_attribute = index.get_distinct_attribute().await.unwrap();
782    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
783    /// # });
784    /// ```
785    pub async fn get_distinct_attribute(&self) -> Result<Option<String>, Error> {
786        self.client
787            .http_client
788            .request::<(), (), Option<String>>(
789                &format!(
790                    "{}/indexes/{}/settings/distinct-attribute",
791                    self.client.host, self.uid
792                ),
793                Method::Get { query: () },
794                200,
795            )
796            .await
797    }
798
799    /// Get [searchable attributes](https://www.meilisearch.com/docs/reference/api/settings#searchable-attributes) of the [Index].
800    ///
801    /// # Example
802    ///
803    ///
804    /// ```
805    /// # use meilisearch_sdk::{client::*, indexes::*};
806    /// #
807    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
808    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
809    /// #
810    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
811    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
812    /// # client.create_index("get_searchable_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
813    /// let index = client.index("get_searchable_attributes");
814    ///
815    /// let searchable_attributes = index.get_searchable_attributes().await.unwrap();
816    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
817    /// # });
818    /// ```
819    pub async fn get_searchable_attributes(&self) -> Result<Vec<String>, Error> {
820        self.client
821            .http_client
822            .request::<(), (), Vec<String>>(
823                &format!(
824                    "{}/indexes/{}/settings/searchable-attributes",
825                    self.client.host, self.uid
826                ),
827                Method::Get { query: () },
828                200,
829            )
830            .await
831    }
832
833    /// Get [displayed attributes](https://www.meilisearch.com/docs/reference/api/settings#displayed-attributes) of the [Index].
834    ///
835    /// # Example
836    ///
837    ///
838    /// ```
839    /// # use meilisearch_sdk::{client::*, indexes::*};
840    /// #
841    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
842    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
843    /// #
844    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
845    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
846    /// # client.create_index("get_displayed_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
847    /// let index = client.index("get_displayed_attributes");
848    ///
849    /// let displayed_attributes = index.get_displayed_attributes().await.unwrap();
850    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
851    /// # });
852    /// ```
853    pub async fn get_displayed_attributes(&self) -> Result<Vec<String>, Error> {
854        self.client
855            .http_client
856            .request::<(), (), Vec<String>>(
857                &format!(
858                    "{}/indexes/{}/settings/displayed-attributes",
859                    self.client.host, self.uid
860                ),
861                Method::Get { query: () },
862                200,
863            )
864            .await
865    }
866
867    /// Get [faceting](https://www.meilisearch.com/docs/reference/api/settings#faceting) settings of the [Index].
868    ///
869    /// # Example
870    ///
871    ///
872    /// ```
873    /// # use meilisearch_sdk::{client::*, indexes::*};
874    /// #
875    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
876    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
877    /// #
878    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
879    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
880    /// # client.create_index("get_faceting", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
881    /// let index = client.index("get_faceting");
882    ///
883    /// let faceting = index.get_faceting().await.unwrap();
884    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
885    /// # });
886    /// ```
887    pub async fn get_faceting(&self) -> Result<FacetingSettings, Error> {
888        self.client
889            .http_client
890            .request::<(), (), FacetingSettings>(
891                &format!(
892                    "{}/indexes/{}/settings/faceting",
893                    self.client.host, self.uid
894                ),
895                Method::Get { query: () },
896                200,
897            )
898            .await
899    }
900
901    /// Get [dictionary](https://www.meilisearch.com/docs/reference/api/settings#dictionary) of the [Index].
902    ///
903    /// # Example
904    ///
905    /// ```
906    /// # use meilisearch_sdk::{client::*, indexes::*};
907    /// #
908    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
909    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
910    /// #
911    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
912    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
913    /// # client.create_index("get_dictionary", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
914    /// let index = client.index("get_dictionary");
915    ///
916    /// let dictionary = index.get_dictionary().await.unwrap();
917    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
918    /// # });
919    /// ```
920    pub async fn get_dictionary(&self) -> Result<Vec<String>, Error> {
921        self.client
922            .http_client
923            .request::<(), (), Vec<String>>(
924                &format!(
925                    "{}/indexes/{}/settings/dictionary",
926                    self.client.host, self.uid
927                ),
928                Method::Get { query: () },
929                200,
930            )
931            .await
932    }
933
934    /// Get [proximity_precision](https://www.meilisearch.com/docs/reference/api/settings#proximity-precision) of the [Index].
935    ///
936    /// # Example
937    ///
938    /// ```
939    /// # use meilisearch_sdk::{client::*, indexes::*};
940    /// #
941    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
942    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
943    /// #
944    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
945    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
946    /// # client.create_index("get_proximity_precision", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
947    /// let index = client.index("get_proximity_precision");
948    ///
949    /// let proximity_precision = index.get_proximity_precision().await.unwrap();
950    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
951    /// # });
952    /// ```
953    pub async fn get_proximity_precision(&self) -> Result<String, Error> {
954        self.client
955            .http_client
956            .request::<(), (), String>(
957                &format!(
958                    "{}/indexes/{}/settings/proximity-precision",
959                    self.client.host, self.uid
960                ),
961                Method::Get { query: () },
962                200,
963            )
964            .await
965    }
966
967    /// Get [facet-search settings](https://www.meilisearch.com/docs/reference/api/settings#facet-search) of the [Index].
968    ///
969    /// # Example
970    ///
971    /// ```
972    /// # use meilisearch_sdk::{client::*, indexes::*};
973    /// #
974    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
975    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
976    /// #
977    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
978    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
979    /// # client.create_index("get_facet_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
980    /// let index = client.index("get_facet_search");
981    ///
982    /// let facet_search = index.get_facet_search().await.unwrap();
983    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
984    /// # });
985    /// ```
986    pub async fn get_facet_search(&self) -> Result<bool, Error> {
987        self.client
988            .http_client
989            .request::<(), (), bool>(
990                &format!(
991                    "{}/indexes/{}/settings/facet-search",
992                    self.client.host, self.uid
993                ),
994                Method::Get { query: () },
995                200,
996            )
997            .await
998    }
999
1000    /// Get [prefix-search settings](https://www.meilisearch.com/docs/reference/api/settings#prefix-search) of the [Index].
1001    ///
1002    /// # Example
1003    ///
1004    /// ```
1005    /// # use meilisearch_sdk::{client::*, indexes::*};
1006    /// #
1007    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1008    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1009    /// #
1010    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1011    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1012    /// # client.create_index("get_prefix_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1013    /// let index = client.index("get_prefix_search");
1014    ///
1015    /// let prefix_search = index.get_prefix_search().await.unwrap();
1016    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1017    /// # });
1018    /// ```
1019    pub async fn get_prefix_search(&self) -> Result<PrefixSearchSettings, Error> {
1020        self.client
1021            .http_client
1022            .request::<(), (), PrefixSearchSettings>(
1023                &format!(
1024                    "{}/indexes/{}/settings/prefix-search",
1025                    self.client.host, self.uid
1026                ),
1027                Method::Get { query: () },
1028                200,
1029            )
1030            .await
1031    }
1032
1033    /// Get [typo tolerance](https://www.meilisearch.com/docs/reference/api/settings#typo-tolerance) of the [Index].
1034    ///
1035    /// ```
1036    /// # use meilisearch_sdk::{client::*, indexes::*};
1037    /// #
1038    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1039    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1040    /// #
1041    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1042    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1043    /// # client.create_index("get_typo_tolerance", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1044    /// let index = client.index("get_typo_tolerance");
1045    ///
1046    /// let typo_tolerance = index.get_typo_tolerance().await.unwrap();
1047    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1048    /// # });
1049    /// ```
1050    pub async fn get_typo_tolerance(&self) -> Result<TypoToleranceSettings, Error> {
1051        self.client
1052            .http_client
1053            .request::<(), (), TypoToleranceSettings>(
1054                &format!(
1055                    "{}/indexes/{}/settings/typo-tolerance",
1056                    self.client.host, self.uid
1057                ),
1058                Method::Get { query: () },
1059                200,
1060            )
1061            .await
1062    }
1063
1064    /// Get [embedders](https://www.meilisearch.com/docs/learn/vector_search) of the [Index].
1065    ///
1066    /// ```
1067    /// # use std::collections::HashMap;
1068    /// # use std::string::String;
1069    /// # use meilisearch_sdk::{indexes::*,settings::Embedder,settings::EmbedderSource,settings::Settings,client::*};
1070    /// #
1071    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1072    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1073    /// #
1074    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1075    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1076    /// # client.create_index("get_embedders", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1077    /// let index = client.index("get_embedders");
1078    /// #
1079    /// # let t = index.set_embedders(&HashMap::from([(
1080    /// #         String::from("default"),
1081    /// #         Embedder {
1082    /// #             source: EmbedderSource::UserProvided,
1083    /// #             dimensions: Some(1),
1084    /// #             ..Embedder::default()
1085    /// #         }
1086    /// #     )])).await.unwrap();
1087    /// # t.wait_for_completion(&client, None, None).await.unwrap();
1088    /// let embedders = index.get_embedders().await.unwrap();
1089    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1090    /// # });
1091    /// ```
1092    pub async fn get_embedders(&self) -> Result<HashMap<String, Embedder>, Error> {
1093        self.client
1094            .http_client
1095            .request::<(), (), Option<HashMap<String, Embedder>>>(
1096                &format!(
1097                    "{}/indexes/{}/settings/embedders",
1098                    self.client.host, self.uid
1099                ),
1100                Method::Get { query: () },
1101                200,
1102            )
1103            .await
1104            .map(|r| r.unwrap_or_default())
1105    }
1106
1107    /// Set [embedders](https://www.meilisearch.com/docs/learn/vector_search) of the [Index].
1108    ///
1109    /// ```
1110    /// # use std::collections::HashMap;
1111    /// # use std::string::String;
1112    /// # use meilisearch_sdk::{indexes::*,settings::Embedder,settings::EmbedderSource,settings::Settings,client::*};
1113    /// #
1114    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1115    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1116    /// #
1117    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1118    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1119    /// # client.create_index("set_embedders", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1120    /// let index = client.index("set_embedders");
1121    /// #
1122    /// let t = index.set_embedders(&HashMap::from([(
1123    ///         String::from("default"),
1124    ///         Embedder {
1125    ///             source: EmbedderSource::UserProvided,
1126    ///             dimensions: Some(1),
1127    ///             ..Embedder::default()
1128    ///         }
1129    ///     )])).await.unwrap();
1130    /// # t.wait_for_completion(&client, None, None).await.unwrap();
1131    /// # let embedders = index.get_embedders().await.unwrap();
1132    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1133    /// # });
1134    /// ```
1135    pub async fn set_embedders(
1136        &self,
1137        embedders: &HashMap<String, Embedder>,
1138    ) -> Result<TaskInfo, Error> {
1139        self.client
1140            .http_client
1141            .request::<(), &HashMap<String, Embedder>, TaskInfo>(
1142                &format!(
1143                    "{}/indexes/{}/settings/embedders",
1144                    self.client.host, self.uid
1145                ),
1146                Method::Patch {
1147                    query: (),
1148                    body: embedders,
1149                },
1150                202,
1151            )
1152            .await
1153    }
1154
1155    /// Get [search cutoff](https://www.meilisearch.com/docs/reference/api/settings#search-cutoff) settings of the [Index].
1156    ///
1157    /// # Example
1158    ///
1159    /// ```
1160    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1161    /// #
1162    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1163    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1164    /// #
1165    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1166    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1167    /// # client.create_index("get_search_cutoff_ms", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1168    /// let mut index = client.index("get_search_cutoff_ms");
1169    ///
1170    /// let task = index.get_search_cutoff_ms().await.unwrap();
1171    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1172    /// # });
1173    /// ```
1174    pub async fn get_search_cutoff_ms(&self) -> Result<Option<u64>, Error> {
1175        self.client
1176            .http_client
1177            .request::<(), (), Option<u64>>(
1178                &format!(
1179                    "{}/indexes/{}/settings/search-cutoff-ms",
1180                    self.client.host, self.uid
1181                ),
1182                Method::Get { query: () },
1183                200,
1184            )
1185            .await
1186    }
1187
1188    /// Get [separator token](https://www.meilisearch.com/docs/reference/api/settings#separator-tokens) of the [Index].
1189    ///
1190    /// ```
1191    /// # use meilisearch_sdk::{client::*, indexes::*};
1192    /// #
1193    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1194    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1195    /// #
1196    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1197    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1198    /// # client.create_index("get_separator_tokens", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1199    /// let index = client.index("get_separator_tokens");
1200    ///
1201    /// let separator_tokens = index.get_separator_tokens().await.unwrap();
1202    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1203    /// # });
1204    /// ```
1205    pub async fn get_separator_tokens(&self) -> Result<Vec<String>, Error> {
1206        self.client
1207            .http_client
1208            .request::<(), (), Vec<String>>(
1209                &format!(
1210                    "{}/indexes/{}/settings/separator-tokens",
1211                    self.client.host, self.uid
1212                ),
1213                Method::Get { query: () },
1214                200,
1215            )
1216            .await
1217    }
1218
1219    /// Get [non separator token](https://www.meilisearch.com/docs/reference/api/settings#non-separator-tokens) of the [Index].
1220    ///
1221    /// ```
1222    /// # use meilisearch_sdk::{client::*, indexes::*};
1223    /// #
1224    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1225    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1226    /// #
1227    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1228    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1229    /// # client.create_index("get_non_separator_tokens", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1230    /// let index = client.index("get_non_separator_tokens");
1231    ///
1232    /// let non_separator_tokens = index.get_non_separator_tokens().await.unwrap();
1233    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1234    /// # });
1235    /// ```
1236    pub async fn get_non_separator_tokens(&self) -> Result<Vec<String>, Error> {
1237        self.client
1238            .http_client
1239            .request::<(), (), Vec<String>>(
1240                &format!(
1241                    "{}/indexes/{}/settings/non-separator-tokens",
1242                    self.client.host, self.uid
1243                ),
1244                Method::Get { query: () },
1245                200,
1246            )
1247            .await
1248    }
1249
1250    /// Get [localized attributes](https://www.meilisearch.com/docs/reference/api/settings#localized-attributes-object) settings of the [Index].
1251    ///
1252    /// ```
1253    /// # use meilisearch_sdk::{client::*, indexes::*, settings::LocalizedAttributes};
1254    /// #
1255    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1256    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1257    /// #
1258    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1259    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1260    /// # client.create_index("get_localized_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1261    /// let index = client.index("get_localized_attributes");
1262    ///
1263    /// let localized_attributes = index.get_localized_attributes().await.unwrap();
1264    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1265    /// # });
1266    /// ```
1267    pub async fn get_localized_attributes(
1268        &self,
1269    ) -> Result<Option<Vec<LocalizedAttributes>>, Error> {
1270        self.client
1271            .http_client
1272            .request::<(), (), Option<Vec<LocalizedAttributes>>>(
1273                &format!(
1274                    "{}/indexes/{}/settings/localized-attributes",
1275                    self.client.host, self.uid
1276                ),
1277                Method::Get { query: () },
1278                200,
1279            )
1280            .await
1281    }
1282
1283    /// Update [settings](../settings/struct.Settings) of the [Index].
1284    ///
1285    /// Updates in the settings are partial. This means that any parameters corresponding to a `None` value will be left unchanged.
1286    ///
1287    /// # Example
1288    ///
1289    /// ```
1290    /// # use meilisearch_sdk::{client::*, indexes::*, settings::*};
1291    /// #
1292    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1293    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1294    /// #
1295    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1296    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1297    /// # client.create_index("set_settings", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1298    /// let mut index = client.index("set_settings");
1299    ///
1300    /// let stop_words = vec![String::from("a"), String::from("the"), String::from("of")];
1301    /// let settings = Settings::new()
1302    ///     .with_stop_words(stop_words.clone())
1303    ///     .with_pagination(PaginationSetting {max_total_hits: 100}
1304    /// );
1305    ///
1306    /// let task = index.set_settings(&settings).await.unwrap();
1307    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1308    /// # });
1309    /// ```
1310    pub async fn set_settings(&self, settings: &Settings) -> Result<TaskInfo, Error> {
1311        self.client
1312            .http_client
1313            .request::<(), &Settings, TaskInfo>(
1314                &format!("{}/indexes/{}/settings", self.client.host, self.uid),
1315                Method::Patch {
1316                    query: (),
1317                    body: settings,
1318                },
1319                202,
1320            )
1321            .await
1322    }
1323
1324    /// Update [synonyms](https://www.meilisearch.com/docs/reference/api/settings#synonyms) of the [Index].
1325    ///
1326    /// # Example
1327    ///
1328    /// ```
1329    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1330    /// #
1331    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1332    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1333    /// #
1334    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1335    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1336    /// # client.create_index("set_synonyms", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1337    /// let mut index = client.index("set_synonyms");
1338    ///
1339    /// let mut synonyms = std::collections::HashMap::new();
1340    /// synonyms.insert(String::from("wolverine"), vec![String::from("xmen"), String::from("logan")]);
1341    /// synonyms.insert(String::from("logan"), vec![String::from("xmen"), String::from("wolverine")]);
1342    /// synonyms.insert(String::from("wow"), vec![String::from("world of warcraft")]);
1343    ///
1344    /// let task = index.set_synonyms(&synonyms).await.unwrap();
1345    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1346    /// # });
1347    /// ```
1348    pub async fn set_synonyms(
1349        &self,
1350        synonyms: &HashMap<String, Vec<String>>,
1351    ) -> Result<TaskInfo, Error> {
1352        self.client
1353            .http_client
1354            .request::<(), &HashMap<String, Vec<String>>, TaskInfo>(
1355                &format!(
1356                    "{}/indexes/{}/settings/synonyms",
1357                    self.client.host, self.uid
1358                ),
1359                Method::Put {
1360                    query: (),
1361                    body: synonyms,
1362                },
1363                202,
1364            )
1365            .await
1366    }
1367
1368    /// Update [pagination](https://www.meilisearch.com/docs/reference/api/settings#pagination) of the [Index].
1369    ///
1370    /// # Example
1371    ///
1372    /// ```
1373    /// # use meilisearch_sdk::{client::*, indexes::*, settings::*};
1374    /// #
1375    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1376    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1377    /// #
1378    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1379    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1380    /// # client.create_index("set_pagination", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1381    /// let mut index = client.index("set_pagination");
1382    ///
1383    /// let pagination = PaginationSetting {max_total_hits:100};
1384    /// let task = index.set_pagination(pagination).await.unwrap();
1385    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1386    /// # });
1387    /// ```
1388    pub async fn set_pagination(&self, pagination: PaginationSetting) -> Result<TaskInfo, Error> {
1389        self.client
1390            .http_client
1391            .request::<(), &PaginationSetting, TaskInfo>(
1392                &format!(
1393                    "{}/indexes/{}/settings/pagination",
1394                    self.client.host, self.uid
1395                ),
1396                Method::Patch {
1397                    query: (),
1398                    body: &pagination,
1399                },
1400                202,
1401            )
1402            .await
1403    }
1404
1405    /// Update [stop-words](https://www.meilisearch.com/docs/reference/api/settings#stop-words) of the [Index].
1406    ///
1407    /// # Example
1408    ///
1409    /// ```
1410    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1411    /// #
1412    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1413    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1414    /// #
1415    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1416    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1417    /// # client.create_index("set_stop_words", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1418    /// let mut index = client.index("set_stop_words");
1419    ///
1420    /// let stop_words = ["the", "of", "to"];
1421    /// let task = index.set_stop_words(&stop_words).await.unwrap();
1422    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1423    /// # });
1424    /// ```
1425    pub async fn set_stop_words(
1426        &self,
1427        stop_words: impl IntoIterator<Item = impl AsRef<str>>,
1428    ) -> Result<TaskInfo, Error> {
1429        self.client
1430            .http_client
1431            .request::<(), Vec<String>, TaskInfo>(
1432                &format!(
1433                    "{}/indexes/{}/settings/stop-words",
1434                    self.client.host, self.uid
1435                ),
1436                Method::Put {
1437                    query: (),
1438                    body: stop_words
1439                        .into_iter()
1440                        .map(|v| v.as_ref().to_string())
1441                        .collect(),
1442                },
1443                202,
1444            )
1445            .await
1446    }
1447
1448    /// Update [ranking rules](https://www.meilisearch.com/docs/reference/api/settings#ranking-rules) of the [Index].
1449    ///
1450    /// # Example
1451    ///
1452    /// ```
1453    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1454    /// #
1455    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1456    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1457    /// #
1458    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1459    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1460    /// # client.create_index("set_ranking_rules", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1461    /// let mut index = client.index("set_ranking_rules");
1462    ///
1463    /// let ranking_rules = [
1464    ///     "words",
1465    ///     "typo",
1466    ///     "proximity",
1467    ///     "attribute",
1468    ///     "sort",
1469    ///     "exactness",
1470    ///     "release_date:asc",
1471    ///     "rank:desc",
1472    /// ];
1473    /// let task = index.set_ranking_rules(ranking_rules).await.unwrap();
1474    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1475    /// # });
1476    /// ```
1477    pub async fn set_ranking_rules(
1478        &self,
1479        ranking_rules: impl IntoIterator<Item = impl AsRef<str>>,
1480    ) -> Result<TaskInfo, Error> {
1481        self.client
1482            .http_client
1483            .request::<(), Vec<String>, TaskInfo>(
1484                &format!(
1485                    "{}/indexes/{}/settings/ranking-rules",
1486                    self.client.host, self.uid
1487                ),
1488                Method::Put {
1489                    query: (),
1490                    body: ranking_rules
1491                        .into_iter()
1492                        .map(|v| v.as_ref().to_string())
1493                        .collect(),
1494                },
1495                202,
1496            )
1497            .await
1498    }
1499
1500    /// Update [filterable attributes](https://www.meilisearch.com/docs/reference/api/settings#filterable-attributes) of the [Index].
1501    ///
1502    /// # Example
1503    ///
1504    /// ```
1505    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1506    /// #
1507    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1508    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1509    /// #
1510    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1511    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1512    /// # client.create_index("set_filterable_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1513    /// let mut index = client.index("set_filterable_attributes");
1514    ///
1515    /// let filterable_attributes = ["genre", "director"];
1516    /// let task = index.set_filterable_attributes(&filterable_attributes).await.unwrap();
1517    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1518    /// # });
1519    /// ```
1520    pub async fn set_filterable_attributes(
1521        &self,
1522        filterable_attributes: impl IntoIterator<Item = impl AsRef<str>>,
1523    ) -> Result<TaskInfo, Error> {
1524        self.client
1525            .http_client
1526            .request::<(), Vec<String>, TaskInfo>(
1527                &format!(
1528                    "{}/indexes/{}/settings/filterable-attributes",
1529                    self.client.host, self.uid
1530                ),
1531                Method::Put {
1532                    query: (),
1533                    body: filterable_attributes
1534                        .into_iter()
1535                        .map(|v| v.as_ref().to_string())
1536                        .collect(),
1537                },
1538                202,
1539            )
1540            .await
1541    }
1542
1543    /// Update [sortable attributes](https://www.meilisearch.com/docs/reference/api/settings#sortable-attributes) of the [Index].
1544    ///
1545    /// # Example
1546    ///
1547    /// ```
1548    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1549    /// #
1550    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1551    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1552    /// #
1553    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1554    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1555    /// # client.create_index("set_sortable_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1556    /// let mut index = client.index("set_sortable_attributes");
1557    ///
1558    /// let sortable_attributes = ["genre", "director"];
1559    /// let task = index.set_sortable_attributes(&sortable_attributes).await.unwrap();
1560    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1561    /// # });
1562    /// ```
1563    pub async fn set_sortable_attributes(
1564        &self,
1565        sortable_attributes: impl IntoIterator<Item = impl AsRef<str>>,
1566    ) -> Result<TaskInfo, Error> {
1567        self.client
1568            .http_client
1569            .request::<(), Vec<String>, TaskInfo>(
1570                &format!(
1571                    "{}/indexes/{}/settings/sortable-attributes",
1572                    self.client.host, self.uid
1573                ),
1574                Method::Put {
1575                    query: (),
1576                    body: sortable_attributes
1577                        .into_iter()
1578                        .map(|v| v.as_ref().to_string())
1579                        .collect(),
1580                },
1581                202,
1582            )
1583            .await
1584    }
1585
1586    /// Update the [distinct attribute](https://www.meilisearch.com/docs/reference/api/settings#distinct-attribute) of the [Index].
1587    ///
1588    /// # Example
1589    ///
1590    /// ```
1591    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1592    /// #
1593    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1594    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1595    /// #
1596    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1597    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1598    /// # client.create_index("set_distinct_attribute", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1599    /// let mut index = client.index("set_distinct_attribute");
1600    ///
1601    /// let task = index.set_distinct_attribute("movie_id").await.unwrap();
1602    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1603    /// # });
1604    /// ```
1605    pub async fn set_distinct_attribute(
1606        &self,
1607        distinct_attribute: impl AsRef<str>,
1608    ) -> Result<TaskInfo, Error> {
1609        self.client
1610            .http_client
1611            .request::<(), String, TaskInfo>(
1612                &format!(
1613                    "{}/indexes/{}/settings/distinct-attribute",
1614                    self.client.host, self.uid
1615                ),
1616                Method::Put {
1617                    query: (),
1618                    body: distinct_attribute.as_ref().to_string(),
1619                },
1620                202,
1621            )
1622            .await
1623    }
1624
1625    /// Update [searchable attributes](https://www.meilisearch.com/docs/reference/api/settings#searchable-attributes) of the [Index].
1626    ///
1627    /// # Example
1628    ///
1629    /// ```
1630    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1631    /// #
1632    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1633    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1634    /// #
1635    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1636    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1637    /// # client.create_index("set_searchable_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1638    /// let mut index = client.index("set_searchable_attributes");
1639    ///
1640    /// let task = index.set_searchable_attributes(["title", "description", "uid"]).await.unwrap();
1641    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1642    /// # });
1643    /// ```
1644    pub async fn set_searchable_attributes(
1645        &self,
1646        searchable_attributes: impl IntoIterator<Item = impl AsRef<str>>,
1647    ) -> Result<TaskInfo, Error> {
1648        self.client
1649            .http_client
1650            .request::<(), Vec<String>, TaskInfo>(
1651                &format!(
1652                    "{}/indexes/{}/settings/searchable-attributes",
1653                    self.client.host, self.uid
1654                ),
1655                Method::Put {
1656                    query: (),
1657                    body: searchable_attributes
1658                        .into_iter()
1659                        .map(|v| v.as_ref().to_string())
1660                        .collect(),
1661                },
1662                202,
1663            )
1664            .await
1665    }
1666
1667    /// Update [displayed attributes](https://www.meilisearch.com/docs/reference/api/settings#displayed-attributes) of the [Index].
1668    ///
1669    /// # Example
1670    ///
1671    /// ```
1672    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1673    /// #
1674    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1675    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1676    /// #
1677    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1678    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1679    /// # client.create_index("set_displayed_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1680    /// let mut index = client.index("set_displayed_attributes");
1681    ///
1682    /// let task = index.set_displayed_attributes(["title", "description", "release_date", "rank", "poster"]).await.unwrap();
1683    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1684    /// # });
1685    /// ```
1686    pub async fn set_displayed_attributes(
1687        &self,
1688        displayed_attributes: impl IntoIterator<Item = impl AsRef<str>>,
1689    ) -> Result<TaskInfo, Error> {
1690        self.client
1691            .http_client
1692            .request::<(), Vec<String>, TaskInfo>(
1693                &format!(
1694                    "{}/indexes/{}/settings/displayed-attributes",
1695                    self.client.host, self.uid
1696                ),
1697                Method::Put {
1698                    query: (),
1699                    body: displayed_attributes
1700                        .into_iter()
1701                        .map(|v| v.as_ref().to_string())
1702                        .collect(),
1703                },
1704                202,
1705            )
1706            .await
1707    }
1708
1709    /// Update [faceting](https://www.meilisearch.com/docs/reference/api/settings#faceting) settings of the [Index].
1710    ///
1711    /// # Example
1712    ///
1713    /// ```
1714    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings, settings::FacetingSettings};
1715    /// #
1716    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1717    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1718    /// #
1719    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1720    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1721    /// # client.create_index("set_faceting", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1722    /// let mut index = client.index("set_faceting");
1723    ///
1724    /// let mut faceting = FacetingSettings {
1725    ///     max_values_per_facet: 12,
1726    ///     sort_facet_values_by: None,
1727    /// };
1728    ///
1729    /// let task = index.set_faceting(&faceting).await.unwrap();
1730    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1731    /// # });
1732    /// ```
1733    pub async fn set_faceting(&self, faceting: &FacetingSettings) -> Result<TaskInfo, Error> {
1734        self.client
1735            .http_client
1736            .request::<(), &FacetingSettings, TaskInfo>(
1737                &format!(
1738                    "{}/indexes/{}/settings/faceting",
1739                    self.client.host, self.uid
1740                ),
1741                Method::Patch {
1742                    query: (),
1743                    body: faceting,
1744                },
1745                202,
1746            )
1747            .await
1748    }
1749
1750    /// Update [dictionary](https://www.meilisearch.com/docs/reference/api/settings#dictionary) of the [Index].
1751    ///
1752    /// # Example
1753    ///
1754    /// ```
1755    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1756    /// #
1757    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1758    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1759    /// #
1760    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1761    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1762    /// # client.create_index("set_dictionary", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1763    /// let mut index = client.index("set_dictionary");
1764    ///
1765    /// let task = index.set_dictionary(["J. K.", "J. R. R."]).await.unwrap();
1766    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1767    /// # });
1768    /// ```
1769    pub async fn set_dictionary(
1770        &self,
1771        dictionary: impl IntoIterator<Item = impl AsRef<str>>,
1772    ) -> Result<TaskInfo, Error> {
1773        self.client
1774            .http_client
1775            .request::<(), Vec<String>, TaskInfo>(
1776                &format!(
1777                    "{}/indexes/{}/settings/dictionary",
1778                    self.client.host, self.uid
1779                ),
1780                Method::Put {
1781                    query: (),
1782                    body: dictionary
1783                        .into_iter()
1784                        .map(|v| v.as_ref().to_string())
1785                        .collect(),
1786                },
1787                202,
1788            )
1789            .await
1790    }
1791
1792    /// Update [typo tolerance](https://www.meilisearch.com/docs/reference/api/settings#typo-tolerance) settings of the [Index].
1793    ///
1794    /// # Example
1795    ///
1796    /// ```
1797    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings, settings::{TypoToleranceSettings, MinWordSizeForTypos}};
1798    /// #
1799    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1800    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1801    /// #
1802    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1803    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1804    /// # client.create_index("set_typo_tolerance", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1805    /// let mut index = client.index("set_typo_tolerance");
1806    ///
1807    /// let typo_tolerance = TypoToleranceSettings{
1808    ///     enabled: Some(true),
1809    ///     disable_on_attributes: Some(vec!["title".to_string()]),
1810    ///     disable_on_words: Some(vec![]),
1811    ///     min_word_size_for_typos: Some(MinWordSizeForTypos::default()),
1812    /// };
1813    ///
1814    /// let task = index.set_typo_tolerance(&typo_tolerance).await.unwrap();
1815    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1816    /// # });
1817    /// ```
1818    pub async fn set_typo_tolerance(
1819        &self,
1820        typo_tolerance: &TypoToleranceSettings,
1821    ) -> Result<TaskInfo, Error> {
1822        self.client
1823            .http_client
1824            .request::<(), &TypoToleranceSettings, TaskInfo>(
1825                &format!(
1826                    "{}/indexes/{}/settings/typo-tolerance",
1827                    self.client.host, self.uid
1828                ),
1829                Method::Patch {
1830                    query: (),
1831                    body: typo_tolerance,
1832                },
1833                202,
1834            )
1835            .await
1836    }
1837
1838    /// Update [separator tokens](https://www.meilisearch.com/docs/reference/api/settings#separator-tokens) settings of the [Index].
1839    ///
1840    /// # Example
1841    ///
1842    /// ```
1843    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings, settings::{TypoToleranceSettings, MinWordSizeForTypos}};
1844    /// #
1845    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1846    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1847    /// #
1848    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1849    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1850    /// # client.create_index("set_separator_tokens", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1851    /// let mut index = client.index("set_separator_tokens");
1852    ///
1853    /// let separator_token: Vec<String> = vec!["@".to_string(), "#".to_string()];
1854    ///
1855    /// let task = index.set_separator_tokens(&separator_token).await.unwrap();
1856    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1857    /// # });
1858    /// ```
1859    pub async fn set_separator_tokens(
1860        &self,
1861        separator_token: &Vec<String>,
1862    ) -> Result<TaskInfo, Error> {
1863        self.client
1864            .http_client
1865            .request::<(), &Vec<String>, TaskInfo>(
1866                &format!(
1867                    "{}/indexes/{}/settings/separator-tokens",
1868                    self.client.host, self.uid
1869                ),
1870                Method::Put {
1871                    query: (),
1872                    body: separator_token,
1873                },
1874                202,
1875            )
1876            .await
1877    }
1878
1879    /// Update [non separator tokens](https://www.meilisearch.com/docs/reference/api/settings#non-separator-tokens) settings of the [Index].
1880    ///
1881    /// # Example
1882    ///
1883    /// ```
1884    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings, settings::{TypoToleranceSettings, MinWordSizeForTypos}};
1885    /// #
1886    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1887    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1888    /// #
1889    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1890    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1891    /// # client.create_index("set_non_separator_tokens", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1892    /// let mut index = client.index("set_non_separator_tokens");
1893    ///
1894    /// let non_separator_token: Vec<String> = vec!["@".to_string(), "#".to_string()];
1895    ///
1896    /// let task = index.set_non_separator_tokens(&non_separator_token).await.unwrap();
1897    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1898    /// # });
1899    /// ```
1900    pub async fn set_non_separator_tokens(
1901        &self,
1902        non_separator_token: &Vec<String>,
1903    ) -> Result<TaskInfo, Error> {
1904        self.client
1905            .http_client
1906            .request::<(), &Vec<String>, TaskInfo>(
1907                &format!(
1908                    "{}/indexes/{}/settings/non-separator-tokens",
1909                    self.client.host, self.uid
1910                ),
1911                Method::Put {
1912                    query: (),
1913                    body: non_separator_token,
1914                },
1915                202,
1916            )
1917            .await
1918    }
1919
1920    /// Update [proximity-precision](https://www.meilisearch.com/docs/reference/api/settings#proximity-precision) settings of the [Index].
1921    ///
1922    /// # Example
1923    ///
1924    /// ```
1925    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1926    /// #
1927    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1928    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1929    /// #
1930    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1931    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1932    /// # client.create_index("set_proximity_precision", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1933    /// let mut index = client.index("set_proximity_precision");
1934    ///
1935    /// let task = index.set_proximity_precision("byWord".to_string()).await.unwrap();
1936    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1937    /// # });
1938    /// ```
1939    pub async fn set_proximity_precision(
1940        &self,
1941        proximity_precision: String,
1942    ) -> Result<TaskInfo, Error> {
1943        self.client
1944            .http_client
1945            .request::<(), String, TaskInfo>(
1946                &format!(
1947                    "{}/indexes/{}/settings/proximity-precision",
1948                    self.client.host, self.uid
1949                ),
1950                Method::Put {
1951                    query: (),
1952                    body: proximity_precision,
1953                },
1954                202,
1955            )
1956            .await
1957    }
1958
1959    /// Update [facet-search settings](https://www.meilisearch.com/docs/reference/api/settings#facet-search) settings of the [Index].
1960    ///
1961    /// # Example
1962    ///
1963    /// ```
1964    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
1965    /// #
1966    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
1967    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
1968    /// #
1969    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
1970    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
1971    /// # client.create_index("set_facet_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1972    /// let mut index = client.index("set_facet_search");
1973    ///
1974    /// let task = index.set_facet_search(false).await.unwrap();
1975    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
1976    /// # });
1977    /// ```
1978    pub async fn set_facet_search(&self, facet_search: bool) -> Result<TaskInfo, Error> {
1979        self.client
1980            .http_client
1981            .request::<(), bool, TaskInfo>(
1982                &format!(
1983                    "{}/indexes/{}/settings/facet-search",
1984                    self.client.host, self.uid
1985                ),
1986                Method::Put {
1987                    query: (),
1988                    body: facet_search,
1989                },
1990                202,
1991            )
1992            .await
1993    }
1994
1995    /// update [prefix-search settings](https://www.meilisearch.com/docs/reference/api/settings#prefix-search) settings of the [Index].
1996    ///
1997    /// # Example
1998    ///
1999    /// ```
2000    /// # use meilisearch_sdk::{client::*, indexes::*, settings::{Settings, PrefixSearchSettings}};
2001    /// #
2002    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2003    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2004    /// #
2005    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2006    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2007    /// # client.create_index("set_prefix_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2008    /// let mut index = client.index("set_prefix_search");
2009    ///
2010    /// let task = index.set_prefix_search(PrefixSearchSettings::Disabled).await.unwrap();
2011    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2012    /// # });
2013    /// ```
2014    pub async fn set_prefix_search(
2015        &self,
2016        prefix_search: PrefixSearchSettings,
2017    ) -> Result<TaskInfo, Error> {
2018        self.client
2019            .http_client
2020            .request::<(), PrefixSearchSettings, TaskInfo>(
2021                &format!(
2022                    "{}/indexes/{}/settings/prefix-search",
2023                    self.client.host, self.uid
2024                ),
2025                Method::Put {
2026                    query: (),
2027                    body: prefix_search,
2028                },
2029                202,
2030            )
2031            .await
2032    }
2033
2034    /// Update [search cutoff](https://www.meilisearch.com/docs/reference/api/settings#search-cutoff) settings of the [Index].
2035    ///
2036    /// # Example
2037    ///
2038    /// ```
2039    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2040    /// #
2041    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2042    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2043    /// #
2044    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2045    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2046    /// # client.create_index("update_search_cutoff_ms", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2047    /// let mut index = client.index("update_search_cutoff_ms");
2048    ///
2049    /// let task = index.set_search_cutoff_ms(Some(150)).await.unwrap();
2050    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2051    /// # });
2052    /// ```
2053    pub async fn set_search_cutoff_ms(&self, ms: Option<u64>) -> Result<TaskInfo, Error> {
2054        self.client
2055            .http_client
2056            .request::<(), Option<u64>, TaskInfo>(
2057                &format!(
2058                    "{}/indexes/{}/settings/search-cutoff-ms",
2059                    self.client.host, self.uid
2060                ),
2061                Method::Put {
2062                    body: ms,
2063                    query: (),
2064                },
2065                202,
2066            )
2067            .await
2068    }
2069
2070    /// Update [localized attributes](https://www.meilisearch.com/docs/reference/api/settings#localized-attributes-object) settings of the [Index].
2071    ///
2072    /// # Example
2073    ///
2074    /// ```
2075    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings, settings::{LocalizedAttributes}};
2076    /// #
2077    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2078    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2079    /// #
2080    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2081    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2082    /// # client.create_index("set_localized_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2083    /// let mut index = client.index("set_localized_attributes");
2084    ///
2085    /// let localized_attributes = vec![LocalizedAttributes {
2086    ///     locales: vec!["jpn".to_string()],
2087    ///     attribute_patterns: vec!["*_ja".to_string()],
2088    /// }];
2089    ///
2090    /// let task = index.set_localized_attributes(&localized_attributes).await.unwrap();
2091    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2092    /// # });
2093    /// ```
2094    pub async fn set_localized_attributes(
2095        &self,
2096        localized_attributes: &Vec<LocalizedAttributes>,
2097    ) -> Result<TaskInfo, Error> {
2098        self.client
2099            .http_client
2100            .request::<(), &Vec<LocalizedAttributes>, TaskInfo>(
2101                &format!(
2102                    "{}/indexes/{}/settings/localized-attributes",
2103                    self.client.host, self.uid
2104                ),
2105                Method::Put {
2106                    query: (),
2107                    body: localized_attributes,
2108                },
2109                202,
2110            )
2111            .await
2112    }
2113
2114    /// Reset [Settings] of the [Index].
2115    ///
2116    /// All settings will be reset to their [default value](https://www.meilisearch.com/docs/reference/api/settings#reset-settings).
2117    ///
2118    /// # Example
2119    ///
2120    /// ```
2121    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2122    /// #
2123    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2124    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2125    /// #
2126    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2127    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2128    /// # client.create_index("reset_settings", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2129    /// let mut index = client.index("reset_settings");
2130    ///
2131    /// let task = index.reset_settings().await.unwrap();
2132    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2133    /// # });
2134    /// ```
2135    pub async fn reset_settings(&self) -> Result<TaskInfo, Error> {
2136        self.client
2137            .http_client
2138            .request::<(), (), TaskInfo>(
2139                &format!("{}/indexes/{}/settings", self.client.host, self.uid),
2140                Method::Delete { query: () },
2141                202,
2142            )
2143            .await
2144    }
2145
2146    /// Reset [synonyms](https://www.meilisearch.com/docs/reference/api/settings#synonyms) of the [Index].
2147    ///
2148    /// # Example
2149    ///
2150    /// ```
2151    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2152    /// #
2153    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2154    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2155    /// #
2156    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2157    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2158    /// # client.create_index("reset_synonyms", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2159    /// let mut index = client.index("reset_synonyms");
2160    ///
2161    /// let task = index.reset_synonyms().await.unwrap();
2162    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2163    /// # });
2164    /// ```
2165    pub async fn reset_synonyms(&self) -> Result<TaskInfo, Error> {
2166        self.client
2167            .http_client
2168            .request::<(), (), TaskInfo>(
2169                &format!(
2170                    "{}/indexes/{}/settings/synonyms",
2171                    self.client.host, self.uid
2172                ),
2173                Method::Delete { query: () },
2174                202,
2175            )
2176            .await
2177    }
2178
2179    /// Reset [pagination](https://www.meilisearch.com/docs/learn/configuration/settings#pagination) of the [Index].
2180    ///
2181    /// # Example
2182    ///
2183    /// ```
2184    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2185    /// #
2186    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2187    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2188    /// #
2189    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2190    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2191    /// # client.create_index("reset_pagination", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2192    /// let mut index = client.index("reset_pagination");
2193    ///
2194    /// let task = index.reset_pagination().await.unwrap();
2195    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2196    /// # });
2197    /// ```
2198    pub async fn reset_pagination(&self) -> Result<TaskInfo, Error> {
2199        self.client
2200            .http_client
2201            .request::<(), (), TaskInfo>(
2202                &format!(
2203                    "{}/indexes/{}/settings/pagination",
2204                    self.client.host, self.uid
2205                ),
2206                Method::Delete { query: () },
2207                202,
2208            )
2209            .await
2210    }
2211    /// Reset [stop-words](https://www.meilisearch.com/docs/reference/api/settings#stop-words) of the [Index].
2212    ///
2213    /// # Example
2214    ///
2215    /// ```
2216    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2217    /// #
2218    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2219    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2220    /// #
2221    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2222    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2223    /// # client.create_index("reset_stop_words", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2224    /// let mut index = client.index("reset_stop_words");
2225    ///
2226    /// let task = index.reset_stop_words().await.unwrap();
2227    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2228    /// # });
2229    /// ```
2230    pub async fn reset_stop_words(&self) -> Result<TaskInfo, Error> {
2231        self.client
2232            .http_client
2233            .request::<(), (), TaskInfo>(
2234                &format!(
2235                    "{}/indexes/{}/settings/stop-words",
2236                    self.client.host, self.uid
2237                ),
2238                Method::Delete { query: () },
2239                202,
2240            )
2241            .await
2242    }
2243
2244    /// Reset [ranking rules](https://www.meilisearch.com/docs/learn/core_concepts/relevancy#ranking-rules) of the [Index] to default value.
2245    ///
2246    /// **Default value: `["words", "typo", "proximity", "attribute", "sort", "exactness"]`.**
2247    ///
2248    /// # Example
2249    ///
2250    /// ```
2251    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2252    /// #
2253    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2254    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2255    /// #
2256    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2257    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2258    /// # client.create_index("reset_ranking_rules", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2259    /// let mut index = client.index("reset_ranking_rules");
2260    ///
2261    /// let task = index.reset_ranking_rules().await.unwrap();
2262    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2263    /// # });
2264    /// ```
2265    pub async fn reset_ranking_rules(&self) -> Result<TaskInfo, Error> {
2266        self.client
2267            .http_client
2268            .request::<(), (), TaskInfo>(
2269                &format!(
2270                    "{}/indexes/{}/settings/ranking-rules",
2271                    self.client.host, self.uid
2272                ),
2273                Method::Delete { query: () },
2274                202,
2275            )
2276            .await
2277    }
2278
2279    /// Reset [filterable attributes](https://www.meilisearch.com/docs/reference/api/settings#filterable-attributes) of the [Index].
2280    ///
2281    /// # Example
2282    ///
2283    /// ```
2284    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2285    /// #
2286    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2287    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2288    /// #
2289    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2290    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2291    /// # client.create_index("reset_filterable_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2292    /// let mut index = client.index("reset_filterable_attributes");
2293    ///
2294    /// let task = index.reset_filterable_attributes().await.unwrap();
2295    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2296    /// # });
2297    /// ```
2298    pub async fn reset_filterable_attributes(&self) -> Result<TaskInfo, Error> {
2299        self.client
2300            .http_client
2301            .request::<(), (), TaskInfo>(
2302                &format!(
2303                    "{}/indexes/{}/settings/filterable-attributes",
2304                    self.client.host, self.uid
2305                ),
2306                Method::Delete { query: () },
2307                202,
2308            )
2309            .await
2310    }
2311
2312    /// Reset [sortable attributes](https://www.meilisearch.com/docs/reference/api/settings#sortable-attributes) of the [Index].
2313    ///
2314    /// # Example
2315    ///
2316    /// ```
2317    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2318    /// #
2319    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2320    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2321    /// #
2322    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2323    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2324    /// # client.create_index("reset_sortable_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2325    /// let mut index = client.index("reset_sortable_attributes");
2326    ///
2327    /// let task = index.reset_sortable_attributes().await.unwrap();
2328    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2329    /// # });
2330    /// ```
2331    pub async fn reset_sortable_attributes(&self) -> Result<TaskInfo, Error> {
2332        self.client
2333            .http_client
2334            .request::<(), (), TaskInfo>(
2335                &format!(
2336                    "{}/indexes/{}/settings/sortable-attributes",
2337                    self.client.host, self.uid
2338                ),
2339                Method::Delete { query: () },
2340                202,
2341            )
2342            .await
2343    }
2344
2345    /// Reset the [distinct attribute](https://www.meilisearch.com/docs/reference/api/settings#distinct-attribute) of the [Index].
2346    ///
2347    /// # Example
2348    ///
2349    /// ```
2350    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2351    /// #
2352    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2353    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2354    /// #
2355    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2356    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2357    /// # client.create_index("reset_distinct_attribute", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2358    /// let mut index = client.index("reset_distinct_attribute");
2359    ///
2360    /// let task = index.reset_distinct_attribute().await.unwrap();
2361    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2362    /// # });
2363    /// ```
2364    pub async fn reset_distinct_attribute(&self) -> Result<TaskInfo, Error> {
2365        self.client
2366            .http_client
2367            .request::<(), (), TaskInfo>(
2368                &format!(
2369                    "{}/indexes/{}/settings/distinct-attribute",
2370                    self.client.host, self.uid
2371                ),
2372                Method::Delete { query: () },
2373                202,
2374            )
2375            .await
2376    }
2377
2378    /// Reset [searchable attributes](https://www.meilisearch.com/docs/reference/api/settings#searchable-attributes) of
2379    /// the [Index] (enable all attributes).
2380    ///
2381    /// # Example
2382    ///
2383    /// ```
2384    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2385    /// #
2386    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2387    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2388    /// #
2389    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2390    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2391    /// # client.create_index("reset_searchable_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2392    /// let mut index = client.index("reset_searchable_attributes");
2393    ///
2394    /// let task = index.reset_searchable_attributes().await.unwrap();
2395    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2396    /// # });
2397    /// ```
2398    pub async fn reset_searchable_attributes(&self) -> Result<TaskInfo, Error> {
2399        self.client
2400            .http_client
2401            .request::<(), (), TaskInfo>(
2402                &format!(
2403                    "{}/indexes/{}/settings/searchable-attributes",
2404                    self.client.host, self.uid
2405                ),
2406                Method::Delete { query: () },
2407                202,
2408            )
2409            .await
2410    }
2411
2412    /// Reset [displayed attributes](https://www.meilisearch.com/docs/reference/api/settings#displayed-attributes) of the [Index] (enable all attributes).
2413    ///
2414    /// # Example
2415    ///
2416    /// ```
2417    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2418    /// #
2419    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2420    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2421    /// #
2422    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2423    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2424    /// # client.create_index("reset_displayed_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2425    /// let mut index = client.index("reset_displayed_attributes");
2426    ///
2427    /// let task = index.reset_displayed_attributes().await.unwrap();
2428    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2429    /// # });
2430    /// ```
2431    pub async fn reset_displayed_attributes(&self) -> Result<TaskInfo, Error> {
2432        self.client
2433            .http_client
2434            .request::<(), (), TaskInfo>(
2435                &format!(
2436                    "{}/indexes/{}/settings/displayed-attributes",
2437                    self.client.host, self.uid
2438                ),
2439                Method::Delete { query: () },
2440                202,
2441            )
2442            .await
2443    }
2444
2445    /// Reset [faceting](https://www.meilisearch.com/docs/reference/api/settings#faceting) settings of the [Index].
2446    ///
2447    /// # Example
2448    ///
2449    /// ```
2450    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2451    /// #
2452    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2453    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2454    /// #
2455    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2456    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2457    /// # client.create_index("reset_faceting", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2458    /// let mut index = client.index("reset_faceting");
2459    ///
2460    /// let task = index.reset_faceting().await.unwrap();
2461    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2462    /// # });
2463    /// ```
2464    pub async fn reset_faceting(&self) -> Result<TaskInfo, Error> {
2465        self.client
2466            .http_client
2467            .request::<(), (), TaskInfo>(
2468                &format!(
2469                    "{}/indexes/{}/settings/faceting",
2470                    self.client.host, self.uid
2471                ),
2472                Method::Delete { query: () },
2473                202,
2474            )
2475            .await
2476    }
2477
2478    /// Reset [dictionary](https://www.meilisearch.com/docs/reference/api/settings#dictionary) of the [Index].
2479    ///
2480    /// # Example
2481    ///
2482    /// ```
2483    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2484    /// #
2485    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2486    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2487    /// #
2488    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2489    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2490    /// # client.create_index("reset_dictionary", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2491    /// let mut index = client.index("reset_dictionary");
2492    ///
2493    /// let task = index.reset_dictionary().await.unwrap();
2494    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2495    /// # });
2496    /// ```
2497    pub async fn reset_dictionary(&self) -> Result<TaskInfo, Error> {
2498        self.client
2499            .http_client
2500            .request::<(), (), TaskInfo>(
2501                &format!(
2502                    "{}/indexes/{}/settings/dictionary",
2503                    self.client.host, self.uid
2504                ),
2505                Method::Delete { query: () },
2506                202,
2507            )
2508            .await
2509    }
2510
2511    /// Reset [typo tolerance](https://www.meilisearch.com/docs/reference/api/settings#typo-tolerance) settings of the [Index].
2512    ///
2513    /// # Example
2514    ///
2515    /// ```
2516    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2517    /// #
2518    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2519    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2520    /// #
2521    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2522    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2523    /// # client.create_index("reset_typo_tolerance", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2524    /// let mut index = client.index("reset_typo_tolerance");
2525    ///
2526    /// let task = index.reset_typo_tolerance().await.unwrap();
2527    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2528    /// # });
2529    /// ```
2530    pub async fn reset_typo_tolerance(&self) -> Result<TaskInfo, Error> {
2531        self.client
2532            .http_client
2533            .request::<(), (), TaskInfo>(
2534                &format!(
2535                    "{}/indexes/{}/settings/typo-tolerance",
2536                    self.client.host, self.uid
2537                ),
2538                Method::Delete { query: () },
2539                202,
2540            )
2541            .await
2542    }
2543
2544    /// Reset [proximity precision](https://www.meilisearch.com/docs/reference/api/settings#proximity-precision) settings of the [Index].
2545    ///
2546    /// # Example
2547    ///
2548    /// ```
2549    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2550    /// #
2551    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2552    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2553    /// #
2554    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2555    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2556    /// # client.create_index("reset_proximity_precision", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2557    /// let mut index = client.index("reset_proximity_precision");
2558    ///
2559    /// let task = index.reset_proximity_precision().await.unwrap();
2560    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2561    /// # });
2562    /// ```
2563    pub async fn reset_proximity_precision(&self) -> Result<TaskInfo, Error> {
2564        self.client
2565            .http_client
2566            .request::<(), (), TaskInfo>(
2567                &format!(
2568                    "{}/indexes/{}/settings/proximity-precision",
2569                    self.client.host, self.uid
2570                ),
2571                Method::Delete { query: () },
2572                202,
2573            )
2574            .await
2575    }
2576
2577    /// Reset [embedders](https://www.meilisearch.com/docs/learn/vector_search) of the [Index].
2578    ///
2579    /// # Example
2580    ///
2581    /// ```
2582    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2583    /// #
2584    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2585    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2586    /// #
2587    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2588    /// # let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2589    /// # client.create_index("reset_embedders", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2590    /// let mut index = client.index("reset_embedders");
2591    ///
2592    /// let task = index.reset_embedders().await.unwrap();
2593    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2594    /// # });
2595    /// ```
2596    pub async fn reset_embedders(&self) -> Result<TaskInfo, Error> {
2597        self.client
2598            .http_client
2599            .request::<(), (), TaskInfo>(
2600                &format!(
2601                    "{}/indexes/{}/settings/embedders",
2602                    self.client.host, self.uid
2603                ),
2604                Method::Delete { query: () },
2605                202,
2606            )
2607            .await
2608    }
2609
2610    /// Reset [facet-search settings](https://www.meilisearch.com/docs/reference/api/settings#facet-search) settings of the [Index].
2611    ///
2612    /// # Example
2613    ///
2614    /// ```
2615    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2616    /// #
2617    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2618    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2619    /// #
2620    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2621    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2622    /// # client.create_index("reset_facet_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2623    /// let mut index = client.index("reset_facet_search");
2624    ///
2625    /// let task = index.reset_facet_search().await.unwrap();
2626    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2627    /// # });
2628    /// ```
2629    pub async fn reset_facet_search(&self) -> Result<TaskInfo, Error> {
2630        self.client
2631            .http_client
2632            .request::<(), (), TaskInfo>(
2633                &format!(
2634                    "{}/indexes/{}/settings/facet-search",
2635                    self.client.host, self.uid
2636                ),
2637                Method::Delete { query: () },
2638                202,
2639            )
2640            .await
2641    }
2642
2643    /// Reset [prefix-search settings](https://www.meilisearch.com/docs/reference/api/settings#prefix-search) settings of the [Index].
2644    ///
2645    /// # Example
2646    ///
2647    /// ```
2648    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2649    /// #
2650    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2651    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2652    /// #
2653    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2654    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2655    /// # client.create_index("reset_prefix_search", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2656    /// let mut index = client.index("reset_prefix_search");
2657    ///
2658    /// let task = index.reset_prefix_search().await.unwrap();
2659    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2660    /// # });
2661    /// ```
2662    pub async fn reset_prefix_search(&self) -> Result<TaskInfo, Error> {
2663        self.client
2664            .http_client
2665            .request::<(), (), TaskInfo>(
2666                &format!(
2667                    "{}/indexes/{}/settings/prefix-search",
2668                    self.client.host, self.uid
2669                ),
2670                Method::Delete { query: () },
2671                202,
2672            )
2673            .await
2674    }
2675
2676    /// Reset [search cutoff](https://www.meilisearch.com/docs/reference/api/settings#search-cutoff) settings of the [Index].
2677    ///
2678    /// # Example
2679    ///
2680    /// ```
2681    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2682    /// #
2683    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2684    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2685    /// #
2686    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2687    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2688    /// # client.create_index("reset_search_cutoff_ms", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2689    /// let mut index = client.index("reset_search_cutoff_ms");
2690    ///
2691    /// let task = index.reset_search_cutoff_ms().await.unwrap();
2692    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2693    /// # });
2694    /// ```
2695    pub async fn reset_search_cutoff_ms(&self) -> Result<TaskInfo, Error> {
2696        self.client
2697            .http_client
2698            .request::<(), (), TaskInfo>(
2699                &format!(
2700                    "{}/indexes/{}/settings/search-cutoff-ms",
2701                    self.client.host, self.uid
2702                ),
2703                Method::Delete { query: () },
2704                202,
2705            )
2706            .await
2707    }
2708
2709    /// Reset [search cutoff](https://www.meilisearch.com/docs/reference/api/settings#search-cutoff) settings of the [Index].
2710    ///
2711    /// # Example
2712    ///
2713    /// ```
2714    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2715    /// #
2716    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2717    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2718    /// #
2719    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2720    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2721    /// # client.create_index("reset_separator_tokens", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2722    /// let mut index = client.index("reset_separator_tokens");
2723    ///
2724    /// let task = index.reset_separator_tokens().await.unwrap();
2725    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2726    /// # });
2727    /// ```
2728    pub async fn reset_separator_tokens(&self) -> Result<TaskInfo, Error> {
2729        self.client
2730            .http_client
2731            .request::<(), (), TaskInfo>(
2732                &format!(
2733                    "{}/indexes/{}/settings/separator-tokens",
2734                    self.client.host, self.uid
2735                ),
2736                Method::Delete { query: () },
2737                202,
2738            )
2739            .await
2740    }
2741
2742    /// Reset [non separator tokens](https://www.meilisearch.com/docs/reference/api/settings#non-separator-tokens) settings of the [Index].
2743    ///
2744    /// # Example
2745    ///
2746    /// ```
2747    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2748    /// #
2749    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2750    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2751    /// #
2752    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2753    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2754    /// # client.create_index("reset_non_separator_tokens", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2755    /// let mut index = client.index("reset_non_separator_tokens");
2756    ///
2757    /// let task = index.reset_non_separator_tokens().await.unwrap();
2758    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2759    /// # });
2760    /// ```
2761    pub async fn reset_non_separator_tokens(&self) -> Result<TaskInfo, Error> {
2762        self.client
2763            .http_client
2764            .request::<(), (), TaskInfo>(
2765                &format!(
2766                    "{}/indexes/{}/settings/non-separator-tokens",
2767                    self.client.host, self.uid
2768                ),
2769                Method::Delete { query: () },
2770                202,
2771            )
2772            .await
2773    }
2774
2775    /// Reset [localized attributes](https://www.meilisearch.com/docs/reference/api/settings#localized-attributes-object) settings of the [Index].
2776    ///
2777    /// # Example
2778    ///
2779    /// ```
2780    /// # use meilisearch_sdk::{client::*, indexes::*, settings::Settings};
2781    /// #
2782    /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
2783    /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
2784    /// #
2785    /// # tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
2786    /// let client = Client::new(MEILISEARCH_URL, Some(MEILISEARCH_API_KEY)).unwrap();
2787    /// # client.create_index("reset_localized_attributes", None).await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2788    /// let index = client.index("reset_localized_attributes");
2789    ///
2790    /// let task = index.reset_localized_attributes().await.unwrap();
2791    /// # index.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
2792    /// # });
2793    /// ```
2794    pub async fn reset_localized_attributes(&self) -> Result<TaskInfo, Error> {
2795        self.client
2796            .http_client
2797            .request::<(), (), TaskInfo>(
2798                &format!(
2799                    "{}/indexes/{}/settings/localized-attributes",
2800                    self.client.host, self.uid
2801                ),
2802                Method::Delete { query: () },
2803                202,
2804            )
2805            .await
2806    }
2807}
2808
2809#[cfg(test)]
2810mod tests {
2811    use super::*;
2812
2813    use crate::client::*;
2814    use meilisearch_test_macro::meilisearch_test;
2815    use serde_json::json;
2816
2817    #[meilisearch_test]
2818    async fn test_set_faceting_settings(client: Client, index: Index) {
2819        let settings = Settings::new().with_max_values_per_facet(5);
2820
2821        let task_info = index.set_settings(&settings).await.unwrap();
2822        client.wait_for_task(task_info, None, None).await.unwrap();
2823
2824        let res = index.get_faceting().await.unwrap();
2825
2826        let mut expected_facet_sort_setting = BTreeMap::new();
2827        expected_facet_sort_setting.insert("*".to_string(), FacetSortValue::Alpha);
2828        let expected_faceting = FacetingSettings {
2829            max_values_per_facet: 5,
2830            sort_facet_values_by: Some(expected_facet_sort_setting),
2831        };
2832
2833        assert_eq!(expected_faceting, res);
2834    }
2835
2836    #[meilisearch_test]
2837    async fn test_set_faceting_settings_with_sort_values(client: Client, index: Index) {
2838        let mut req_facet_sort_setting = BTreeMap::new();
2839        req_facet_sort_setting.insert("genres".to_string(), FacetSortValue::Count);
2840        let req_faceting = FacetingSettings {
2841            max_values_per_facet: 5,
2842            sort_facet_values_by: Some(req_facet_sort_setting),
2843        };
2844        let settings = Settings::new().with_faceting(req_faceting.clone());
2845
2846        let task_info = index.set_settings(&settings).await.unwrap();
2847        client.wait_for_task(task_info, None, None).await.unwrap();
2848
2849        let res = index.get_faceting().await.unwrap();
2850
2851        let mut expected_facet_sort_setting = BTreeMap::new();
2852        expected_facet_sort_setting.insert("*".to_string(), FacetSortValue::Alpha);
2853        expected_facet_sort_setting.insert("genres".to_string(), FacetSortValue::Count);
2854        let expected_faceting = FacetingSettings {
2855            max_values_per_facet: req_faceting.max_values_per_facet,
2856            sort_facet_values_by: Some(expected_facet_sort_setting),
2857        };
2858
2859        assert_eq!(expected_faceting, res);
2860    }
2861
2862    #[meilisearch_test]
2863    async fn test_get_faceting(index: Index) {
2864        let req_faceting = FacetingSettings {
2865            max_values_per_facet: 100,
2866            sort_facet_values_by: None,
2867        };
2868
2869        let res = index.get_faceting().await.unwrap();
2870
2871        let mut expected_facet_sort_setting = BTreeMap::new();
2872        expected_facet_sort_setting.insert("*".to_string(), FacetSortValue::Alpha);
2873        let expected_faceting = FacetingSettings {
2874            max_values_per_facet: req_faceting.max_values_per_facet,
2875            sort_facet_values_by: Some(expected_facet_sort_setting),
2876        };
2877
2878        assert_eq!(expected_faceting, res);
2879    }
2880
2881    #[meilisearch_test]
2882    async fn test_get_embedders(index: Index) {
2883        let res = index.get_embedders().await.unwrap();
2884
2885        assert_eq!(HashMap::new(), res);
2886    }
2887
2888    #[meilisearch_test]
2889    async fn test_set_faceting(client: Client, index: Index) {
2890        let req_faceting = FacetingSettings {
2891            max_values_per_facet: 5,
2892            sort_facet_values_by: None,
2893        };
2894        let task_info = index.set_faceting(&req_faceting).await.unwrap();
2895        client.wait_for_task(task_info, None, None).await.unwrap();
2896
2897        let res = index.get_faceting().await.unwrap();
2898
2899        let mut expected_facet_sort_setting = BTreeMap::new();
2900        expected_facet_sort_setting.insert("*".to_string(), FacetSortValue::Alpha);
2901        let expected_faceting = FacetingSettings {
2902            max_values_per_facet: req_faceting.max_values_per_facet,
2903            sort_facet_values_by: Some(expected_facet_sort_setting),
2904        };
2905
2906        assert_eq!(expected_faceting, res);
2907    }
2908
2909    #[meilisearch_test]
2910    async fn test_set_faceting_with_sort_values(client: Client, index: Index) {
2911        let mut req_facet_sort_setting = BTreeMap::new();
2912        req_facet_sort_setting.insert("genres".to_string(), FacetSortValue::Count);
2913        let req_faceting = FacetingSettings {
2914            max_values_per_facet: 5,
2915            sort_facet_values_by: Some(req_facet_sort_setting),
2916        };
2917        let task_info = index.set_faceting(&req_faceting).await.unwrap();
2918        client.wait_for_task(task_info, None, None).await.unwrap();
2919
2920        let res = index.get_faceting().await.unwrap();
2921
2922        let mut expected_facet_sort_setting = BTreeMap::new();
2923        expected_facet_sort_setting.insert("*".to_string(), FacetSortValue::Alpha);
2924        expected_facet_sort_setting.insert("genres".to_string(), FacetSortValue::Count);
2925        let expected_faceting = FacetingSettings {
2926            max_values_per_facet: req_faceting.max_values_per_facet,
2927            sort_facet_values_by: Some(expected_facet_sort_setting),
2928        };
2929
2930        assert_eq!(expected_faceting, res);
2931    }
2932
2933    #[meilisearch_test]
2934    async fn test_reset_faceting(client: Client, index: Index) {
2935        let task_info = index.reset_faceting().await.unwrap();
2936        client.wait_for_task(task_info, None, None).await.unwrap();
2937        let req_faceting = FacetingSettings {
2938            max_values_per_facet: 100,
2939            sort_facet_values_by: None,
2940        };
2941
2942        let res = index.get_faceting().await.unwrap();
2943
2944        let mut expected_facet_sort_setting = BTreeMap::new();
2945        expected_facet_sort_setting.insert("*".to_string(), FacetSortValue::Alpha);
2946        let expected_faceting = FacetingSettings {
2947            max_values_per_facet: req_faceting.max_values_per_facet,
2948            sort_facet_values_by: Some(expected_facet_sort_setting),
2949        };
2950
2951        assert_eq!(expected_faceting, res);
2952    }
2953
2954    #[meilisearch_test]
2955    async fn test_reset_embedders(client: Client, index: Index) {
2956        let task_info = index.reset_embedders().await.unwrap();
2957        client.wait_for_task(task_info, None, None).await.unwrap();
2958
2959        let res = index.get_embedders().await.unwrap();
2960
2961        assert_eq!(HashMap::new(), res);
2962    }
2963
2964    #[meilisearch_test]
2965    async fn test_get_dictionary(index: Index) {
2966        let dictionary: Vec<String> = vec![];
2967
2968        let res = index.get_dictionary().await.unwrap();
2969
2970        assert_eq!(dictionary, res);
2971    }
2972
2973    #[meilisearch_test]
2974    async fn test_set_dictionary(client: Client, index: Index) {
2975        let dictionary: Vec<&str> = vec!["J. K.", "J. R. R."];
2976        let task_info = index.set_dictionary(&dictionary).await.unwrap();
2977        client.wait_for_task(task_info, None, None).await.unwrap();
2978
2979        let res = index.get_dictionary().await.unwrap();
2980
2981        assert_eq!(dictionary, res);
2982    }
2983
2984    #[meilisearch_test]
2985    async fn test_set_empty_dictionary(client: Client, index: Index) {
2986        let dictionary: Vec<&str> = vec![];
2987        let task_info = index.set_dictionary(&dictionary).await.unwrap();
2988        client.wait_for_task(task_info, None, None).await.unwrap();
2989
2990        let res = index.get_dictionary().await.unwrap();
2991
2992        assert_eq!(dictionary, res);
2993    }
2994
2995    #[meilisearch_test]
2996    async fn test_reset_dictionary(client: Client, index: Index) {
2997        let dictionary: Vec<&str> = vec![];
2998        let task_info = index.reset_dictionary().await.unwrap();
2999        client.wait_for_task(task_info, None, None).await.unwrap();
3000
3001        let res = index.get_dictionary().await.unwrap();
3002
3003        assert_eq!(dictionary, res);
3004    }
3005
3006    #[meilisearch_test]
3007    async fn test_get_pagination(index: Index) {
3008        let pagination = PaginationSetting {
3009            max_total_hits: 1000,
3010        };
3011
3012        let res = index.get_pagination().await.unwrap();
3013
3014        assert_eq!(pagination, res);
3015    }
3016
3017    #[meilisearch_test]
3018    async fn test_set_pagination(index: Index) {
3019        let pagination = PaginationSetting { max_total_hits: 11 };
3020        let task = index.set_pagination(pagination).await.unwrap();
3021        index.wait_for_task(task, None, None).await.unwrap();
3022
3023        let res = index.get_pagination().await.unwrap();
3024
3025        assert_eq!(pagination, res);
3026    }
3027
3028    #[meilisearch_test]
3029    async fn test_reset_pagination(index: Index) {
3030        let pagination = PaginationSetting { max_total_hits: 10 };
3031        let default = PaginationSetting {
3032            max_total_hits: 1000,
3033        };
3034
3035        let task = index.set_pagination(pagination).await.unwrap();
3036        index.wait_for_task(task, None, None).await.unwrap();
3037
3038        let reset_task = index.reset_pagination().await.unwrap();
3039        index.wait_for_task(reset_task, None, None).await.unwrap();
3040
3041        let res = index.get_pagination().await.unwrap();
3042
3043        assert_eq!(default, res);
3044    }
3045
3046    #[meilisearch_test]
3047    async fn test_get_typo_tolerance(index: Index) {
3048        let expected = TypoToleranceSettings {
3049            enabled: Some(true),
3050            disable_on_attributes: Some(vec![]),
3051            disable_on_words: Some(vec![]),
3052            min_word_size_for_typos: Some(MinWordSizeForTypos {
3053                one_typo: Some(5),
3054                two_typos: Some(9),
3055            }),
3056        };
3057
3058        let res = index.get_typo_tolerance().await.unwrap();
3059
3060        assert_eq!(expected, res);
3061    }
3062
3063    #[meilisearch_test]
3064    async fn test_set_typo_tolerance(client: Client, index: Index) {
3065        let expected = TypoToleranceSettings {
3066            enabled: Some(true),
3067            disable_on_attributes: Some(vec!["title".to_string()]),
3068            disable_on_words: Some(vec![]),
3069            min_word_size_for_typos: Some(MinWordSizeForTypos {
3070                one_typo: Some(5),
3071                two_typos: Some(9),
3072            }),
3073        };
3074
3075        let typo_tolerance = TypoToleranceSettings {
3076            disable_on_attributes: Some(vec!["title".to_string()]),
3077            ..Default::default()
3078        };
3079
3080        let task_info = index.set_typo_tolerance(&typo_tolerance).await.unwrap();
3081        client.wait_for_task(task_info, None, None).await.unwrap();
3082
3083        let res = index.get_typo_tolerance().await.unwrap();
3084
3085        assert_eq!(expected, res);
3086    }
3087
3088    #[meilisearch_test]
3089    async fn test_reset_typo_tolerance(index: Index) {
3090        let expected = TypoToleranceSettings {
3091            enabled: Some(true),
3092            disable_on_attributes: Some(vec![]),
3093            disable_on_words: Some(vec![]),
3094            min_word_size_for_typos: Some(MinWordSizeForTypos {
3095                one_typo: Some(5),
3096                two_typos: Some(9),
3097            }),
3098        };
3099
3100        let typo_tolerance = TypoToleranceSettings {
3101            disable_on_attributes: Some(vec!["title".to_string()]),
3102            ..Default::default()
3103        };
3104
3105        let task = index.set_typo_tolerance(&typo_tolerance).await.unwrap();
3106        index.wait_for_task(task, None, None).await.unwrap();
3107
3108        let reset_task = index.reset_typo_tolerance().await.unwrap();
3109        index.wait_for_task(reset_task, None, None).await.unwrap();
3110
3111        let default = index.get_typo_tolerance().await.unwrap();
3112
3113        assert_eq!(expected, default);
3114    }
3115
3116    #[meilisearch_test]
3117    async fn test_get_proximity_precision(index: Index) {
3118        let expected = "byWord".to_string();
3119
3120        let res = index.get_proximity_precision().await.unwrap();
3121
3122        assert_eq!(expected, res);
3123    }
3124
3125    #[meilisearch_test]
3126    async fn test_set_proximity_precision(client: Client, index: Index) {
3127        let expected = "byAttribute".to_string();
3128
3129        let task_info = index
3130            .set_proximity_precision("byAttribute".to_string())
3131            .await
3132            .unwrap();
3133        client.wait_for_task(task_info, None, None).await.unwrap();
3134
3135        let res = index.get_proximity_precision().await.unwrap();
3136
3137        assert_eq!(expected, res);
3138    }
3139
3140    #[meilisearch_test]
3141    async fn test_set_embedder_settings(client: Client, index: Index) {
3142        let custom_embedder = Embedder {
3143            source: EmbedderSource::UserProvided,
3144            dimensions: Some(2),
3145            ..Default::default()
3146        };
3147        let embedders = HashMap::from([("default".into(), custom_embedder)]);
3148
3149        let task_info = index.set_embedders(&embedders).await.unwrap();
3150        client.wait_for_task(task_info, None, None).await.unwrap();
3151
3152        let res = index.get_embedders().await.unwrap();
3153
3154        assert_eq!(embedders, res);
3155    }
3156
3157    #[test]
3158    fn embedder_with_fragments_serializes() {
3159        let embedder = Embedder {
3160            source: EmbedderSource::Rest,
3161            url: Some(String::from("https://example.com/embeddings")),
3162            indexing_fragments: Some(HashMap::from([(
3163                String::from("default"),
3164                EmbedderFragment {
3165                    value: json!({
3166                        "content": [
3167                            { "type": "text", "text": "{{ doc.description }}" }
3168                        ]
3169                    }),
3170                },
3171            )])),
3172            search_fragments: Some(HashMap::from([(
3173                String::from("default"),
3174                EmbedderFragment {
3175                    value: json!({
3176                        "content": [
3177                            { "type": "text", "text": "{{ query.q }}" }
3178                        ]
3179                    }),
3180                },
3181            )])),
3182            request: Some(json!({
3183                "input": [
3184                    "{{fragment}}",
3185                    "{{..}}"
3186                ],
3187                "model": "example-model"
3188            })),
3189            response: Some(json!({
3190                "data": [
3191                    {
3192                        "embedding": "{{embedding}}"
3193                    },
3194                    "{{..}}"
3195                ]
3196            })),
3197            ..Default::default()
3198        };
3199
3200        let serialized = serde_json::to_value(&embedder).unwrap();
3201
3202        assert_eq!(
3203            serialized
3204                .get("indexingFragments")
3205                .and_then(|value| value.get("default"))
3206                .and_then(|value| value.get("value"))
3207                .and_then(|value| value.get("content"))
3208                .and_then(|value| value.get(0))
3209                .and_then(|value| value.get("text")),
3210            Some(&json!("{{ doc.description }}"))
3211        );
3212
3213        assert_eq!(
3214            serialized
3215                .get("searchFragments")
3216                .and_then(|value| value.get("default"))
3217                .and_then(|value| value.get("value"))
3218                .and_then(|value| value.get("content"))
3219                .and_then(|value| value.get(0))
3220                .and_then(|value| value.get("text")),
3221            Some(&json!("{{ query.q }}"))
3222        );
3223
3224        assert_eq!(
3225            serialized.get("request"),
3226            Some(&json!({
3227                "input": ["{{fragment}}", "{{..}}"],
3228                "model": "example-model"
3229            }))
3230        );
3231
3232        assert_eq!(
3233            serialized.get("response"),
3234            Some(&json!({
3235                "data": [
3236                    { "embedding": "{{embedding}}" },
3237                    "{{..}}"
3238                ]
3239            }))
3240        );
3241    }
3242
3243    #[meilisearch_test]
3244    async fn test_reset_proximity_precision(index: Index) {
3245        let expected = "byWord".to_string();
3246
3247        let task = index
3248            .set_proximity_precision("byAttribute".to_string())
3249            .await
3250            .unwrap();
3251        index.wait_for_task(task, None, None).await.unwrap();
3252
3253        let reset_task = index.reset_proximity_precision().await.unwrap();
3254        index.wait_for_task(reset_task, None, None).await.unwrap();
3255
3256        let default = index.get_proximity_precision().await.unwrap();
3257
3258        assert_eq!(expected, default);
3259    }
3260
3261    #[meilisearch_test]
3262    async fn test_get_facet_search(index: Index) {
3263        let expected = true;
3264
3265        let res = index.get_facet_search().await.unwrap();
3266
3267        assert_eq!(expected, res);
3268    }
3269
3270    #[meilisearch_test]
3271    async fn test_set_facet_search(client: Client, index: Index) {
3272        let expected = false;
3273
3274        let task_info = index.set_facet_search(false).await.unwrap();
3275        client.wait_for_task(task_info, None, None).await.unwrap();
3276
3277        let res = index.get_facet_search().await.unwrap();
3278
3279        assert_eq!(expected, res);
3280    }
3281
3282    #[meilisearch_test]
3283    async fn test_reset_facet_search(index: Index) {
3284        let expected = true;
3285
3286        let task = index.set_facet_search(false).await.unwrap();
3287        index.wait_for_task(task, None, None).await.unwrap();
3288
3289        let reset_task = index.reset_facet_search().await.unwrap();
3290        index.wait_for_task(reset_task, None, None).await.unwrap();
3291
3292        let default = index.get_facet_search().await.unwrap();
3293
3294        assert_eq!(expected, default);
3295    }
3296
3297    #[meilisearch_test]
3298    async fn test_get_prefix_search(index: Index) {
3299        let expected = PrefixSearchSettings::IndexingTime;
3300
3301        let res = index.get_prefix_search().await.unwrap();
3302
3303        assert_eq!(expected, res);
3304    }
3305
3306    #[meilisearch_test]
3307    async fn test_set_prefix_search(client: Client, index: Index) {
3308        let expected = PrefixSearchSettings::Disabled;
3309
3310        let task_info = index
3311            .set_prefix_search(PrefixSearchSettings::Disabled)
3312            .await
3313            .unwrap();
3314        client.wait_for_task(task_info, None, None).await.unwrap();
3315
3316        let res = index.get_prefix_search().await.unwrap();
3317
3318        assert_eq!(expected, res);
3319    }
3320
3321    #[meilisearch_test]
3322    async fn test_reset_prefix_search(index: Index) {
3323        let expected = PrefixSearchSettings::IndexingTime;
3324
3325        let task = index
3326            .set_prefix_search(PrefixSearchSettings::Disabled)
3327            .await
3328            .unwrap();
3329        index.wait_for_task(task, None, None).await.unwrap();
3330
3331        let reset_task = index.reset_prefix_search().await.unwrap();
3332        index.wait_for_task(reset_task, None, None).await.unwrap();
3333
3334        let default = index.get_prefix_search().await.unwrap();
3335
3336        assert_eq!(expected, default);
3337    }
3338
3339    #[meilisearch_test]
3340    async fn test_get_search_cutoff_ms(index: Index) {
3341        let expected = None;
3342
3343        let res = index.get_search_cutoff_ms().await.unwrap();
3344
3345        assert_eq!(expected, res);
3346    }
3347
3348    #[meilisearch_test]
3349    async fn test_set_search_cutoff_ms(client: Client, index: Index) {
3350        let expected = Some(150);
3351
3352        let task_info = index.set_search_cutoff_ms(Some(150)).await.unwrap();
3353        client.wait_for_task(task_info, None, None).await.unwrap();
3354
3355        let res = index.get_search_cutoff_ms().await.unwrap();
3356
3357        assert_eq!(expected, res);
3358    }
3359
3360    #[meilisearch_test]
3361    async fn test_get_separator_tokens(index: Index) {
3362        let separator: Vec<&str> = vec![];
3363        let res = index.get_separator_tokens().await.unwrap();
3364
3365        assert_eq!(separator, res);
3366    }
3367
3368    #[meilisearch_test]
3369    async fn test_set_separator_tokens(client: Client, index: Index) {
3370        let expected: Vec<String> = vec!["#".to_string(), "@".to_string()];
3371
3372        let task_info = index.set_separator_tokens(&expected).await.unwrap();
3373        client.wait_for_task(task_info, None, None).await.unwrap();
3374
3375        let res = index.get_separator_tokens().await.unwrap();
3376
3377        assert_eq!(expected, res);
3378    }
3379
3380    #[meilisearch_test]
3381    async fn test_reset_search_cutoff_ms(index: Index) {
3382        let expected = None;
3383
3384        let task = index.set_search_cutoff_ms(Some(150)).await.unwrap();
3385        index.wait_for_task(task, None, None).await.unwrap();
3386
3387        let reset_task = index.reset_search_cutoff_ms().await.unwrap();
3388        index.wait_for_task(reset_task, None, None).await.unwrap();
3389
3390        let default = index.get_search_cutoff_ms().await.unwrap();
3391
3392        assert_eq!(expected, default);
3393    }
3394
3395    #[meilisearch_test]
3396    async fn test_reset_separator_tokens(client: Client, index: Index) {
3397        let separator: Vec<&str> = vec![];
3398        let task_info = index.reset_separator_tokens().await.unwrap();
3399        client.wait_for_task(task_info, None, None).await.unwrap();
3400
3401        let res = index.get_dictionary().await.unwrap();
3402        assert_eq!(separator, res);
3403    }
3404
3405    #[meilisearch_test]
3406    async fn test_get_non_separator_tokens(index: Index) {
3407        let separator: Vec<&str> = vec![];
3408        let res = index.get_non_separator_tokens().await.unwrap();
3409
3410        assert_eq!(separator, res);
3411    }
3412
3413    #[meilisearch_test]
3414    async fn test_set_non_separator_tokens(client: Client, index: Index) {
3415        let expected: Vec<String> = vec!["#".to_string(), "@".to_string()];
3416
3417        let task_info = index.set_non_separator_tokens(&expected).await.unwrap();
3418        client.wait_for_task(task_info, None, None).await.unwrap();
3419
3420        let res = index.get_non_separator_tokens().await.unwrap();
3421
3422        assert_eq!(expected, res);
3423    }
3424
3425    #[meilisearch_test]
3426    async fn test_reset_non_separator_tokens(client: Client, index: Index) {
3427        let separator: Vec<&str> = vec![];
3428        let task_info = index.reset_non_separator_tokens().await.unwrap();
3429        client.wait_for_task(task_info, None, None).await.unwrap();
3430
3431        let res = index.get_dictionary().await.unwrap();
3432        assert_eq!(separator, res);
3433    }
3434
3435    #[meilisearch_test]
3436    async fn test_get_localized_attributes(index: Index) {
3437        let res = index.get_localized_attributes().await.unwrap();
3438        assert_eq!(None, res);
3439    }
3440
3441    #[meilisearch_test]
3442    async fn test_set_localized_attributes(client: Client, index: Index) {
3443        let localized_attributes = vec![LocalizedAttributes {
3444            locales: vec!["jpn".to_string()],
3445            attribute_patterns: vec!["*_ja".to_string()],
3446        }];
3447        let task_info = index
3448            .set_localized_attributes(&localized_attributes)
3449            .await
3450            .unwrap();
3451        client.wait_for_task(task_info, None, None).await.unwrap();
3452
3453        let res = index.get_localized_attributes().await.unwrap();
3454        assert_eq!(Some(localized_attributes), res);
3455    }
3456
3457    #[meilisearch_test]
3458    async fn test_reset_localized_attributes(client: Client, index: Index) {
3459        let localized_attributes = vec![LocalizedAttributes {
3460            locales: vec!["jpn".to_string()],
3461            attribute_patterns: vec!["*_ja".to_string()],
3462        }];
3463        let task_info = index
3464            .set_localized_attributes(&localized_attributes)
3465            .await
3466            .unwrap();
3467        client.wait_for_task(task_info, None, None).await.unwrap();
3468
3469        let reset_task = index.reset_localized_attributes().await.unwrap();
3470        client.wait_for_task(reset_task, None, None).await.unwrap();
3471
3472        let res = index.get_localized_attributes().await.unwrap();
3473        assert_eq!(None, res);
3474    }
3475}