From fe1923e27abe06fa3571610c218da410f2c10c39 Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Thu, 30 Nov 2017 23:18:59 +0100 Subject: [PATCH 1/2] rebuild docs --- docs/build/Elasticsearch/Client.asciidoc | 22 ---------------------- docs/build/renderer.index | 2 +- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/docs/build/Elasticsearch/Client.asciidoc b/docs/build/Elasticsearch/Client.asciidoc index ec49e7197..df40b8c41 100644 --- a/docs/build/Elasticsearch/Client.asciidoc +++ b/docs/build/Elasticsearch/Client.asciidoc @@ -46,7 +46,6 @@ The class defines the following methods: * <> * <> * <> -* <> * <> * <> * <> @@ -1033,27 +1032,6 @@ $response = $client->deleteTemplate($params); -[[Elasticsearch_ClientputTemplate_putTemplate]] -.`putTemplate()` -**** -[source,php] ----- -/* -$params['id'] = (string) The search template ID (Required) - ['body'] = (array) Request body -*/ - -$params = [ - // ... -]; - -$client = ClientBuilder::create()->build(); -$response = $client->putTemplate($params); ----- -**** - - - [[Elasticsearch_ClientfieldStats_fieldStats]] .`fieldStats()` **** diff --git a/docs/build/renderer.index b/docs/build/renderer.index index 64af672be..1756fe315 100644 --- a/docs/build/renderer.index +++ b/docs/build/renderer.index @@ -1 +1 @@ -C:19:"Sami\Renderer\Index":1041:{a:3:{i:0;a:10:{s:20:"Elasticsearch\Client";s:40:"6ac4061ad03df8cddeaec31a8bfb556fc7a33e71";s:27:"Elasticsearch\ClientBuilder";s:40:"30fa910e5653bf5f7096369ef1529a47da7e3e92";s:37:"Elasticsearch\Namespaces\CatNamespace";s:40:"a9d466909dc08564e9c1516162c3a6bb91dbecbe";s:41:"Elasticsearch\Namespaces\ClusterNamespace";s:40:"577bab662735319b93ed7b555cd2b12b73e40680";s:41:"Elasticsearch\Namespaces\IndicesNamespace";s:40:"66391991c19f28764c86e9604e231b9ce004c82e";s:40:"Elasticsearch\Namespaces\IngestNamespace";s:40:"9bd2962d80e3c0cdcaedda4f23b722b3a8cfa013";s:39:"Elasticsearch\Namespaces\NodesNamespace";s:40:"da4e71f9d953d00600920c26fe585b6884e45f94";s:40:"Elasticsearch\Namespaces\RemoteNamespace";s:40:"a503f6ea82452e1ea0275a044aeb527bc946616d";s:42:"Elasticsearch\Namespaces\SnapshotNamespace";s:40:"e28a1807789b0fcca3fd6b9712ed713650cf7ac2";s:39:"Elasticsearch\Namespaces\TasksNamespace";s:40:"2de86d7ab409a629320725f6444c76d2a9313c72";}i:1;a:1:{i:0;s:6:"master";}i:2;a:2:{i:0;s:13:"Elasticsearch";i:1;s:24:"Elasticsearch\Namespaces";}}} \ No newline at end of file +C:19:"Sami\Renderer\Index":1041:{a:3:{i:0;a:10:{s:20:"Elasticsearch\Client";s:40:"1815e70d1a9613e61fbe3bf14e3c77e4321c3b31";s:27:"Elasticsearch\ClientBuilder";s:40:"ad98dc30739ff572ed4fec91ea08248807f3f8a5";s:37:"Elasticsearch\Namespaces\CatNamespace";s:40:"a9d466909dc08564e9c1516162c3a6bb91dbecbe";s:41:"Elasticsearch\Namespaces\ClusterNamespace";s:40:"577bab662735319b93ed7b555cd2b12b73e40680";s:41:"Elasticsearch\Namespaces\IndicesNamespace";s:40:"66391991c19f28764c86e9604e231b9ce004c82e";s:40:"Elasticsearch\Namespaces\IngestNamespace";s:40:"9bd2962d80e3c0cdcaedda4f23b722b3a8cfa013";s:39:"Elasticsearch\Namespaces\NodesNamespace";s:40:"da4e71f9d953d00600920c26fe585b6884e45f94";s:40:"Elasticsearch\Namespaces\RemoteNamespace";s:40:"a503f6ea82452e1ea0275a044aeb527bc946616d";s:42:"Elasticsearch\Namespaces\SnapshotNamespace";s:40:"e28a1807789b0fcca3fd6b9712ed713650cf7ac2";s:39:"Elasticsearch\Namespaces\TasksNamespace";s:40:"2de86d7ab409a629320725f6444c76d2a9313c72";}i:1;a:1:{i:0;s:6:"master";}i:2;a:2:{i:0;s:13:"Elasticsearch";i:1;s:24:"Elasticsearch\Namespaces";}}} \ No newline at end of file From f8ddeca8d1eca62636de997d14a2f79c612a12cf Mon Sep 17 00:00:00 2001 From: Martin Hujer Date: Tue, 7 Nov 2017 21:47:08 +0100 Subject: [PATCH 2/2] drop Monolog dependency from ClientBuilder --- BREAKING_CHANGES.md | 4 ++- .../Elasticsearch/ClientBuilder.asciidoc | 14 --------- docs/build/renderer.index | 2 +- docs/configuration.asciidoc | 29 +------------------ src/Elasticsearch/ClientBuilder.php | 14 --------- 5 files changed, 5 insertions(+), 58 deletions(-) diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index fbba874a0..3fbc0d3ce 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -1,4 +1,6 @@ # 6.0 - [Search Templates]: PutTemplate endpoint has been removed (see [Elasticsearch Breaking Changes](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking_60_scripting_changes.html#_stored_search_template_apis_removed)), -use PutScript instead. \ No newline at end of file +use PutScript instead. + +- [#674](https://github.com/elastic/elasticsearch-php/pull/674) `ClientBuilder::defaultLogger()` method was removed. It is recommended to [create the logger object manually](https://github.com/elastic/elasticsearch-php/blob/master/docs/configuration.asciidoc#enabling-the-logger). diff --git a/docs/build/Elasticsearch/ClientBuilder.asciidoc b/docs/build/Elasticsearch/ClientBuilder.asciidoc index d8304cbe9..9f815e7e4 100644 --- a/docs/build/Elasticsearch/ClientBuilder.asciidoc +++ b/docs/build/Elasticsearch/ClientBuilder.asciidoc @@ -20,7 +20,6 @@ The class defines the following methods: * <> * <> * <> -* <> * <> * <> * <> @@ -157,19 +156,6 @@ corresponds to setConnectionPool(). -[[Elasticsearch_ClientBuilderdefaultLogger_defaultLogger]] -.`defaultLogger()` -**** -[source,php] ----- -/* -*/ - ----- -**** - - - [[Elasticsearch_ClientBuildersetConnectionFactory_setConnectionFactory]] .`setConnectionFactory()` **** diff --git a/docs/build/renderer.index b/docs/build/renderer.index index 1756fe315..f2bb86557 100644 --- a/docs/build/renderer.index +++ b/docs/build/renderer.index @@ -1 +1 @@ -C:19:"Sami\Renderer\Index":1041:{a:3:{i:0;a:10:{s:20:"Elasticsearch\Client";s:40:"1815e70d1a9613e61fbe3bf14e3c77e4321c3b31";s:27:"Elasticsearch\ClientBuilder";s:40:"ad98dc30739ff572ed4fec91ea08248807f3f8a5";s:37:"Elasticsearch\Namespaces\CatNamespace";s:40:"a9d466909dc08564e9c1516162c3a6bb91dbecbe";s:41:"Elasticsearch\Namespaces\ClusterNamespace";s:40:"577bab662735319b93ed7b555cd2b12b73e40680";s:41:"Elasticsearch\Namespaces\IndicesNamespace";s:40:"66391991c19f28764c86e9604e231b9ce004c82e";s:40:"Elasticsearch\Namespaces\IngestNamespace";s:40:"9bd2962d80e3c0cdcaedda4f23b722b3a8cfa013";s:39:"Elasticsearch\Namespaces\NodesNamespace";s:40:"da4e71f9d953d00600920c26fe585b6884e45f94";s:40:"Elasticsearch\Namespaces\RemoteNamespace";s:40:"a503f6ea82452e1ea0275a044aeb527bc946616d";s:42:"Elasticsearch\Namespaces\SnapshotNamespace";s:40:"e28a1807789b0fcca3fd6b9712ed713650cf7ac2";s:39:"Elasticsearch\Namespaces\TasksNamespace";s:40:"2de86d7ab409a629320725f6444c76d2a9313c72";}i:1;a:1:{i:0;s:6:"master";}i:2;a:2:{i:0;s:13:"Elasticsearch";i:1;s:24:"Elasticsearch\Namespaces";}}} \ No newline at end of file +C:19:"Sami\Renderer\Index":1041:{a:3:{i:0;a:10:{s:20:"Elasticsearch\Client";s:40:"1815e70d1a9613e61fbe3bf14e3c77e4321c3b31";s:27:"Elasticsearch\ClientBuilder";s:40:"824023c8ff5d33cd7085f75ff88b436b5dde0482";s:37:"Elasticsearch\Namespaces\CatNamespace";s:40:"a9d466909dc08564e9c1516162c3a6bb91dbecbe";s:41:"Elasticsearch\Namespaces\ClusterNamespace";s:40:"577bab662735319b93ed7b555cd2b12b73e40680";s:41:"Elasticsearch\Namespaces\IndicesNamespace";s:40:"66391991c19f28764c86e9604e231b9ce004c82e";s:40:"Elasticsearch\Namespaces\IngestNamespace";s:40:"9bd2962d80e3c0cdcaedda4f23b722b3a8cfa013";s:39:"Elasticsearch\Namespaces\NodesNamespace";s:40:"da4e71f9d953d00600920c26fe585b6884e45f94";s:40:"Elasticsearch\Namespaces\RemoteNamespace";s:40:"a503f6ea82452e1ea0275a044aeb527bc946616d";s:42:"Elasticsearch\Namespaces\SnapshotNamespace";s:40:"e28a1807789b0fcca3fd6b9712ed713650cf7ac2";s:39:"Elasticsearch\Namespaces\TasksNamespace";s:40:"2de86d7ab409a629320725f6444c76d2a9313c72";}i:1;a:1:{i:0;s:6:"master";}i:2;a:2:{i:0;s:13:"Elasticsearch";i:1;s:24:"Elasticsearch\Namespaces";}}} \ No newline at end of file diff --git a/docs/configuration.asciidoc b/docs/configuration.asciidoc index e159eee67..19845a27b 100644 --- a/docs/configuration.asciidoc +++ b/docs/configuration.asciidoc @@ -180,34 +180,7 @@ And then update your composer installation: php composer.phar update ---------------------------- -Once Monolog (or another logger) is installed, you need to create a log object and inject it into the client. The -`ClientBuilder` object has a helper static function that will generate a common Monolog-based logger for you. All you need -to do is provide the path to your desired logging location: - -[source,php] ----- -$logger = ClientBuilder::defaultLogger('path/to/your.log'); - -$client = ClientBuilder::create() // Instantiate a new ClientBuilder - ->setLogger($logger) // Set the logger with a default logger - ->build(); // Build the client object ----- - -You can also specify the severity of log messages that you wish to log: - -[source,php] ----- -// set severity with second parameter -$logger = ClientBuilder::defaultLogger('/path/to/logs/', Logger::INFO); - -$client = ClientBuilder::create() // Instantiate a new ClientBuilder - ->setLogger($logger) // Set the logger with a default logger - ->build(); // Build the client object ----- - -The `defaultLogger()` method is just a helper, you are not required to use it. You can create your own logger and inject -that instead: - +Once Monolog (or another logger) is installed, you need to create a log object and inject it into the client: [source,php] ---- diff --git a/src/Elasticsearch/ClientBuilder.php b/src/Elasticsearch/ClientBuilder.php index 41029a09e..c4d2df778 100644 --- a/src/Elasticsearch/ClientBuilder.php +++ b/src/Elasticsearch/ClientBuilder.php @@ -212,20 +212,6 @@ public static function singleHandler() } } - /** - * @param $path string - * @param int $level - * @return \Monolog\Logger\Logger - */ - public static function defaultLogger($path, $level = Logger::WARNING) - { - $log = new Logger('log'); - $handler = new StreamHandler($path, $level); - $log->pushHandler($handler); - - return $log; - } - /** * @param \Elasticsearch\Connections\ConnectionFactoryInterface $connectionFactory * @return $this