API Reference / API Parameters / unretrievableAttributes
Type: list of strings
Engine default: [] (no attribute is unretrievable)
Parameter syntax
'unretrievableAttributes' => [
  'attribute'
]

Can be used in these methods:

About this parameter

List of attributes that can’t be retrieved at query time.

You may want to ensure that under no circumstance should a particular set of attributes be returned. This is particularly important for security or business reasons, where some attributes are used only for ranking or other technical purposes, but should never be seen by your end users, for example, total_sales, permissions, and other private information. This setting guarantees this.

Usage notes

  • These attributes can still be used for indexing and/or ranking.
  • This setting is bypassed when the query is authenticated with the admin API key.

    Using the dashboard

    You can also add and remove these unretrievable attributes from the dashboard: Indices > Configuration > Search behavior > Retrieved attributes.

Under Unretrievable attributes:

  • Click Add an Attribute to select and add an attribute to the list
  • Click the trash icon to remove an attribute from the list.

Examples

Make some attributes unretrievable

1
2
3
4
5
$index->setSettings([
  'unretrievableAttributes' => [
    'total_number_of_sales'
  ]
]);
Did you find this page helpful?