Skip to main content
Prefix search allows Meilisearch to match documents based on the beginning of the last word in a query. For example, typing adv matches “adventure”, “adventure”, and “advanced”. This is the feature that powers the “search as you type” experience. The prefixSearch index setting controls how Meilisearch handles prefix matching.

Available modes

ModeDescription
indexingTimeDefault. Prefix data structures are built during indexing. This enables fast prefix search at query time but increases index size and indexing duration.
disabledPrefix search is turned off. Only exact word matches are returned. This reduces index size and speeds up indexing, but users must type complete words to find results.

Check current prefix search setting

Retrieve the current prefixSearch setting for an index:
curl \
  -X GET 'MEILISEARCH_URL/indexes/INDEX_UID/settings/prefix-search'
By default, the response is "indexingTime". If your use case does not require search-as-you-type (for example, users submit complete queries via a search button), disabling prefix search can reduce index size and improve indexing performance:
curl \
  -X PUT 'MEILISEARCH_URL/indexes/INDEX_UID/settings/prefix-search' \
  -H 'Content-Type: application/json' \
  --data-binary '"disabled"'
Updating the prefix search setting triggers a re-indexing of all documents in the index. This is an asynchronous operation. Use the task API to monitor progress.
Restore the default indexingTime behavior:
curl \
  -X DELETE 'MEILISEARCH_URL/indexes/INDEX_UID/settings/prefix-search'
  • Form-based search: Users type a full query and press a search button rather than seeing results as they type
  • Large datasets with performance constraints: Disabling prefix search reduces index size and speeds up both indexing and queries
  • Exact matching requirements: When partial word matches would return too many irrelevant results

When to keep prefix search enabled

  • Search-as-you-type interfaces: Users expect results to update instantly as they type each character
  • Autocomplete experiences: Prefix matching is essential for suggesting completions
  • Discovery-oriented search: Partial matches help users explore content they might not find with exact queries
Prefix search only applies to the last word in a multi-word query. Earlier words in the query must match completely (or within typo tolerance). For example, searching for harry pot matches “Harry Potter” because “harry” matches exactly and “pot” is a prefix match for “Potter”.
For the full API reference, see get prefix search.