Reputation: 603
I have a simple part of code in laravel Elasticquent:
$laws = Law::searchByQuery([
'multi_match' => [
'query' => Input::get('query', ''),
'fields' => [ "law_name", "law_year", "law_raw_content"],
],
]);
I want to set a size parameter. I tried:
$laws = Law::searchByQuery([
'multi_match' => [
'query' => Input::get('query', ''),
'fields' => [ "law_name", "law_year", "law_raw_content"],
'size' => 100,
],
]);
But no luck. Can anyone help?
Upvotes: 0
Views: 361
Reputation: 217544
From the Elasticquent documentation, the searchByQuery
function takes the following parameters (see source here):
query
- Your ElasticSearch Queryaggregations
- The Aggregations you wish to return.sourceFields
- Limits returned set to the selected fields onlylimit
- Number of records to returnoffset
- Sets the record offset (use for paging results)sort
- Your sort queryIn your call, you simply need to include the $limit
parameter (fourth parameter) in addition to your query (first parameter). Do it like this instead:
$laws = Law::searchByQuery([
'multi_match' => [
'query' => Input::get('query', ''),
'fields' => [ "law_name", "law_year", "law_raw_content"]
],
], null, null, 100);
^
|
add the size here
Upvotes: 2