Stop-words

Child route of the settings route.

The stop-words route lets you add a list of words that will be ignored in search queries. So if you add the as a stop word and you make a search on the mask you will only have matching documents with mask.

Stop-words can also be updated directly through the global settings route along with the other settings.

To learn more about stop words, refer to our dedicated guide.

WARNING

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

Get stop-words

GET

  1. /indexes/:index_uid/settings/stop-words

Get the stop-words list of an index.

Path variables

VariableDescription
index_uidThe index UID

Example

<>

cURL

JS

Python

PHP

Java

Ruby

Go

Rust

Swift

Dart

  1. curl \
  2. -X GET 'http://localhost:7700/indexes/movies/settings/stop-words'
  1. client.index('movies').getStopWords()
  1. client.index('movies').get_stop_words()
  1. $client->index('movies')->getStopWords();
  1. client.index("movies").getStopWords();
  1. client.index('movies').stop_words
  1. client.Index("movies").GetStopWords()
  1. let stop_words: Vec<String> = movies.get_stop_words().await.unwrap();
  1. client.index("movies").getStopWords { (result: Result<[String], Swift.Error>) in
  2. switch result {
  3. case .success(let stopWords):
  4. print(stopWords)
  5. case .failure(let error):
  6. print(error)
  7. }
  8. }
  1. await client.index('movies').getStopWords();

Response: 200 Ok

  1. [
  2. "of",
  3. "the",
  4. "to"
  5. ]

Update stop-words

POST

  1. /indexes/:index_uid/settings/stop-words

Update the list of stop-words of an index.

Path variables

VariableDescription
index_uidThe index UID

Body

An array of strings that contains the stop-words.

If a list of stop-words already exists it will be overwritten (replaced).

More information about the body.

Example

<>

cURL

JS

Python

PHP

Java

Ruby

Go

Rust

Swift

Dart

  1. curl \
  2. -X POST 'http://localhost:7700/indexes/movies/settings/stop-words' \
  3. -H 'Content-Type: application/json' \
  4. --data-binary '["the", "of", "to"]'
  1. client.index('movies').updateStopWords(['of', 'the', 'to'])
  1. client.index('movies').update_stop_words(['of', 'the', 'to'])
  1. $client->index('movies')->updateStopWords(['the', 'of', 'to']);
  1. Settings settings = new Settings();
  2. settings.setStopWords(new String[] {"of", "the", "to"});
  3. client.index("movies").updateSettings(settings);
  1. client.index('movies').update_stop_words(['of', 'the', 'to'])
  1. stopWords := []string{"of", "the", "to"}
  2. client.Index("movies").UpdateStopWords(&stopWords)
  1. let stop_words = ["of", "the", "to"];
  2. let progress: Progress = movies.set_stop_words(&stop_words).await.unwrap();
  1. let stopWords: [String] = ["of", "the", "to"]
  2. client.index("movies").updateStopWords(stopWords) { (result: Result<Update, Swift.Error>) in
  3. switch result {
  4. case .success(let update):
  5. print(update)
  6. case .failure(let error):
  7. print(error)
  8. }
  9. }
  1. await client.index('movies').update_stop_words(['of', 'the', 'to']);

Response: 202 Accepted

  1. { "updateId": 1 }

This updateId allows you to track the current update.

Reset stop-words

DELETE

  1. /indexes/:index_uid/settings/stop-words

Reset the list of stop-words of an index to its default value.

Default value

Empty array: []

Path variables

VariableDescription
index_uidThe index UID

Example

<>

cURL

JS

Python

PHP

Java

Ruby

Go

Rust

Swift

Dart

  1. curl \
  2. -X DELETE 'http://localhost:7700/indexes/movies/settings/stop-words'
  1. client.index('movies').resetStopWords()
  1. client.index('movies').reset_stop_words()
  1. $client->index('movies')->resetStopWords();
  1. //Not yet implemented
  1. client.index('movies').reset_stop_words
  1. client.Index("movies").ResetStopWords()
  1. let progress: Progress = movies.reset_stop_words().await.unwrap();
  1. client.index("movies").resetStopWords { (result: Result<Update, Swift.Error>) in
  2. switch result {
  3. case .success(let update):
  4. print(update)
  5. case .failure(let error):
  6. print(error)
  7. }
  8. }
  1. await client.index('movies').reset_stop_words();

Response: 202 Accepted

  1. { "updateId": 1 }

This updateId allows you to track the current update.