An index is a collection of documents, much like a table in MySQL or a collection in MongoDB.
SQL
or a collection in MongoDB.
An index is defined by a uid
and contains the following information:
movies
index might contain documents with fields like movie_id
, title
, genre
, overview
, and release_date
. Using settings, you could make a movie’s title
have a bigger impact on search results than its overview
, or make the movie_id
field non-searchable.
One index’s settings do not impact other indexes. For example, you could use a different list of synonyms for your movies
index than for your costumes
index, even if they’re on the same server.
uid
is the unique identifier of an index. It is set when creating the index and must be an integer or string containing only alphanumeric characters a-z A-Z 0-9
, hyphens -
and underscores _
.
Once defined, the uid
cannot be changed, and you cannot create another index with the same uid
.
costumes
index. Setting costume_name
as the distinct attribute will mean Meilisearch will not return more than one black jacket with the same costume_name
.
Designate the distinct attribute using the update settings endpoint or the update distinct attribute endpoint. You can only set one field as the distinct attribute per index.
Learn more about distinct attributes.
filterableAttributes
, then make a search query using the filter
search parameter.
By default, Meilisearch returns 100
facet values for each faceted field. You can change this using the update settings endpoint or the update faceting settings endpoint.
Learn more about faceting.
genre
: Science Fiction
, with a rating
above 8
.
Before filtering on any document attribute, you must add it to filterableAttributes
using the update settings endpoint or the update filterable attributes endpoint. Then, make a search query using the filter
search parameter.
Learn more about filtering.
1000
results for a search query. You can change this limit using the update settings endpoint or the update pagination settings endpoint.
Learn more about pagination.
sortableAttributes
using the update settings endpoint or the update sortable attributes endpoint. You can then use the sort
search parameter to sort your results in ascending or descending order.
Learn more about sorting.
the
or of
in English). You can add these words to the stop words list and Meilisearch will ignore them during search.
Change your index’s stop words list using the update settings endpoint or the update stop words endpoint. In addition to improving relevancy, designating common words as stop words greatly improves performance.
Learn more about stop words.
chickne
instead of chicken
. This setting allows you to do the following for your index:
movies
, where your users are currently making search requests. You want to deploy a new version of movies
with different settings, but updating it normally could cause downtime for your users. This problem can be solved using index swapping.
To use index swapping, you would create a second index, movies_new
, containing all the changes you want to make to movies
.
This means that the documents, settings, and task history of movies
will be swapped with the documents, settings, and task history of movies_new
without any downtime for the search clients. The task history of enqueued
tasks is not modified.
Once swapped, your users will still be making search requests to the movies
index but it will contain the data of movies_new
. You can delete movies_new
after the swap or keep it in case something goes wrong and you want to swap back.
Swapping indexes is an atomic transaction: either all indexes are successfully swapped, or none are.
For more information, see the swap indexes endpoint.