Skip to main content
PATCH
/
indexes
/
{index_uid}
/
settings
/
typo-tolerance
cURL
curl \
  -X PATCH 'MEILISEARCH_URL/indexes/books/settings/typo-tolerance' \
  -H 'Content-Type: application/json' \
  --data-binary '{
    "minWordSizeForTypos": {
      "oneTypo": 4,
      "twoTypos": 10
    },
    "disableOnAttributes": ["title"]
  }'
client.index('books').updateTypoTolerance({
minWordSizeForTypos: {
oneTypo: 4,
twoTypos: 10
},
disableOnAttributes: [
'title'
]
})
$client->index('books')->updateTypoTolerance([
'minWordSizeForTypos' => [
'oneTypo' => 4,
'twoTypos' => 10
],
'disableOnAttributes' => [
'title'
]
]);
client.index('books').update_typo_tolerance({
'minWordSizeForTypos': {
'oneTypo': 4,
'twoTypos': 10
},
'disableOnAttributes': [
'title'
]
})
TypoTolerance typoTolerance = new TypoTolerance();
HashMap<String, Integer> minWordSizeTypos =
new HashMap<String, Integer>() {
{
put("oneTypo", 4);
put("twoTypos", 10);
}
};

typoTolerance.setMinWordSizeForTypos(minWordSizeTypos);
typoTolerance.setDisableOnAttributes(new String[] {"title"});

client.index("books").updateTypoToleranceSettings(typoTolerance);
index('books').update_typo_tolerance({
min_word_size_for_typos: {
one_typo: 4,
two_typos: 10
},
disable_on_attributes: ['title']
})
client.Index("books").UpdateTypoTolerance(&meilisearch.TypoTolerance{
MinWordSizeForTypos: meilisearch.MinWordSizeForTypos{
OneTypo: 4,
TwoTypos: 10,
},
DisableOnAttributes: []string{"title"},
})
var typoTolerance = new TypoTolerance {
DisableOnAttributes = new string[] { "title" },
MinWordSizeTypos = new TypoTolerance.TypoSize {
OneTypo = 4,
TwoTypos = 10
}
};

await client.Index("books").UpdateTypoToleranceAsync(typoTolerance);
let typo_tolerance = TypoToleranceSettings {
enabled: Some(false),
disable_on_attributes: None,
disable_on_words: None,
min_word_size_for_typos: None,
};

let task: TaskInfo = client
.index("books")
.set_typo_tolerance(&typo_tolerance)
.await
.unwrap();
final toUpdate = TypoTolerance(
minWordSizeForTypos: MinWordSizeForTypos(
oneTypo: 4,
twoTypos: 10,
),
disableOnAttributes: ['title'],
);
await client.index('books').updateTypoTolerance(toUpdate);
{
  "taskUid": 147,
  "indexUid": "movies",
  "status": "enqueued",
  "type": "settingsUpdate",
  "enqueuedAt": "2024-08-08T17:05:55.791772Z"
}
{
"message": "The Authorization header is missing. It must use the bearer authorization method.",
"code": "missing_authorization_header",
"type": "auth",
"link": "https://docs.meilisearch.com/errors#missing_authorization_header"
}
{
"message": "Index `movies` not found.",
"code": "index_not_found",
"type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#index_not_found"
}

Authorizations

Authorization
string
header
required

An API key is a token that you provide when making API calls. Read more about how to secure your project.

Include the API key to the Authorization header, for instance:

-H 'Authorization: Bearer 6436fc5237b0d6e0d64253fbaac21d135012ecf1'

If you use a SDK, ensure you instantiate the client with the API key, for instance with JS SDK:

const client = new MeiliSearch({
host: 'MEILISEARCH_URL',
apiKey: '6436fc5237b0d6e0d64253fbaac21d135012ecf1'
});

Path Parameters

index_uid
string
required

Unique identifier of the index.

Body

application/json

Typo tolerance: how spelling mistakes in queries are handled.

enabled
boolean | null
default:true

When true, typo tolerance is enabled. When false, only exact matches are returned.

Example:

true

minWordSizeForTypos
null | object

Minimum word length before typos are allowed. Contains oneTypo (min length for 1 typo) and twoTypos (min length for 2 typos). Example: { "oneTypo": 5, "twoTypos": 9 }.

disableOnWords
string[] | null

Words for which typo tolerance is disabled. Use for brand names or terms that must match exactly.

Example:
["iPhone", "phone"]
disableOnAttributes
string[] | null

Attributes for which typo tolerance is disabled. Those attributes only return exact matches. Useful for fields like product codes or IDs.

Example:
["uuid", "url"]
disableOnNumbers
boolean | null
default:false

When true, typo tolerance is disabled on numeric tokens. For example, 123 will not match 132.

Example:

false

Response

Task successfully enqueued.

A summarized view of a task, returned when a task is enqueued

taskUid
integer<u-int32>
required

Unique sequential identifier of the task.

Required range: x >= 0
status
enum<string>
required

Status of the task. Possible values are enqueued, processing, succeeded, failed, and canceled.

Available options:
enqueued,
processing,
succeeded,
failed,
canceled
Example:

"processing"

type
enum<string>
required

Type of operation performed by the task.

Available options:
documentAdditionOrUpdate,
documentEdition,
documentDeletion,
settingsUpdate,
indexCreation,
indexDeletion,
indexUpdate,
indexSwap,
taskCancelation,
taskDeletion,
dumpCreation,
snapshotCreation,
export,
upgradeDatabase,
indexCompaction,
networkTopologyChange
Example:

"documentAdditionOrUpdate"

enqueuedAt
string<date-time>
required

Date and time when the task was enqueued.

indexUid
string | null

Unique identifier of the targeted index. Null for global tasks.

customMetadata
string | null

Custom metadata attached to this task at creation. Use it to associate tasks with external systems or add application-specific information.