I am using v2 of the PHP SDK for interfacing requests to AWS CloudSearch. T he documentation is here , however details and examples are somewhat lacking. I need to include facets in my search. It is clearly asking for a string but it is not clear exactly how the string should be formatted.
$cloudSearchDomainClient->serach([
'filterQuery' => $filter,
'query' => $query,
'queryParser' => 'lucene',
'facet' => '???'
]);
I have tried, for example:
'facet' => 'field1,field2,field3'
'facet' => 'facet.fieldname={sort:'count',size:5}'
'facet' => 'fieldname={sort:'count',size:5}'
(Some permutations based on examples in the non-sdk request descriptions here )
The appropriate syntax appears to be a string representing a javascript object.
For the default sort/count:
'facet' => '{fieldname:{}}'
To specify sorting options:
'faceet' => '{fieldname:{'sort':'count',size:5}}'
To request multiple facets:
'facet' => '{field1:{},field2"{}}"
Etc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.