Skip to main content

Only index the fields you need

Basicly, the more fields you index, the more space the index will take and the longer it takes to index all the items. It also impacts the performance when you query an index with a lot of fields. In general, this means that you should index as few fields as possible. As a rule of thumb you should not index more than 50 fields.
You can use the schema alias query feature to return views for presentation data as part of your query result so you only index the fields you need for filtering and sorting.

Prefer keyword over text (unless you need the power of the text type)

From the name of the types, it’s easy to think that every time you need to index a string, you should use the text type. However we also have the keyword type that also works on strings and it’s important to know the difference.

text

When using the text type, the string value is analyzed when an item is inserted into the index. This means it takes a bit longer to index and query the field, but it brings a lot of power as well. Analyzed means that the string value is split into tokens and stored in the index. This makes it possible to do fuzzy search using the search property in the Query API.

keyword

When using the keyword type, the string value is not analyzed but indexed as is. This makes it faster and suitable when you just need to filter, sort, build facets or use the field for display on the frontend.