unretrievableAttributes

Type: list of strings
Engine default: [] (no attribute is unretrievable)
Parameter syntax
'unretrievableAttributes' => [
  'attribute'
]
Parameter syntax
unretrievableAttributes: [
  'attribute'
]
Parameter syntax
unretrievableAttributes: [
  'attribute'
]
Parameter syntax
'unretrievableAttributes': [
  'attribute'
]
Parameter syntax
"unretrievableAttributes": [
  "attribute"
]
Parameter syntax
new JSONObject().put(
  "unretrievableAttributes",
  new JSONArray()
    .put("attribute")
  )
)
Parameter syntax
dynamic settings = new JObject();
settings.unretrievableAttributes = new JArray(new string[] {
  "attribute"
});
Parameter syntax
new IndexSettings().setUnretrievableAttributes(Arrays.asList(
  "attribute"
))
Parameter syntax
"unretrievableAttributes": []string{
  "attribute",
}
Parameter syntax
unretrievableAttributes = Some(Seq(
  "attribute"
))

Can be used in these methods:
setSettings set_settings setSettings set_settings setSettings setSettingsAsync SetSettings setSettings SetSettings changeSettings

About this parameter

List of attributes that cannot 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.

Examples

Make some attributes unretrievable

<?php
$index->setSettings([
  'unretrievableAttributes' => [
    'total_number_of_sales'
  ]
]);
index.set_settings({
  unretrievableAttributes: [
    'total_number_of_sales'
  ]
})
index.setSettings({
  unretrievableAttributes: [
    'total_number_of_sales'
  ]
});
index.set_settings({
  'unretrievableAttributes': [
      "total_number_of_sales"
  ]
})
index.setSettings([
  "unretrievableAttributes": [
    "total_number_of_sales"
  ]
])
index.setSettings(
  new JSONObject().put(
    "unretrievableAttributes",
    new JSONArray()
      .put("total_number_of_sales")
  )
);
index.SetSettings(
  JObject.Parse(@"{""unretrievableAttributes"":[""total_number_of_sales""]}")
);
index.setSettings(
  new IndexSettings().setUnretrievableAttributes(Arrays.asList(
    "total_number_of_sales"
  ))
);
res, err := index.SetSettings(algoliasearch.Map{
  "unretrievableAttributes": []string{
    "total_number_of_sales",
  },
})
client.execute {
  changeSettings of "myIndex" `with` IndexSettings(
    unretrievableAttributes = Some(Seq(
      "total_number_of_sales"
    ))
  )
}
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala