diff --git a/CHANGELOG.md b/CHANGELOG.md index a68ebaff96..8dd8b12347 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,23 @@ # Change Log 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/ruflin/Elastica/compare/5.1.0...master) +## [Unreleased](https://github.com/ruflin/Elastica/compare/5.2.0...master) ### Backward Compatibility Breaks ### Bugfixes +### Added + +### Improvements + +### Deprecated + + +## [Unreleased](https://github.com/ruflin/Elastica/compare/5.1.0...5.2.0) + +### Bugfixes + - Fix reading bool index settings like `\Elastica\Index\Settings::getBlocksWrite`. Elasticsearch returns all settings as strings and does not normalize bool values. The getters now return the right bool value for whichever string representation is used like 'true', '1', 'on', 'yes'. [#1251](https://github.com/ruflin/Elastica/pull/1251) - Fix for QueryBuilder version check `\Elastica\QueryBuilder\Version\Version240.php` added all new query types to queries array. [#1266](https://github.com/ruflin/Elastica/pull/1266) [#1269](https://github.com/ruflin/Elastica/pull/1269) diff --git a/composer.json b/composer.json index 02160b58f8..d6a3c13090 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ }, "extra": { "branch-alias": { - "dev-master": "5.1.x-dev" + "dev-master": "5.2.x-dev" } } } diff --git a/lib/Elastica/Client.php b/lib/Elastica/Client.php index 50928ed89b..bfab017a85 100644 --- a/lib/Elastica/Client.php +++ b/lib/Elastica/Client.php @@ -690,9 +690,10 @@ public function request($path, $method = Request::GET, $data = [], array $query } /** - * Makes calls to the elasticsearch server with usage official client Endpoint + * Makes calls to the elasticsearch server with usage official client Endpoint. * * @param AbstractEndpoint $endpoint + * * @return Response */ public function requestEndpoint(AbstractEndpoint $endpoint) diff --git a/lib/Elastica/Cluster/Health.php b/lib/Elastica/Cluster/Health.php index bef416cbd5..b490d37edc 100644 --- a/lib/Elastica/Cluster/Health.php +++ b/lib/Elastica/Cluster/Health.php @@ -3,7 +3,6 @@ use Elastica\Client; use Elastica\Cluster\Health\Index; -use Elastica\Request; /** * Elastic cluster health. diff --git a/lib/Elastica/Index.php b/lib/Elastica/Index.php index 9ea9178e5f..e6c3477f33 100644 --- a/lib/Elastica/Index.php +++ b/lib/Elastica/Index.php @@ -526,6 +526,7 @@ public function setSettings(array $data) { $endpoint = new Put(); $endpoint->setBody($data); + return $this->requestEndpoint($endpoint); } @@ -547,15 +548,17 @@ public function request($path, $method, $data = [], array $query = []) } /** - * Makes calls to the elasticsearch server with usage official client Endpoint based on this index + * Makes calls to the elasticsearch server with usage official client Endpoint based on this index. * * @param AbstractEndpoint $endpoint + * * @return Response */ public function requestEndpoint(AbstractEndpoint $endpoint) { $cloned = clone $endpoint; $cloned->setIndex($this->getName()); + return $this->getClient()->requestEndpoint($cloned); } diff --git a/lib/Elastica/Index/Stats.php b/lib/Elastica/Index/Stats.php index 8b76644a08..e2d5257b90 100644 --- a/lib/Elastica/Index/Stats.php +++ b/lib/Elastica/Index/Stats.php @@ -2,7 +2,6 @@ namespace Elastica\Index; use Elastica\Index as BaseIndex; -use Elastica\Request; /** * Elastica index stats object. diff --git a/lib/Elastica/Node/Info.php b/lib/Elastica/Node/Info.php index 9fe7ce8b64..6b81167a15 100644 --- a/lib/Elastica/Node/Info.php +++ b/lib/Elastica/Node/Info.php @@ -2,7 +2,6 @@ namespace Elastica\Node; use Elastica\Node as BaseNode; -use Elastica\Request; /** * Elastica cluster node object. diff --git a/lib/Elastica/Node/Stats.php b/lib/Elastica/Node/Stats.php index dfeda8e792..85134de00d 100644 --- a/lib/Elastica/Node/Stats.php +++ b/lib/Elastica/Node/Stats.php @@ -2,7 +2,6 @@ namespace Elastica\Node; use Elastica\Node as BaseNode; -use Elastica\Request; /** * Elastica cluster node object. diff --git a/lib/Elastica/Query.php b/lib/Elastica/Query.php index 515abdd15e..fa60b5cb4b 100644 --- a/lib/Elastica/Query.php +++ b/lib/Elastica/Query.php @@ -3,7 +3,6 @@ use Elastica\Aggregation\AbstractAggregation; use Elastica\Exception\InvalidException; -use Elastica\Exception\NotImplementedException; use Elastica\Query\AbstractQuery; use Elastica\Query\MatchAll; use Elastica\Query\QueryString; diff --git a/lib/Elastica/Scroll.php b/lib/Elastica/Scroll.php index 66860674ec..7b5fd1424d 100644 --- a/lib/Elastica/Scroll.php +++ b/lib/Elastica/Scroll.php @@ -32,7 +32,7 @@ class Scroll implements \Iterator /** * 0: scroll
- * 1: scroll id + * 1: scroll id. * * @var array */ @@ -142,7 +142,7 @@ public function rewind() protected function _setScrollId(ResultSet $resultSet) { $this->_currentResultSet = $resultSet; - $this->currentPage++; + ++$this->currentPage; $this->totalPages = $resultSet->count() > 0 ? ceil($resultSet->getTotalHits() / $resultSet->count()) : 0; $this->_nextScrollId = $resultSet->getResponse()->isOk() ? $resultSet->getResponse()->getScrollId() : null; } diff --git a/lib/Elastica/Search.php b/lib/Elastica/Search.php index c7a33d17d7..97bf5a8c29 100755 --- a/lib/Elastica/Search.php +++ b/lib/Elastica/Search.php @@ -291,7 +291,7 @@ protected function _validateOption($key) case self::OPTION_SEARCH_IGNORE_UNAVAILABLE: case self::OPTION_QUERY_CACHE: case self::OPTION_TERMINATE_AFTER: - case self::OPTION_SHARD_REQUEST_CACHE: + case self::OPTION_SHARD_REQUEST_CACHE: return true; } diff --git a/lib/Elastica/Type.php b/lib/Elastica/Type.php index ea9f975cc2..3c4cf9cf89 100644 --- a/lib/Elastica/Type.php +++ b/lib/Elastica/Type.php @@ -508,15 +508,17 @@ public function request($path, $method, $data = [], array $query = []) } /** - * Makes calls to the elasticsearch server with usage official client Endpoint based on this type + * Makes calls to the elasticsearch server with usage official client Endpoint based on this type. * * @param AbstractEndpoint $endpoint + * * @return Response */ public function requestEndpoint(AbstractEndpoint $endpoint) { $cloned = clone $endpoint; $cloned->setType($this->getName()); + return $this->getIndex()->requestEndpoint($cloned); } diff --git a/lib/Elastica/Type/Mapping.php b/lib/Elastica/Type/Mapping.php index 3f95384ed2..8aeb92840f 100644 --- a/lib/Elastica/Type/Mapping.php +++ b/lib/Elastica/Type/Mapping.php @@ -2,7 +2,6 @@ namespace Elastica\Type; use Elastica\Exception\InvalidException; -use Elastica\Request; use Elastica\Type; use Elasticsearch\Endpoints\Indices\Mapping\Put; diff --git a/test/Elastica/IndexTest.php b/test/Elastica/IndexTest.php index 26bf921d33..dac283d6de 100644 --- a/test/Elastica/IndexTest.php +++ b/test/Elastica/IndexTest.php @@ -923,8 +923,8 @@ public function testRequestEndpoint() $index = $this->_createIndex(); $index->refresh(); $endpoint = new Analyze(); - $endpoint->setIndex("fooIndex"); - $endpoint->setBody("foo"); + $endpoint->setIndex('fooIndex'); + $endpoint->setBody('foo'); $returnedTokens = $index->requestEndpoint($endpoint)->getData()['tokens']; $tokens = [ diff --git a/test/Elastica/TypeTest.php b/test/Elastica/TypeTest.php index eb343762c1..c5b1a8cc8e 100644 --- a/test/Elastica/TypeTest.php +++ b/test/Elastica/TypeTest.php @@ -970,7 +970,7 @@ public function testGetMappingAlias() public function testRequestEndpoint() { $index = $this->_createIndex(); - $type = new Type($index, "foo"); + $type = new Type($index, 'foo'); $mapping = new Mapping($type, $expect = [ 'id' => ['type' => 'integer', 'store' => true], @@ -978,8 +978,8 @@ public function testRequestEndpoint() $type->setMapping($mapping); $endpoint = new Get(); - $endpoint->setIndex("nonExistsIndex"); - $endpoint->setType("nonExistsType"); + $endpoint->setIndex('nonExistsIndex'); + $endpoint->setType('nonExistsType'); $response = $type->requestEndpoint($endpoint); $data = $response->getData();