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
/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
curl \
-X GET 'http://localhost:7700/indexes/movies/settings'
client.index('movies').getSettings()
client.index('movies').get_settings()
$client->index('movies')->getSettings();
index.settings
client.Settings("movies").GetAll()
let settings: Settings = movies.get_settings().await.unwrap();
Response: 200 Ok
List the settings.
{
"rankingRules": [
"typo",
"words",
"proximity",
"attribute",
"wordsPosition",
"exactness",
"desc(release_date)"
],
"attributesForFaceting": ["genres"],
"distinctAttribute": null,
"searchableAttributes": ["title", "description", "genre"],
"displayedAttributes": [
"title",
"description",
"genre",
"release_date"
],
"stopWords": null,
"synonyms": {
"wolverine": ["xmen", "logan"],
"logan": ["wolverine", "xmen"]
}
}
Update settings
POST
/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
curl \
-X POST 'http://localhost:7700/indexes/movies/settings' \
--data '{
"rankingRules": [
"typo",
"words",
"proximity",
"attribute",
"wordsPosition",
"exactness",
"desc(release_date)",
"desc(rank)"
],
"distinctAttribute": "movie_id",
"searchableAttributes": [
"title",
"description",
"genre"
],
"displayedAttributes": [
"title",
"description",
"genre",
"release_date"
],
"stopWords": [
"the",
"a",
"an"
],
"synonyms": {
"wolverine": ["xmen", "logan"],
"logan": ["wolverine"]
}
}'
client.index('movies').updateSettings({
rankingRules: [
'typo',
'words',
'proximity',
'attribute',
'wordsPosition',
'exactness',
'desc(release_date)',
'desc(rank)'
],
distinctAttribute: 'movie_id',
searchableAttributes: [
'title',
'description',
'genre'
],
displayedAttributes: [
'title',
'description',
'genre',
'release_date'
],
stopWords: [
'the',
'a',
'an'
],
synonyms: {
'wolverine': ['xmen', 'logan'],
'logan': ['wolverine']
}
})
client.index('movies').update_settings({
'rankingRules': [
'typo',
'words',
'proximity',
'attribute',
'wordsPosition',
'exactness',
'desc(release_date)',
'desc(rank)'
],
'distinctAttribute': 'movie_id',
'searchableAttributes': [
'title',
'description',
'genre'
],
'displayedAttributes': [
'title',
'description',
'genre',
'release_date'
],
'stopWords': [
'the',
'a',
'an'
],
'synonyms': {
'wolverine': ['xmen', 'logan'],
'logan': ['wolverine']
},
'acceptNewFields': False
})
$client->index('movies')->updateSettings([
'rankingRules' => [
'typo',
'words',
'proximity',
'attribute',
'wordsPosition',
'exactness',
'desc(release_date)',
'desc(rank)'
],
'distinctAttribute' => 'movie_id',
'searchableAttributes' => [
'title',
'description',
'genre'
],
'displayedAttributes' => [
'title',
'description',
'genre',
'release_date'
],
'stopWords' => [
'the',
'a',
'an'
],
'synonyms' => [
'wolverine': ['xmen', 'logan'],
'logan': ['wolverine']
]
]);
index.update_settings({
rankingRules: [
'typo',
'words',
'proximity',
'attribute',
'wordsPosition',
'exactness',
'desc(release_date)',
'desc(rank)'
],
distinctAttribute: 'movie_id',
searchableAttributes: [
'title',
'description',
'genre'
],
displayedAttributes: [
'title',
'description',
'genre',
'release_date'
],
stopWords: [
'the',
'a',
'an'
],
synonyms: {
wolverine: ['xmen', 'logan'],
logan: ['wolverine']
}
})
distinctAttribute := "movie_id"
settings := meilisearch.Settings{
RankingRules: []string{
"typo",
"words",
"proximity",
"attribute",
"wordsPosition",
"exactness",
"desc(release_date)",
"desc(rank)",
},
DistinctAttribute: &distinctAttribute,
SearchableAttributes: []string{
"title",
"description",
"genre",
},
DisplayedAttributes: []string{
"title",
"description",
"genre",
"release_date",
},
StopWords: []string{
"the",
"a",
"an",
},
Synonyms: map[string][]string{
"wolverine": []string{"xmen", "logan"},
"logan": []string{"wolverine"},
},
}
client.Settings("movies").UpdateAll(settings)
let mut synonyms = std::collections::HashMap::new();
synonyms.insert(String::from("wolverine"), vec!["xmen", "logan"]);
synonyms.insert(String::from("logan"), vec!["wolverine"]);
let settings = Settings::new()
.with_ranking_rules([
"typo",
"words",
"proximity",
"attribute",
"wordsPosition",
"exactness",
"desc(release_date)",
"desc(rank)"
])
.with_distinct_attribute("movie_id")
.with_searchable_attributes([
"title",
"description",
"genre"
])
.with_displayed_attributes([
"title",
"description",
"genre",
"release_date"
])
.with_stop_words([
"the",
"a",
"an"
])
.with_synonyms(synonyms);
let progress: Progress = movies.set_settings(&settings).await.unwrap();
Response: 202 Accepted
{
"updateId": 1
}
This updateId
allows you to track the current update.
Reset settings
DELETE
/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
curl \
-X DELETE 'http://localhost:7700/indexes/movies/settings'
client.index('movies').resetSettings()
client.index('movies').reset_settings()
$client->index('movies')->resetSettings();
index.reset_settings
client.Settings("movies").ResetAll()
let progress: Progress = movies.reset_settings().await.unwrap();
Response: 202 Accepted
{
"updateId": 1
}
This updateId
allows you to track the current update.