Skip to content

Commit

Permalink
Merge pull request #93 from kununu/version_6_0_1
Browse files Browse the repository at this point in the history
Send scroll_id in the body of the request in Repository::findByScrollId
  • Loading branch information
hugo-goncalves-kununu authored Nov 27, 2023
2 parents 8271b29 + 4628ce1 commit 555e4bb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 11 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file based on
the [Keep a Changelog](http://keepachangelog.com/) Standard. This project adheres
to [Semantic Versioning](http://semver.org/).

## [Unreleased](https://github.com/kununu/elasticsearch/compare/v6.0.0...master)
## [Unreleased](https://github.com/kununu/elasticsearch/compare/v6.0.1...master)

### Backward Compatibility Breaks

Expand All @@ -16,6 +16,20 @@ to [Semantic Versioning](http://semver.org/).

### Deprecated

## [6.0.1](https://github.com/kununu/elasticsearch/compare/v6.0.1...v6.0.0)

### Backward Compatibility Breaks

### Bugfixes

### Added

### Improvements

* Send `scroll_id` in the body of the request in `Repository::findByScrollId` to get rid of deprecation notices

### Deprecated

## [6.0.0](https://github.com/kununu/elasticsearch/compare/v5.2.0...v6.0.0)

### Backward Compatibility Breaks
Expand Down
4 changes: 3 additions & 1 deletion src/Repository/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ public function findByScrollId(
return $this->executeRead(
fn() => $this->parseRawSearchResponse(
$this->client->scroll([
'scroll_id' => $scrollId,
'body' => [
'scroll_id' => $scrollId,
],
'scroll' => $scrollContextKeepalive ?: $this->config->getScrollContextKeepalive(),
])
)
Expand Down
28 changes: 19 additions & 9 deletions tests/Repository/RepositoryFindByScrollIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ public function testFindByScrollId(array $esResult, mixed $endResult): void
->expects($this->once())
->method('scroll')
->with([
'scroll_id' => $scrollId,
'scroll' => RepositoryConfiguration::DEFAULT_SCROLL_CONTEXT_KEEPALIVE,
'body' => [
'scroll_id' => $scrollId,
],
'scroll' => RepositoryConfiguration::DEFAULT_SCROLL_CONTEXT_KEEPALIVE,
])
->willReturn($esResult);

Expand All @@ -42,8 +44,10 @@ public function testFindByScrollIdCanOverrideScrollContextKeepalive(array $esRes
->expects($this->once())
->method('scroll')
->with([
'scroll_id' => $scrollId,
'scroll' => $keepalive,
'body' => [
'scroll_id' => $scrollId,
],
'scroll' => $keepalive,
])
->willReturn($esResult);

Expand All @@ -65,8 +69,10 @@ public function testFindByScrollIdWithEntityFactory(array $esResult, array $endR
->expects($this->once())
->method('scroll')
->with([
'scroll_id' => $scrollId,
'scroll' => RepositoryConfiguration::DEFAULT_SCROLL_CONTEXT_KEEPALIVE,
'body' => [
'scroll_id' => $scrollId,
],
'scroll' => RepositoryConfiguration::DEFAULT_SCROLL_CONTEXT_KEEPALIVE,
])
->willReturn(array_merge($esResult, ['_scroll_id' => $scrollId]));

Expand Down Expand Up @@ -96,8 +102,10 @@ public function testFindByScrollIdWithEntityClass(array $esResult, array $endRes
->expects($this->once())
->method('scroll')
->with([
'scroll_id' => $scrollId,
'scroll' => RepositoryConfiguration::DEFAULT_SCROLL_CONTEXT_KEEPALIVE,
'body' => [
'scroll_id' => $scrollId,
],
'scroll' => RepositoryConfiguration::DEFAULT_SCROLL_CONTEXT_KEEPALIVE,
])
->willReturn(array_merge($esResult, ['_scroll_id' => $scrollId]));

Expand Down Expand Up @@ -128,7 +136,9 @@ public function testFindByScrollIdFails(): void
->expects($this->once())
->method('scroll')
->with([
'scroll_id' => $scrollId,
'body' => [
'scroll_id' => $scrollId,
],
'scroll' => RepositoryConfiguration::DEFAULT_SCROLL_CONTEXT_KEEPALIVE,
])
->willThrowException(new Exception(self::ERROR_MESSAGE));
Expand Down

0 comments on commit 555e4bb

Please sign in to comment.