All settings

Index settings are represented as a JSON object literalAll Settings - 图1 (opens new window), containing a field for each possible customization option.

It is possible to modify all the settings at once using the update settings endpoint, or individually using the dedicated routes.

These are the reference pages for the dedicated routes:

Learn more about the settings in this guide.

NOTE

When you update a setting, you overwrite its default value. Use the DELETE route to reset any setting to its original value.

Get settings

GET

  1. /indexes/:index_uid/settings

Get the settings of an index.

Learn more about the settings.

Path variables

VariableDescription
index_uidThe index UID

Response 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
filterableAttributes[Strings]Attributes to use as filters and 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)

Learn more about the settings in this guide.

Example

cURL

JavaScript

Python

PHP

Ruby

Go

Rust

  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. client.index('movies').settings
  1. client.Index("movies").GetSettings()
  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. "filterableAttributes": ["genres"],
  12. "distinctAttribute": null,
  13. "searchableAttributes": ["title", "description", "genres"],
  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. }

Update settings

POST

  1. /indexes/:index_uid/settings

Update the settings of an index.

Passing null to an index setting will reset it to its default value.

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

If the provided index does not exist, it will be created.

Learn more about the settings in this guide.

Path variables

VariableDescription
index_uidThe index UID

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
filterableAttributes[Strings]Attributes to use as filters and 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)

Example

cURL

JavaScript

Python

PHP

Ruby

Go

