displayedAttributes to control which fields are returned when a document matches a query.
Fields not listed in displayedAttributes are still stored in the database and remain searchable if configured. You can add them back to the displayed list at any time.
Set displayed attributes
Suppose you manage a movies database and only want search results to show the title, overview, release date, and genres:id, poster_url, or internal_rating are excluded from search results even if they exist in the document.
When to limit displayed attributes
- Performance: reducing the number of displayed fields makes response payloads smaller, especially when documents contain large text fields or many attributes
- Security: hide internal fields (admin notes, cost prices, internal IDs) from the search response without removing them from the index
- Clarity: return only the fields your UI needs, reducing frontend parsing work
Reset displayed attributes
To restore the default behavior (all fields displayed), reset the setting:All fields are always stored in the database regardless of display settings. Making a field non-displayed does not delete it. You can also use
attributesToRetrieve at search time to limit which displayed fields are returned for a specific query, without changing the index setting.Next steps
Configure searchable attributes
Control which fields are searched and their ranking priority
Highlight search results
Show matched terms in the displayed fields