Displayed and searchable attributes define what data Meilisearch returns after a successful query and which fields Meilisearch takes in account when searching. Knowing how to configure them can help improve your application’s performance.
displayedAttributes
: Attributes whose fields are displayed in documentssearchableAttributes
: Attributes whose values are searched for matching query wordsdisplayedAttributes
list are displayed in each matching document.
Documents returned upon search contain only displayed fields. If a field attribute is not in the displayed-attribute list, the field won’t be added to the returned documents.
By default, all field attributes are set as displayed.
title
, overview
, release_date
and genres
.
searchableAttributes
listsearchableAttributes
list serves two purposes:
searchableAttributes
list.
searchableAttributes
list in their order of appearance. This means that the initial order will be based on the order of attributes in the first document indexed, with each new attribute found in subsequent documents added at the end of this list.
This default behavior is indicated by a searchableAttributes
value of ["*"]
. To verify the current value of your searchableAttributes
list, use the get searchable attributes endpoint.
If you’d like to restore your searchable attributes list to this default behavior, set searchableAttributes
to an empty array []
or use the reset searchable attributes endpoint.
searchableAttributes
list, subsequent new attributes will no longer be automatically added unless the settings are reset.
searchableAttributes
will change the displayed order of document fields in the JSON response. This behavior is inconsistent and will be fixed in a future release.id
, overview
, genres
, title
, release_date
. These fields all contain useful information. However, some are more useful to search than others. To make the id
and release_date
fields non-searchable and re-order the remaining fields by importance, you might update the searchable attributes list in the following way.
searchableAttributes
list. Use the attributesToSearchOn
search parameter to restrict specific queries to a subset of your index’s searchableAttributes
.
displayedAttributes
list and the searchableAttributes
list, it is still stored in the database and can be added to either or both lists at any time.