attributesToRetrieve

Type: list of strings
Engine default: * (all attributes)
Formerly: attributes
Parameter syntax
'attributesToRetrieve' => [
  'attribute',
  '*' // retrieves all attributes
]
Parameter syntax
attributesToRetrieve: [
  'attribute',
  '*' # retrieves all attributes
]
Parameter syntax
attributesToRetrieve: [
  'attribute',
  '*' // retrieves all attributes
]
Parameter syntax
'attributesToRetrieve': [
  'attribute',
  '*' # retrieves all attributes
]
Parameter syntax
index.setSettings([
  "attributesToRetrieve": [
    "attribute",
    "*" // retrieves all attributes
  ]
])
Parameter syntax
new JSONObject()
  .put(
    "attributesToRetrieve",
    new JSONArray()
      .put("attribute")
      .put("*") // retrieves all attributes
  )
);
Parameter syntax
dynamic settings = new JObject();
settings.attributesToRetrieve = new JArray(new string[] {
  "attribute",
  "*" // retrieves all attributes
});
Parameter syntax
new IndexSettings().setAttributesToRetrieve(Arrays.asList(
  "attribute",
  "*" // retrieves all attributes
))
Parameter syntax
"attributesToRetrieve": []string{
  "attribute",
  "*" // retrieves all attributes
},
Parameter syntax
attributesToRetrieve = Some(Seq(
  "attribute",
  "*" // retrieves all attributes
))

Can be used in these methods:
search, setSettings, browse, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey search, set_settings, browse, search_for_facet_values, generate_secured_api_key, add_api_key, update_api_key search, setSettings, browse, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey search, set_settings, browse, search_for_facet_values, generate_secured_api_key, add_api_key, update_api_key search, setSettings, browse, searchForFacetValues searchAsync, setSettingsAsync, browseAsync, searchForFacetValues Search, SetSettings, Browse, SearchForFacetValues, GenerateSecuredApiKey, AddApiKey, UpdateApiKey Search, setSettings, browse, searchForFacetValues, generateSecuredApiKey, addApiKey, updateApiKey Search, SetSettings, Browse, SearchForFacetValues, GenerateSecuredAPIKey, AddAPIKey, UpdateAPIKey search, changeSettings, browse index, search into facet values, generateSecuredApiKey, add key, update key

About this parameter

List of attributes you want to retrieve.

You don’t always need to retrieve a full response that includes every attribute in your index. Sometimes you may only want to receive the most relevant attributes. This will reduce response size and therefore improve performance.


Usage notes:
  • You can use * to retrieve all values.

  • objectID is always retrieved, even when not specified.

  • Attributes listed in unretrievableAttributes will not be retrieved even if requested, unless the request is authenticated with the admin API key.

Examples

Set default list of retrievable attributes

<?php
$index->setSettings([
  'attributesToRetrieve' => [
    'author',
    'title',
    'content'
  ]
]);
index.set_settings({
  attributesToRetrieve: [
    'author',
    'title',
    'content'
  ]
})
index.setSettings({
  attributesToRetrieve: [
    'author',
    'title',
    'content'
  ]
});
index.set_settings({
  'attributesToRetrieve': [
    'author',
    'title',
    'content'
  ]
})
index.setSettings([
  "attributesToRetrieve": [
    "author",
    "title",
    "content"
  ]
])
index.setSettings(new JSONObject().put("attributesToRetrieve",
  new JSONArray().put("author").put("title").put("content")));
index.SetSettings(
  JObject.Parse(@"{""attributesToRetrieve"":[""author"",""title"",""content""]}")
);
index.setSettings(
  new IndexSettings().setAttributesToRetrieve(Arrays.asList(
    "author",
    "title",
    "content"
  ))
);
res, err := index.SetSettings(algoliasearch.Map{
  "attributesToRetrieve": []string{
    "author",
    "title",
    "content",
  },
})
client.execute {
  changeSettings of "myIndex" `with` IndexSettings(
    attributesToRetrieve = Some(Seq(
      "author",
      "title",
      "content"
    ))
  )
}

Make all attributes as retrievable by default

<?php
$index->setSettings([
  'attributesToRetrieve' => [
    "*"
  ]
]);
index.set_settings({
  attributesToRetrieve: [
    '*'
  ]
})
index.setSettings({
  attributesToRetrieve: [
    '*'
  ]
});
index.set_settings({
  'attributesToRetrieve': [
    '*'
  ]
})
index.setSettings([
  "attributesToRetrieve": [
    "*"
  ]
])
index.setSettings(new JSONObject().put("attributesToRetrieve",
  new JSONArray().put("*")));
index.SetSettings(
  JObject.Parse(@"{""attributesToRetrieve"":["*"]}")
);
index.setSettings(
  new IndexSettings().setAttributesToRetrieve(Arrays.asList(
    "*"
  ))
);
res, err := index.SetSettings(algoliasearch.Map{
  "attributesToRetrieve": []string{
    "*",
  },
})
client.execute {
  changeSettings of "myIndex" `with` IndexSettings(
    replaceSynonymsInHighlight = Some(false)
  )
}
<?php
$results = $index->search('query', [
  'attributesToRetrieve' => [
    'title',
    'content'
  ]
]);
results = index.search('query', {
  attributesToRetrieve: [
    'title',
    'content'
  ]
})
index.search({
  query: 'query',
  attributesToRetrieve: [
    "title",
    "content"
  ]
}).then(res => {
  // console.log(res);
});
results = index.search('query', {
  'attributesToRetrieve': [
    'title',
    'content'
  ]
})
let query = Query(query: "query")
query.attributesToRetrieve = [
  "title",
  "content"
]

index.search(query, completionHandler: { (res, error) in
  print(res)
})
index.search(new Query("query").setAttributesToRetrieve("title", "content"));
index.SetSettings(
  JObject.Parse(@"{""attributesToRetrieve"":[""title"",""content""]}")
);
index.search(
  new Query("query").setAttributesToRetrieve(Arrays.asList(
    "title",
    "content"
  ))
);
res, err := index.Search("query", algoliasearch.Map{
  "attributesToRetrieve": []string{
    "title",
    "content",
  },
})
client.execute {
  search into "myIndex" query Query(
    query = Some("query"),
    attributesToRetrieve = Some(Seq(
      "title",
      "content"
    ))
  )
}
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