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
searchAsync,
setSettingsAsync,
browseAsync,
searchForFacetValues
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 the response will contain. Applies to search and browse queries.
This parameter is mainly intended to limit the response size.
For example, in complex queries, echoing of request parameters in the
response’s params
field can be undesirable.
Usage notes:
-
By default, all fields are returned. If this parameter is specified, only the fields explicitly listed will be returned, unless
*
is used, in which case all fields are returned. Specifying an empty list or unknown field names is an error. -
List of fields that can be filtered out:
aroundLatLng
automaticRadius
exhaustiveFacetsCount
facets
facets_stats
hits
hitsPerPage
index
length
nbHits
nbPages
offset
page
params
processingTimeMS
query
queryAfterRemoval
userData
-
List of fields that cannot be filtered out:
message
warning
cursor
serverUsed
indexUsed
abTestVariantID
timeoutCounts
(deprecated, please useexhaustiveFacetsCount
instead)timeoutHits
(deprecated, please useexhaustiveFacetsCount
instead)parsedQuery
- all fields 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'
]
]);