Skip to content

Commit

Permalink
Documentation and changelog.
Browse files Browse the repository at this point in the history
  • Loading branch information
biozshock committed Feb 19, 2025
1 parent 11d5b17 commit 5cb0b6d
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 43 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG-7.0.md
Original file line number Diff line number Diff line change
@@ -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`.
Expand All @@ -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)
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
13 changes: 0 additions & 13 deletions doc/cookbook/compression.md

This file was deleted.

2 changes: 1 addition & 1 deletion doc/cookbook/custom-repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 44 additions & 9 deletions doc/cookbook/elastica-http-client-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
3 changes: 1 addition & 2 deletions doc/cookbook/http-auth-for-elastica.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
```
4 changes: 2 additions & 2 deletions doc/cookbook/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ service you wish to use.
fos_elastica:
clients:
default:
host: example.com
hosts: ['http://example.com:80']
logger: true
```
Expand All @@ -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'
```
8 changes: 3 additions & 5 deletions doc/cookbook/multiple-connections.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion doc/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ index.
#app/config/config.yml
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
default: { hosts: ['http://localhost:9200'] }
indexes:
app: ~
```
Expand Down
2 changes: 1 addition & 1 deletion doc/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fos_elastica:
<name>:
client: default
template_name: <template name>
template: some_index_*
index_patterns: [some_index_*]
settings:
number_of_shards: 1
number_of_replicas: 0
Expand Down
9 changes: 5 additions & 4 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace FOS\ElasticaBundle\DependencyInjection;

use Elastic\Elasticsearch\Transport\RequestOptions;
use FOS\ElasticaBundle\Serializer\Callback as SerializerCallback;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
Expand Down Expand Up @@ -359,10 +360,10 @@ private function addClientsSection(ArrayNodeDefinition $rootNode): void
->end()
->arrayNode('client_config')
->children()
->scalarNode('ssl_verify')->end()
->scalarNode('ssl_cert')->end()
->scalarNode('ssl_key')->end()
->scalarNode('ssl_ca')->end()
->scalarNode(RequestOptions::SSL_CERT)->end()
->scalarNode(RequestOptions::SSL_KEY)->end()
->scalarNode(RequestOptions::SSL_VERIFY)->end()
->scalarNode(RequestOptions::SSL_CA)->end()
->end()
->end()
->arrayNode('client_options')
Expand Down

0 comments on commit 5cb0b6d

Please sign in to comment.