All Settings
Settings is a list of all the customization possible for an index.
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:
- Synonyms
- Stop-words
- Ranking rules
- Attributes For Faceting
- Distinct attribute
- Searchable attributes
- Displayed attributes
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 settings
GET
1. /indexes/:index_uid/settings
Get the settings of an index.
Learn more about the settings.
Path Variables
| Variable | Description |
|---|---|
| index_uid | The index UID |
Response Body
| Variable | Type | Description | Default value |
|---|---|---|---|
| synonyms | Object | List 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 | A list of ordered built-in ranking rules |
| attributesForFaceting | [Strings] | Attributes to use as facets | [] |
| distinctAttribute | String | Search returns documents with distinct (different) values of the given field | null |
| 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
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. }
Update settings
POST
1. /indexes/:index_uid/settings
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. Learn more about the settings in this guide.
If the provided index does not exist, it will be created.
Path Variables
| Variable | Description |
|---|---|
| index_uid | The index UID |
Body
| Variable | Type | Description | Default value |
|---|---|---|---|
| synonyms | Object | List 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 | A list of ordered built-in ranking rules |
| attributesForFaceting | [Strings] | Attributes to use as facets | [] |
| distinctAttribute | String | Search returns documents with distinct (different) values of the given field | null |
| 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
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. 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. 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. '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. 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!["xmen", "logan"]);
3. synonyms.insert(String::from("logan"), vec!["wolverine"]);
5. let settings = Settings::new()
6. .with_ranking_rules([
7. "typo",
8. "words",
9. "proximity",
10. "attribute",
11. "wordsPosition",
12. "exactness",
13. "desc(release_date)",
14. "desc(rank)"
15. ])
16. .with_distinct_attribute("movie_id")
17. .with_searchable_attributes([
18. "title",
19. "description",
20. "genre"
21. ])
22. .with_displayed_attributes([
23. "title",
24. "description",
25. "genre",
26. "release_date"
27. ])
28. .with_stop_words([
29. "the",
30. "a",
31. "an"
32. ])
33. .with_synonyms(synonyms);
35. 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.
| Variable | Description | Default value |
|---|---|---|
| synonyms | List of associated words treated similarly | {} |
| stopWords | List of words ignored by MeiliSearch when present in search queries | [] |
| rankingRules | List of ranking rules sorted by order of importance | A list of ordered built-in ranking rules |
| attributesForFaceting | Attributes to use as facets | [] |
| distinctAttribute | Search returns documents with distinct (different) values of a given field | null |
| searchableAttributes | Fields in which to search for matching query words sorted by order of importance | [““] (all attributes) |
| displayedAttributes | Fields displayed in the returned documents documents | [““] (all attributes) |
Learn more about the settings.
Path Variables
| Variable | Description |
|---|---|
| index_uid | The 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
3. }
This updateId allows you to track the current update.
