diff --git a/CHANGELOG-7.0.md b/CHANGELOG-7.0.md index ecc5f7eaf..ba94add78 100644 --- a/CHANGELOG-7.0.md +++ b/CHANGELOG-7.0.md @@ -1,3 +1,11 @@ +CHANGELOG for 7.x +=================== + +This changelog references the relevant changes (bug and security fixes) done +in 7.x versions. + +### 7.0.0-BETA1 (2025-0X-XX) + * Dropped support for PHP 7.4 and PHP 8.0. * Dropped support for Symfony 5.4. * **[BC break]** Method `FOS\ElasticaBundle\Elastica\Client::request` does not exist anymore. Please use `FOS\ElasticaBundle\Elastica\Client::sendRequest`. @@ -6,3 +14,13 @@ * **[BC break]** Client configuration now reflects configuration of `Elastica\Client`. * **[BC break]** Index template configuration `index_template` option `template` is renamed to `index_patterns` and accepts array of strings. * **[BC break]** Arguments for the service `FOS\ElasticaBundle\Elastica\Client` (`fos_elastica.client..`) are now named, instead of indexed. +* **[BC break]** Configuration options: `host`, `port`, `url` are no longer available and replaced with single `hosts`. +* **[BC break]** Configuration options: `proxy`, `auth_type`, `aws_*`, `ssl`, `curl`, `persistent`, `compression`, `connectTimeout` are no longer available. +* **[BC break]** Configuration `connectionStrategy` is renamed to `connection_strategy`. + +Main change is the configuration of the bundle: +* There are no `connections` level anymore. +* Options `host`, `port` and `url` are replaced with option `hosts`, which accepts array. +* SSL configuration is provided within `client_config` option. +* Other client options are configurable in `client_options`. +* Refer to new examples! [Elastica HTTP client configuration](doc/cookbook/elastica-http-client-configuration.md) diff --git a/README.md b/README.md index 08d265349..cc6357790 100644 --- a/README.md +++ b/README.md @@ -28,14 +28,15 @@ Installation instructions can be found in the [documentation](doc/setup.md) Versions & Dependencies ----------------------- -Version 6 of the FOSElasticaBundle is compatible with Elasticsearch 7. It requires Symfony 5.4 or greater. When using +Version 7 of the FOSElasticaBundle is compatible with Elasticsearch 8. It requires Symfony 6.4 or greater. When using Symfony Flex there is also a [recipe to ease the setup](https://github.com/symfony/recipes-contrib/tree/master/friendsofsymfony/elastica-bundle/5.0). Earlier versions of the FOSElasticaBundle are not maintained anymore and only work with older versions of the dependencies. The following table shows the compatibilities of different versions of the bundle. -| FOSElasticaBundle | Elastica | Elasticsearch | Symfony | PHP | -| --------------------------------------------------------------------------------------- | ---------| ------------- | ---------- | ----- | -| [6.5] (master) | ^7.1 | 7.\* | ^5.4\|^6.4\|^7.1 | ^7.4\|^8.1 | +| FOSElasticaBundle | Elastica | Elasticsearch | Symfony | PHP | +|-------------------|----------|---------------| ---------- | ----- | +| [6.5] (6.5) | ^7.1 | 7.\* | ^5.4\|^6.4\|^7.1 | ^7.4\|^8.1 | +| [7.0] (master) | ^8.0 | 8.\* | ^6.4\|^7.1 | ^8.1 | License ------- diff --git a/doc/cookbook/compression.md b/doc/cookbook/compression.md deleted file mode 100644 index 0b73e5b61..000000000 --- a/doc/cookbook/compression.md +++ /dev/null @@ -1,13 +0,0 @@ -HTTP compression -========================================== - -By default, FOSElasticaBundle and Elastica do not compress the HTTP request but you can do it with a simple configuration: - -```yaml -# app/config/config.yml -fos_elastica: - clients: - default: - host: example.com - compression: true -``` diff --git a/doc/cookbook/custom-repositories.md b/doc/cookbook/custom-repositories.md index 6c91404d5..04c083eda 100644 --- a/doc/cookbook/custom-repositories.md +++ b/doc/cookbook/custom-repositories.md @@ -26,7 +26,7 @@ To use the custom repository specify it in the mapping for the entity: ```yaml fos_elastica: clients: - default: { host: localhost, port: 9200 } + default: { hosts: ['http://localhost:9200'] } indexes: user: client: default diff --git a/doc/cookbook/elastica-http-client-configuration.md b/doc/cookbook/elastica-http-client-configuration.md index f606ec183..4599a30d6 100644 --- a/doc/cookbook/elastica-http-client-configuration.md +++ b/doc/cookbook/elastica-http-client-configuration.md @@ -14,26 +14,61 @@ They can be set using the `headers` configuration key: fos_elastica: clients: default: - host: example.com - port: 80 + hosts: ['http://example.com:80'] headers: Authorization: "Basic jdumrGK7rY9TMuQOPng7GZycmxyMHNoir==" ``` -Setting cURL options +HTTP Authentication -------------------- -It may be necessary to set cURL options on the Elastica client. +It may be necessary to set HTTP Basic authorization on the Elastica client. -They can be set using the `curl` configuration key: +They can be set using the `username` and `password` configuration keys: ```yaml # app/config/config.yml fos_elastica: clients: default: - host: example.com - port: 80 - curl: - !php/const \CURLOPT_SSL_VERIFYPEER: false + hosts: ['http://example.com:80'] + username: 'The_user' + password: 'Password!' +``` + +Setting SSL options +-------------------- + +It may be necessary to set SSL options on the Elastica client. These options are the same for Guzzle and Symfony HttpClient. + +They can be set using the `client_config` configuration key and following 4 options: + +```yaml +# app/config/config.yml +fos_elastica: + clients: + default: + hosts: ['http://example.com:80'] + client_config: + ssl_cert: 'certificate' + ssl_key: 'ssl key' + ssl_verify: true + ssl_ca: 'path/to/http_ca.crt' +``` + +Setting other client options +-------------------- + +Any other client option for Elastica client can be set using the `client_options` configuration key: + +```yaml +# app/config/config.yml +fos_elastica: + clients: + default: + hosts: ['http://example.com:80'] + client_options: + !php/const \CURLOPT_RANDOM_FILE: /dev/urandom + proxy: 'http://localhost:8125' + connect_timeout: 10 # if using Guzzle ``` diff --git a/doc/cookbook/http-auth-for-elastica.md b/doc/cookbook/http-auth-for-elastica.md index 42cf1ea2d..afc19859c 100644 --- a/doc/cookbook/http-auth-for-elastica.md +++ b/doc/cookbook/http-auth-for-elastica.md @@ -10,8 +10,7 @@ They can be set using the username and password configuration keys: fos_elastica: clients: default: - host: example.com - port: 80 + hosts: ['http://example.com:80'] username: 'username' password: 'password' ``` diff --git a/doc/cookbook/logging.md b/doc/cookbook/logging.md index 18e5d645b..54e4a2e13 100644 --- a/doc/cookbook/logging.md +++ b/doc/cookbook/logging.md @@ -15,7 +15,7 @@ service you wish to use. fos_elastica: clients: default: - host: example.com + hosts: ['http://example.com:80'] logger: true ``` @@ -30,6 +30,6 @@ specifying the service id of the logger you wish to use. fos_elastica: clients: default: - host: example.com + hosts: ['http://example.com:80'] logger: 'acme.custom.logger' ``` diff --git a/doc/cookbook/multiple-connections.md b/doc/cookbook/multiple-connections.md index 954435994..211c5dd7b 100644 --- a/doc/cookbook/multiple-connections.md +++ b/doc/cookbook/multiple-connections.md @@ -8,14 +8,12 @@ multiple connections in the client configuration: fos_elastica: clients: default: - connections: - - url: http://es1.example.net:9200 - - url: http://es2.example.net:9200 + hosts: ['http://es1.example.net:9200', 'http://es2.example.net:9200'] connection_strategy: RoundRobin ``` Elastica allows for definition of different connection strategies and by default -supports `RoundRobin` and `Simple`. You can see definitions for these strategies -in the `Elastica\Connection\Strategy` namespace. +supports `RoundRobin`, `RoundRobinNoResurrect` and `Simple`. You can see definitions for these strategies +in the `Elastic\Transport\NodePool` namespace. For more information on Elastica clustering see http://elastica.io/getting-started/installation.html#section-connect-cluster diff --git a/doc/index.md b/doc/index.md index d4476a9bb..1cbe71beb 100644 --- a/doc/index.md +++ b/doc/index.md @@ -27,7 +27,6 @@ Cookbook Entries * [Populate Events](cookbook/populate-events.md) * Performance - [Logging](cookbook/logging.md) - - [Compression](cookbook/compression.md) - [Speed up populate command](cookbook/speed-up-populate-command.md) - [Speed up populate command (AWS SQS)](cookbook/speed-up-populate-command-sqs.md) - [Doctrine queue listener](cookbook/doctrine-queue-listener.md) diff --git a/doc/setup.md b/doc/setup.md index 570d59139..2667cd5f8 100644 --- a/doc/setup.md +++ b/doc/setup.md @@ -47,7 +47,7 @@ index. #app/config/config.yml fos_elastica: clients: - default: { host: localhost, port: 9200 } + default: { hosts: ['http://localhost:9200'] } indexes: app: ~ ``` diff --git a/doc/templates.md b/doc/templates.md index 7c202414f..5cf09c72a 100644 --- a/doc/templates.md +++ b/doc/templates.md @@ -18,7 +18,7 @@ fos_elastica: : client: default template_name: