Api reference icon

attributesToRetrieve

attributesToRetrieve

scope settings search
type array of strings
default * (all attributes)
formerly known as attributes
description

List of object attributes you want to retrieve.

This can be used to minimize the size of the response.

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{
        "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"
      ))
  )
}