Skip to content

Commit

Permalink
Add indexing optimization guide (#2720)
Browse files Browse the repository at this point in the history
  • Loading branch information
Strift authored Feb 27, 2024
1 parent 688e4e4 commit 63a5dd3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/sidebar-learn.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@
"source": "learn/cookbooks/laravel_multitenancy.mdx",
"label": "Multitenancy with Laravel",
"slug": "laravel_multitenancy"
},
{
"source": "learn/cookbooks/indexing_best_practices.mdx",
"label": "Indexing best practices",
"slug": "indexing_best_practices"
}
]
},
Expand Down
35 changes: 35 additions & 0 deletions learn/cookbooks/indexing_best_practices.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Indexing best practices — Meilisearch documentation
description: Tips to speed up your documents indexing process.
sidebarDepth: 3
---

# 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](/learn/configuration/displayed_searchable_attributes#searchable-fields) 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](/learn/fine_tuning_results/filtering) and [sorting](/learn/fine_tuning_results/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](/learn/core_concepts/relevancy), 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](/reference/api/settings#searchable-attributes), [filterable](/reference/api/settings#filterable-attributes), [sortable](/reference/api/settings#sortable-attributes), or [displayed](/reference/api/settings#displayed-attributes) 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](/reference/api/overview#content-encoding).

## 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](https://github.com/meilisearch/meilisearch/releases?q=prerelease%3Afalse).

<Capsule intent="note">
For more information on how indexing works under the hood, take a look [this blog post about indexing best practices](https://blog.meilisearch.com/best-practices-for-faster-indexing/) and the [indexing and performance guide](/learn/advanced/indexing).
</Capsule>

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

0 comments on commit 63a5dd3

Please sign in to comment.