Rust

  1. curl \
  2. -X POST 'http://localhost:7700/indexes/movies/settings' \
  3. --data '{
  4. "rankingRules": [
  5. "words",
  6. "typo",
  7. "proximity",
  8. "attribute",
  9. "exactness",
  10. "desc(release_date)",
  11. "desc(rank)"
  12. ],
  13. "distinctAttribute": "movie_id",
  14. "searchableAttributes": [
  15. "title",
  16. "description",
  17. "genre"
  18. ],
  19. "displayedAttributes": [
  20. "title",
  21. "description",
  22. "genre",
  23. "release_date"
  24. ],
  25. "stopWords": [
  26. "the",
  27. "a",
  28. "an"
  29. ],
  30. "synonyms": {
  31. "wolverine": ["xmen", "logan"],
  32. "logan": ["wolverine"]
  33. }
  34. }'
  1. client.index('movies').updateSettings({
  2. rankingRules: [
  3. 'words',
  4. 'typo',
  5. 'proximity',
  6. 'attribute',
  7. 'exactness',
  8. 'desc(release_date)',
  9. 'desc(rank)'
  10. ],
  11. distinctAttribute: 'movie_id',
  12. searchableAttributes: [
  13. 'title',
  14. 'description',
  15. 'genre'
  16. ],
  17. displayedAttributes: [
  18. 'title',
  19. 'description',
  20. 'genre',
  21. 'release_date'
  22. ],
  23. stopWords: [
  24. 'the',
  25. 'a',
  26. 'an'
  27. ],
  28. synonyms: {
  29. 'wolverine': ['xmen', 'logan'],
  30. 'logan': ['wolverine']
  31. }
  32. })
  1. client.index('movies').update_settings({
  2. 'rankingRules': [
  3. 'words',
  4. 'typo',
  5. 'proximity',
  6. 'attribute',
  7. 'exactness',
  8. 'desc(release_date)',
  9. 'desc(rank)'
  10. ],
  11. 'distinctAttribute': 'movie_id',
  12. 'searchableAttributes': [
  13. 'title',
  14. 'description',
  15. 'genre'
  16. ],
  17. 'displayedAttributes': [
  18. 'title',
  19. 'description',
  20. 'genre',
  21. 'release_date'
  22. ],
  23. 'stopWords': [
  24. 'the',
  25. 'a',
  26. 'an'
  27. ],
  28. 'synonyms': {
  29. 'wolverine': ['xmen', 'logan'],
  30. 'logan': ['wolverine']
  31. },
  32. 'acceptNewFields': False
  33. })
  1. $client->index('movies')->updateSettings([
  2. 'rankingRules' => [
  3. 'words',
  4. 'typo',
  5. 'proximity',
  6. 'attribute',
  7. 'exactness',
  8. 'desc(release_date)',
  9. 'desc(rank)'
  10. ],
  11. 'distinctAttribute' => 'movie_id',
  12. 'searchableAttributes' => [
  13. 'title',
  14. 'description',
  15. 'genre'
  16. ],
  17. 'displayedAttributes' => [
  18. 'title',
  19. 'description',
  20. 'genre',
  21. 'release_date'
  22. ],
  23. 'stopWords' => [
  24. 'the',
  25. 'a',
  26. 'an'
  27. ],
  28. 'synonyms' => [
  29. 'wolverine' => ['xmen', 'logan'],
  30. 'logan' => ['wolverine']
  31. ]
  32. ]);
  1. client.index('movies').update_settings({
  2. rankingRules: [
  3. 'words',
  4. 'typo',
  5. 'proximity',
  6. 'attribute',
  7. 'exactness',
  8. 'desc(release_date)',
  9. 'desc(rank)'
  10. ],
  11. distinctAttribute: 'movie_id',
  12. searchableAttributes: [
  13. 'title',
  14. 'description',
  15. 'genre'
  16. ],
  17. displayedAttributes: [
  18. 'title',
  19. 'description',
  20. 'genre',
  21. 'release_date'
  22. ],
  23. stopWords: [
  24. 'the',
  25. 'a',
  26. 'an'
  27. ],
  28. synonyms: {
  29. wolverine: ['xmen', 'logan'],
  30. logan: ['wolverine']
  31. }
  32. })
  1. distinctAttribute := "movie_id"
  2. settings := meilisearch.Settings{
  3. RankingRules: []string{
  4. "words",
  5. "typo",
  6. "proximity",
  7. "attribute",
  8. "exactness",
  9. "desc(release_date)",
  10. "desc(rank)",
  11. },
  12. DistinctAttribute: &distinctAttribute,
  13. SearchableAttributes: []string{
  14. "title",
  15. "description",
  16. "genre",
  17. },
  18. DisplayedAttributes: []string{
  19. "title",
  20. "description",
  21. "genre",
  22. "release_date",
  23. },
  24. StopWords: []string{
  25. "the",
  26. "a",
  27. "an",
  28. },
  29. Synonyms: map[string][]string{
  30. "wolverine": []string{"xmen", "logan"},
  31. "logan": []string{"wolverine"},
  32. },
  33. }
  34. client.Index("movies").UpdateSettings(&settings)
  1. let mut synonyms = std::collections::HashMap::new();
  2. synonyms.insert(String::from("wolverine"), vec!["xmen", "logan"]);
  3. synonyms.insert(String::from("logan"), vec!["wolverine"]);
  4. let settings = Settings::new()
  5. .with_ranking_rules([
  6. "words",
  7. "typo",
  8. "proximity",
  9. "attribute",
  10. "exactness",
  11. "desc(release_date)",
  12. "desc(rank)"
  13. ])
  14. .with_distinct_attribute("movie_id")
  15. .with_searchable_attributes([
  16. "title",
  17. "description",
  18. "genre"
  19. ])
  20. .with_displayed_attributes([
  21. "title",
  22. "description",
  23. "genre",
  24. "release_date"
  25. ])
  26. .with_stop_words([
  27. "the",
  28. "a",
  29. "an"
  30. ])
  31. .with_synonyms(synonyms);
  32. let progress: Progress = movies.set_settings(&settings).await.unwrap();

Response: 202 Accepted

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

This updateId allows you to track the current update.

Reset settings

DELETE

  1. /indexes/:index_uid/settings

Reset the settings of an index.

All settings will be reset to their default value.

VariableDescriptionDefault value
synonymsList of associated words treated similarly{}
stopWordsList of words ignored by MeiliSearch when present in search queries[]
rankingRulesList of ranking rules sorted by order of importanceA list of ordered built-in ranking rules
filterableAttributesAttributes to use as filters and facets[]
distinctAttributeSearch returns documents with distinct (different) values of a given fieldnull
searchableAttributesFields in which to search for matching query words sorted by order of importance[““] (all attributes)
displayedAttributesFields displayed in the returned documents documents[““] (all attributes)

Learn more about the settings.

Path variables

VariableDescription
index_uidThe index UID

Example

cURL

JavaScript

Python

PHP

Ruby

Go

Rust

  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. client.index('movies').reset_settings
  1. client.Index("movies").ResetSettings()
  1. let progress: Progress = movies.reset_settings().await.unwrap();

Response: 202 Accepted

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

This updateId allows you to track the current update.