Indexing best practices

    In this guide, you will find some of the best practices to index your data efficiently and speed up the indexing process.

    Define searchable attributes

    To speed up indexing, review your list of searchable attributes and ensure it includes only the fields you want to be checked for query word matches. This improves both relevance and search speed by removing irrelevant data from your database. It will also keep your disk usage to the necessary minimum.

    Review filterable and sortable attributes

    Some document fields are necessary for filtering and sorting results, but they dot not need to be searchable. Generally, numeric and boolean fields fall into this category. Make sure to review your list of searchable attributes and remove any fields that are only used for filtering or sorting.

    Set ranking rules before indexing

    Whenever you update your ranking rules, Meilisearch will trigger a reindexing of all your documents. This can be a time-consuming process, especially if you have a large dataset. For this reason, it is better to define your ranking rules before indexing your data.

    Optimize document size

    Smaller documents are processed faster, so make sure to trim down any unncessary data from your documents. When a document field is missing from the list of searchable, filterable, sortable, or displayed attributes, it might be best to remove it from the document. To go further, consider compressing your data using methods such as br, deflate, or gzip. Consult the supported encoding formats reference.

    Keep your Meilisearch up-to-date!

    Make sure to keep your Meilisearch instance up-to-date to benefit from the latest improvements. You can see a list of all our engine releases on GitHub.

    NOTE

    For more information on how indexing works under the hood, take a look this blog post about indexing best practices and the indexing and performance guide.

    By following these recommendations, you can optimize the indexing process of Meilisearch and enhance the overall search experience for your users.