Synonyms
Synonyms
is an object containing words and their respective synonyms. A synonym in Meilisearch is considered equal to its associated word in a search query.
Synonyms can also be updated directly through the global settings route along with the other settings.
NOTE
Updating the settings means overwriting the default settings of MeiliSearch. You can reset to default values using the DELETE
routes.
GET
Get the list of of an index.
Path Variables
Example
$ curl \
-X GET 'http://localhost:7700/indexes/movies/settings/synonyms'
client.index('movies').getSynonyms()
client.index('movies').get_synonyms()
$client->index('movies')->getSynonyms();
index.synonyms
client.Settings("movies").GetSynonyms()
let synonyms: HashMap<String, Vec<String>> = movies.get_synonyms().await.unwrap();
Response: 200 OK
{
"wolverine": ["xmen", "logan"],
"logan": ["wolverine", "xmen"],
"wow": ["world of warcraft"]
POST
Update the list of of an index.
Path Variables
Body
More information about the body.
Example
$ curl \
-X POST 'http://localhost:7700/indexes/movies/settings/synonyms' \
--data '{
"wolverine": ["xmen", "logan"],
"logan": ["wolverine", "xmen"],
"wow": ["world of warcraft"]
client.index('movies').updateSynonyms({
wolverine: ['xmen', 'logan'],
logan: ['wolverine', 'xmen'],
wow: ['world of warcraft']
})
client.index('movies').update_synonyms({
'wolverine': ['xmen', 'logan'],
'logan': ['wolverine', 'xmen'],
'wow': ['world of warcraft']
})
$client->index('movies')->updateSynonyms([
'wolverine': ['xmen', 'logan'],
'logan': ['wolverine', 'xmen'],
'wow': ['world of warcraft']
]);
index.update_synonyms({
wolverine: ['xmen', 'logan'],
logan: ['wolverine', 'xmen'],
wow: ['world of warcraft']
synonyms := map[string][]string{
"wolverine": []string{"xmen", "logan"},
"logan": []string{"wolverine", "xmen"},
"wow": []string{"world of warcraft"},
client.Settings("movies").UpdateSynonyms(synonyms)
let mut synonyms = std::collections::HashMap::new();
synonyms.insert(String::from("wolverine"), vec![String::from("xmen"), String::from("logan")]);
synonyms.insert(String::from("logan"), vec![String::from("xmen"), String::from("wolverine")]);
synonyms.insert(String::from("wow"), vec![String::from("world of warcraft")]);
let progress: Progress = movies.set_synonyms(&synonyms).await.unwrap();
Response: 202 Accepted
{
"updateId": 1
}
This updateId
allows you to .
DELETE
Reset the list of synonyms of an index to its default value.
Default value
Path Variables
Example
$ curl \
-X DELETE 'http://localhost:7700/indexes/movies/settings/synonyms'
client.index('movies').resetSynonyms()
client.index('movies').reset_synonyms()
$client->index('movies')->resetSynonyms();
index.reset_synonyms
client.Settings("movies").ResetSynonyms()
movies.reset_synonyms().await.unwrap();
Response: 202 Accepted
{
"updateId": 1
This updateId
allows you to .