弹性搜索中的分页

2 pagination elasticsearch laravel

我正在使用shift31/laravel-elasticsearch:~1.0.我想在我的列表页面上实现分页.

搜索代码:

   $params = [
        'index' => 'my_index',
        'type' => 'product',
        'body' =>  [
                       'query'=>[
                                 'match'=>[
                                           'category'=>$category
                                          ]
                                 ]
                   ];
   ];
  $response = \Es::Search($params);
Run Code Online (Sandbox Code Playgroud)

如何在上面的查询中使用分页?

更新:

我在查询页面中使用了和大小但是如何在视图页面中给出分页链接?以及如何通过点击页面来更新?

Vee*_*rra 7

在存储库中

 $params = [
        'index' => 'my_index',
        'type' => 'product',
          'size' = $per_page;
          'from' = $from;
        'body' =>  [
                       'query'=>[
                                 'match'=>[
                                           'category'=>$category
                                          ]
                                 ]
                   ];
   ];

$response = \Es::Search($params);
 $access = $response['hits'];
        return $access;
Run Code Online (Sandbox Code Playgroud)

我在控制器中设置$ per_page和$

$per_page = $request->get('limit', 10);
    $from = ($request->get('page', 1) - 1) * $per_page;
    $access = $this->repository->Index($per_page, $from);

    $admin_exceptions = new LengthAwarePaginator(
            $access['hits'],
            $access['total'],
            $per_page,
            Paginator::resolveCurrentPage(),
            ['path' => Paginator::resolveCurrentPath()]);
 return view('adminexception.index', compact('admin_exceptions'))->withInput($request->all());
Run Code Online (Sandbox Code Playgroud)

现在在视图{{!! $ admin_exceptions-> render()!!}}中使用渲染