From cb5721485ad54fab7cf416ffab191620665eb663 Mon Sep 17 00:00:00 2001 From: Shisun Xia Date: Fri, 1 Feb 2019 11:30:02 -0500 Subject: [PATCH] fix --- README.md | 6 ++---- src/LaravelElasticsearchQueryBuilder.php | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8f25bcb..0ad02b2 100644 --- a/README.md +++ b/README.md @@ -273,9 +273,8 @@ The package is developed and tested under Elasticsearch ``v6.*``. It should be a ```php User::es()->whereNull('name')->get() ``` - 2. Find all users with no address + 2. Find all users who don't have address ```php - // Find the user whose name starts with 'Leo' User::es()->whereNull('Addresses')->get() ``` @@ -294,9 +293,8 @@ The package is developed and tested under Elasticsearch ``v6.*``. It should be a ```php User::es()->whereNotNull('name')->get() ``` - 2. Find all users with at least one address + 2. Find all users who have at least one address ```php - // Find the user whose name starts with 'Leo' User::es()->whereNotNull('Addresses')->get() ``` diff --git a/src/LaravelElasticsearchQueryBuilder.php b/src/LaravelElasticsearchQueryBuilder.php index ae7514f..9a54997 100644 --- a/src/LaravelElasticsearchQueryBuilder.php +++ b/src/LaravelElasticsearchQueryBuilder.php @@ -753,6 +753,9 @@ public function scroll($scroll_alive = '5m', $scroll_size = 500, $json = false) $this->scroll_size = $scroll_size; $scroll_id = $this->get()->rawResults()['_scroll_id']; $results = $this->get()->toArray(); + if($json) { + $results = [json_encode($results)]; + } while(true) { $response = $this->es_client->scroll([ 'scroll_id' => $scroll_id,