All Settings

It is possible to update all the settings in one go or individually with the dedicated routes. Updates in the settings route are partial. This means that any parameters not provided in the body will be left unchanged.

These are the reference pages for the dedicated routes:

Learn more about the settings in this guide

NOTE

Updating the settings means overwriting the default settings of MeiliSearch. You can reset to default values using the DELETE routes.

GET

.

Path Variables

VariableTypeDescriptionDefault value
synonymsObjectList of associated words treated similarly{}
stopWords[Strings]List of words ignored by MeiliSearch when present in search queries[]
rankingRules[Strings]List of ranking rules sorted by order of importance
attributesForFaceting[Strings]Attributes to use as facets[]
distinctAttributeStringSearch returns documents with distinct (different) values of the given fieldnull
searchableAttributes[Strings]Fields in which to search for matching query words sorted by order of importance[““] (all attributes)
displayedAttributes[Strings]Fields displayed in the returned documents[““] (all attributes)

  1. $ curl \
  2. -X GET 'http://localhost:7700/indexes/movies/settings'
  1. client.index('movies').getSettings()
  1. client.index('movies').get_settings()
  1. $client->index('movies')->getSettings();
  1. index.settings
  1. client.Settings("movies").GetAll()
  1. let settings: Settings = movies.get_settings().await.unwrap();

Response: 200 Ok

List the settings.

  1. {
  2. "rankingRules": [
  3. "typo",
  4. "words",
  5. "proximity",
  6. "attribute",
  7. "wordsPosition",
  8. "exactness",
  9. "desc(release_date)"
  10. ],
  11. "attributesForFaceting": ["genres"],
  12. "distinctAttribute": null,
  13. "searchableAttributes": ["title", "description", "genre"],
  14. "displayedAttributes": [
  15. "title",
  16. "description",
  17. "genre",
  18. "release_date"
  19. ],
  20. "stopWords": null,
  21. "synonyms": {
  22. "wolverine": ["xmen", "logan"],
  23. "logan": ["wolverine", "xmen"]
  24. }
  25. }

POST

Update the settings of an index.

Updates in the settings route are partial. This means that any parameters not provided in the body will be left unchanged.
.

Path Variables

Body

