我在Elasticsearch中有一个返回400条记录的数组:
$result = $search->search($keyword);
echo "<pre>"; print_r($result); exit;
我正在运行$results
的foreach循环来显示。如何添加Elasticsearch的分页?
下面是搜索代码:
$params = [
'index' => $this->client->getIndex(),
'type' => $this->client->getType(),
"from" => 0, "size" => 100,
"scroll" => "1m",
'body' => [
"query" => [
"bool" => [
"must" => [
[
"multi_match" => [
"fields" => ["prod_name", "prod_seo_name"],
"type" => "phrase_prefix",
"query" => $query
]
],
[
"term"=> ["cat_type_id"=>1]
]
]
]
]
],
];
在BD中查询返回400条记录,但弹性搜索在我添加大小时给出100。如何滚动到另一页?