responseFields
[*]
(all fields)
'responseFields' => [ 'response_attribute', ... ]
Can be used in these methods:
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
search_for_facet_values,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browse,
searchForFacetValues,
generateSecuredApiKey,
addAPIKey,
updateAPIKey
search,
setSettings,
browseObjects,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
Browse,
SearchForFacetValues,
GenerateSecuredApiKeys,
AddApiKey,
UpdateApiKey
Search,
setSettings,
browse,
searchForFacetValues,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
BrowseObjects,
SearchForFacetValues,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
setSettings,
browse index,
search into facet values,
generateSecuredApiKey,
add key,
update key
About this parameter
Fields to include in the API response for search and browse requests.
By default, the API returns all fields. You can use this parameter to reduce the response size by excluding fields from the response.
Your search depends on the hits
field. If you omit this field, searches won’t return any results.
Your UI might also depend on other fields, for example, for pagination.
Before restricting the response size, check the impact on your search experience.
To reduce the size of each returned search result,
consider the attributesToRetrieve
parameter to reduce the number of attributes included with each result.
If you specify unknown field names, the API returns an error. If you specify an empty list, the API may return an empty response.
You can exclude these fields from the response (by not including them in the responseFields
list):
aroundLatLng
automaticRadius
exhaustive
facets
facets_stats
hits
hitsPerPage
index
length
nbHits
nbPages
offset
page
params
processingTimeMS
serverTimeMS
query
queryAfterRemoval
userData
Examples
Set fields to include in the API response for all searches
1
2
3
4
5
6
7
8
$index->setSettings([
'responseFields' => [
'hits',
'hitsPerPage',
'nbPages',
'page'
]
]);
Set fields to include in the API response for the current search
1
2
3
4
5
6
$results = $index->search('query', [
'responseFields' => [
'hits',
'facets'
]
]);