VariableTypeDescriptionDefault value
synonymsObjectList of associated words treated similarly{}
stopWords[Strings]List of words ignored by MeiliSearch when present in search queries[]
rankingRules[Strings]List of ranking rules sorted by order of importanceA list of ordered built-in ranking rules
attributesForFaceting[Strings]Attributes to use as []
distinctAttributeStringSearch returns documents with distinct (different) values of the given fieldnull
searchableAttributes[Strings]Fields in which to search for matching query words sorted by order of importance[““] (all attributes)
displayedAttributes[Strings]Fields displayed in the returned documents[““] (all attributes)
  1. $ curl \
  2. -X POST 'http://localhost:7700/indexes/movies/settings' \
  3. --data '{
  4. "rankingRules": [
  5. "typo",
  6. "words",
  7. "proximity",
  8. "attribute",
  9. "wordsPosition",
  10. "exactness",
  11. "desc(release_date)",
  12. "desc(rank)"
  13. ],
  14. "distinctAttribute": "movie_id",
  15. "searchableAttributes": [
  16. "title",
  17. "description",
  18. "genre"
  19. ],
  20. "displayedAttributes": [
  21. "title",
  22. "description",
  23. "genre",
  24. "release_date"
  25. ],
  26. "stopWords": [
  27. "the",
  28. "a",
  29. "an"
  30. ],
  31. "synonyms": {
  32. "wolverine": ["xmen", "logan"],
  33. "logan": ["wolverine"]
  34. }
  35. }'
  1. client.index('movies').updateSettings({
  2. rankingRules: [
  3. 'typo',
  4. 'words',
  5. 'proximity',
  6. 'attribute',
  7. 'wordsPosition',
  8. 'exactness',
  9. 'desc(release_date)',
  10. 'desc(rank)'
  11. ],
  12. distinctAttribute: 'movie_id',
  13. 'title',
  14. 'description',
  15. 'genre'
  16. ],
  17. displayedAttributes: [
  18. 'description',
  19. 'genre',
  20. 'release_date'
  21. ],
  22. stopWords: [
  23. 'the',
  24. 'a',
  25. 'an'
  26. ],
  27. synonyms: {
  28. 'wolverine': ['xmen', 'logan'],
  29. 'logan': ['wolverine']
  30. }
  31. })
  1. client.index('movies').update_settings({
  2. 'rankingRules': [
  3. 'typo',
  4. 'words',
  5. 'proximity',
  6. 'attribute',
  7. 'wordsPosition',
  8. 'exactness',
  9. 'desc(release_date)',
  10. 'desc(rank)'
  11. ],
  12. 'distinctAttribute': 'movie_id',
  13. 'searchableAttributes': [
  14. 'title',
  15. 'description',
  16. 'genre'
  17. ],
  18. 'displayedAttributes': [
  19. 'title',
  20. 'description',
  21. 'genre',
  22. 'release_date'
  23. ],
  24. 'stopWords': [
  25. 'the',
  26. 'a',
  27. 'an'
  28. ],
  29. 'synonyms': {
  30. 'wolverine': ['xmen', 'logan'],
  31. 'logan': ['wolverine']
  32. },
  33. 'acceptNewFields': False
  34. })
  1. $client->index('movies')->updateSettings([
  2. 'rankingRules' => [
  3. 'typo',
  4. 'words',
  5. 'proximity',
  6. 'attribute',
  7. 'wordsPosition',
  8. 'exactness',
  9. 'desc(release_date)',
  10. 'desc(rank)'
  11. ],
  12. 'distinctAttribute' => 'movie_id',
  13. 'searchableAttributes' => [
  14. 'title',
  15. 'description',
  16. 'genre'
  17. ],
  18. 'displayedAttributes' => [
  19. 'title',
  20. 'description',
  21. 'genre',
  22. 'release_date'
  23. ],
  24. 'stopWords' => [
  25. 'the',
  26. 'a',
  27. 'an'
  28. ],
  29. 'synonyms' => [
  30. 'wolverine': ['xmen', 'logan'],
  31. 'logan': ['wolverine']
  32. ]
  33. ]);
  1. index.update_settings({
  2. rankingRules: [
  3. 'typo',
  4. 'words',
  5. 'proximity',
  6. 'attribute',
  7. 'wordsPosition',
  8. 'exactness',
  9. 'desc(release_date)',
  10. 'desc(rank)'
  11. ],
  12. distinctAttribute: 'movie_id',
  13. searchableAttributes: [
  14. 'title',
  15. 'genre'
  16. ],
  17. displayedAttributes: [
  18. 'title',
  19. 'description',
  20. 'genre',
  21. 'release_date'
  22. stopWords: [
  23. 'the',
  24. 'a',
  25. 'an'
  26. ],
  27. synonyms: {
  28. wolverine: ['xmen', 'logan'],
  29. logan: ['wolverine']
  30. }
  31. })
  1. distinctAttribute := "movie_id"
  2. settings := meilisearch.Settings{
  3. RankingRules: []string{
  4. "typo",
  5. "words",
  6. "proximity",
  7. "attribute",
  8. "wordsPosition",
  9. "exactness",
  10. "desc(release_date)",
  11. "desc(rank)",
  12. },
  13. DistinctAttribute: &distinctAttribute,
  14. SearchableAttributes: []string{
  15. "title",
  16. "description",
  17. "genre",
  18. },
  19. DisplayedAttributes: []string{
  20. "title",
  21. "description",
  22. "genre",
  23. "release_date",
  24. },
  25. StopWords: []string{
  26. "the",
  27. "a",
  28. "an",
  29. },
  30. Synonyms: map[string][]string{
  31. "wolverine": []string{"xmen", "logan"},
  32. "logan": []string{"wolverine"},
  33. },
  34. }
  35. client.Settings("movies").UpdateAll(settings)
  1. let mut synonyms = std::collections::HashMap::new();
  2. synonyms.insert(String::from("wolverine"), vec![String::from("xmen"), String::from("logan")]);
  3. synonyms.insert(String::from("logan"), vec![String::from("wolverine")]);
  4. let settings = Settings::new()
  5. .with_ranking_rules(vec![
  6. "typo".to_string(),
  7. "words".to_string(),
  8. "proximity".to_string(),
  9. "attribute".to_string(),
  10. "wordsPosition".to_string(),
  11. "exactness".to_string(),
  12. "desc(release_date)".to_string(),
  13. "desc(rank)".to_string()
  14. ])
  15. .with_distinct_attribute("movie_id".to_string())
  16. .with_searchable_attributes(vec![
  17. "title".to_string(),
  18. "description".to_string(),
  19. "genre".to_string()
  20. ])
  21. .with_displayed_attributes(vec![
  22. "title".to_string(),
  23. "description".to_string(),
  24. "genre".to_string(),
  25. "release_date".to_string()
  26. ])
  27. .with_stop_words(vec![
  28. "the".to_string(),
  29. "a".to_string(),
  30. "an".to_string()
  31. ])
  32. .with_synonyms(synonyms);
  33. let progress: Progress = movies.set_settings(&settings).await.unwrap();

Response: 202 Accepted

  1. {
  2. "updateId": 1
  3. }

This updateId allows you to .

DELETE

Reset the settings of an index.

All settings will be reset to their default value.

Learn more about the settings.

Path Variables

VariableDescription
index_uidThe index UID

Example

  1. $ curl \
  2. -X DELETE 'http://localhost:7700/indexes/movies/settings'
  1. client.index('movies').resetSettings()
  1. client.index('movies').reset_settings()
  1. $client->index('movies')->resetSettings();
  1. index.reset_settings
  1. client.Settings("movies").ResetAll()
  1. let progress: Progress = movies.reset_settings().await.unwrap();

Response: 202 Accepted

  1. {
  2. "updateId": 1

This allows you to track the current update.