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,
GenerateSecuredApiKey,
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
Choose which fields to return in the API response. This parameters applies to search and browse queries.
This parameter’s main purpose is to limit the response size.
For example, in complex queries, retrieving all request parameters in the response’s params
field can be undesirable.
Some UI libraries such as InstantSearch may require fields from the response to function properly. Make sure to test the impact on your frontend implementation before restricting response fields in production.
Usage notes
The API returns all fields by default. When using this parameter, it only returns the specified fields.
You can also explicitly request all fields by using the *
wildcard.
Specifying an empty list or unknown field names is an error.
Here are the fields that can be filtered out:
aroundLatLng
automaticRadius
exhaustive
exhaustiveFacetsCount
(deprecated, useexhaustive
instead)facets
facets_stats
hits
hitsPerPage
index
length
nbHits
nbPages
offset
page
params
processingTimeMS
serverTimeMS
query
queryAfterRemoval
userData
Some fields can’t be filtered out:
message
warning
cursor
serverUsed
indexUsed
abTestVariantID
timeoutCounts
(deprecated, useexhaustive
instead)timeoutHits
(deprecated, useexhaustive
instead)parsedQuery
- any field triggered by
getRankingInfo
Examples
Set default fields to retrieve
1
2
3
4
5
6
7
8
$index->setSettings([
'responseFields' => [
'hits',
'hitsPerPage',
'nbPages',
'page'
]
]);
Override default fields to retrieve for the current search
1
2
3
4
5
6
$results = $index->search('query', [
'responseFields' => [
'hits',
'facets'
]
]);