Skip to content

Commit b0a464d

Browse files
mnoconkonradobozadabrt
committed
[4.6] Doc for Elasticsearch 8 (#3022)
* Added doc for ES8 * Added update guide mention * Fixed header * Formatting fixes * Apply suggestions from code review Co-authored-by: Konrad Oboza <konrad.oboza@ibexa.co> * Apply suggestions from code review Co-authored-by: Tomasz Dąbrowski <64841871+dabrt@users.noreply.github.com> * Manual changes --------- Co-authored-by: Konrad Oboza <konrad.oboza@ibexa.co> Co-authored-by: Tomasz Dąbrowski <64841871+dabrt@users.noreply.github.com>
1 parent 8d8fc5c commit b0a464d

File tree

6 files changed

+340
-90
lines changed

6 files changed

+340
-90
lines changed

docs/getting_started/requirements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ For production setups it's recommended that you use Varnish/Fastly, Redis/Valkey
225225
|Name|Version|
226226
|---|---|
227227
|Solr|7.7+, 8.11.1+ or 9.8.1+|
228-
|Elasticsearch| 7.16.2+ |
228+
|Elasticsearch| 7.16.2+ or 8.19+ |
229229

230230
If you see a "+" next to the product version, it indicates a recommended version or higher within the same major release.
231231
For example, "1.18+" means any 1.x version equal to or higher than 1.18, but not 2.x.

docs/search/search_engines/elasticsearch/configure_elasticsearch.md

Lines changed: 159 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -109,40 +109,62 @@ ibexa_elasticsearch:
109109

110110
When you configure a cluster-based connection, and the cluster consists of many nodes, you can choose strategies that govern how the cluster reacts to changing operating conditions, or how workload is distributed among the nodes.
111111

112-
#### Connection pool
112+
#### Connection pool and Node pool settings
113113

114-
With this setting you decide how a list of hosts that form a cluster is managed.
115-
The list of active hosts tends to change in time, due to different reasons, such as connectivity issues, host malfunction, or the fact that you add new hosts to the cluster to increase its performance.
116-
By default, the `StaticNoPingConnectionPool` setting is used.
114+
The way you configure cluster node management depends on which Elasticsearch version you're using.
117115

118-
You can change the default setting with the following key:
116+
=== "Elasticsearch 7"
119117

120-
``` yaml
121-
<connection_name>:
122-
# ...
123-
connection_pool: Elasticsearch\ConnectionPool\<connection_pool_name>
124-
```
118+
With this setting you decide how a list of hosts that form a cluster is managed.
119+
The list of active hosts tends to change in time, due to different reasons, such as connectivity issues, host malfunction, or the fact that you add new hosts to the cluster to increase its performance.
120+
By default, the `StaticNoPingConnectionPool` setting is used.
121+
122+
You can change the default setting with the following key:
123+
124+
``` yaml
125+
<connection_name>:
126+
# ...
127+
connection_pool: Elasticsearch\ConnectionPool\<connection_pool_name>
128+
```
129+
130+
When the cluster consists of many hosts, the `connection_selector` setting decides what strategy is used to pick a node to send query requests to.
131+
By default, the `RoundRobinSelector` setting is used.
125132

126-
For more information and a list of available choices, see [Connection pool](https://www.elastic.co/guide/en/elasticsearch/client/php-api/7.x/connection_pool.html).
133+
If you prefer a different strategy, or have created your own, custom strategy, you can change the default setting with the following key:
127134

128-
!!! tip "Load tests recommendation"
135+
``` yaml
136+
<connection_name>:
137+
# ...
138+
connection_selector: Elasticsearch\ConnectionPool\Selectors\<selector_name>
139+
```
129140

130-
If you change the connection pool setting, it's recommended that you to perform load tests to check whether the change doesn't negatively impact the performance of your environment.
141+
For more information and a list of available choices, see [Connection pool](https://www.elastic.co/guide/en/elasticsearch/client/php-api/7.x/connection_pool.html) and [Selectors](https://www.elastic.co/guide/en/elasticsearch/client/php-api/7.x/selectors.html).
131142

132-
#### Connection selector
143+
!!! tip "Load tests recommendation"
133144

134-
When the cluster consists of many hosts, the `connection_selector` setting decides what strategy is used to pick a node to send query requests to.
135-
By default, the `RoundRobinSelector` setting is used.
145+
If you change the connection pool setting, it's recommended that you perform load tests to check whether the change doesn't negatively impact the performance of your environment.
136146

137-
If you prefer a different strategy, or have created your own, custom strategy, you can change the default setting with the following key:
147+
=== "Elasticsearch 8"
138148

139-
``` yaml
140-
<connection_name>:
141-
# ...
142-
connection_selector: Elasticsearch\ConnectionPool\Selectors\<selector_name>
143-
```
149+
With these settings you decide how nodes in the cluster are selected and how failed nodes are resurrected.
150+
The node pool manages the list of active nodes, which can change over time due to connectivity issues, host malfunction, or when you add new nodes to the cluster to increase performance.
151+
152+
By default, Elasticsearch uses the `SimpleNodePool` algorithm with `RoundRobin` selector and `NoResurrect` strategy.
153+
154+
You can customize the node pool behavior with the following settings:
155+
156+
``` yaml
157+
<connection_name>:
158+
# ...
159+
node_pool_selector: Elastic\Transport\NodePool\Selector\RoundRobin
160+
node_pool_resurrect: Elastic\Transport\NodePool\Resurrect\NoResurrect
161+
```
162+
163+
For more information and a list of available choices, see [Node pool](https://www.elastic.co/guide/en/elasticsearch/client/php-api/8.19/node_pool.html).
164+
165+
!!! tip "Load tests recommendation"
144166

145-
For more information and a list of available choices, see [Selectors](https://www.elastic.co/guide/en/elasticsearch/client/php-api/7.x/selectors.html).
167+
If you change the node pool settings, it's recommended that you perform load tests to check whether the change doesn't negatively impact the performance of your environment.
146168

147169
##### Number of retries
148170

@@ -155,9 +177,12 @@ By default, `null` is used, which means that the number of retries equals to the
155177
retries: null
156178
```
157179

158-
Depending on the connection pool that you select, [[= product_name =]]'s reaction to reaching the maximum number of retries might differ.
180+
Depending on the connection pool/node pool that you select, [[= product_name =]]'s reaction to reaching the maximum number of retries might differ.
159181

160-
For more information, see [Set retries](https://www.elastic.co/guide/en/elasticsearch/client/php-api/7.x/set-retries.html).
182+
For more information, see:
183+
184+
- Elasticsearch 7: [Set retries](https://www.elastic.co/guide/en/elasticsearch/client/php-api/7.x/set-retries.html)
185+
- Elasticsearch 8: [Set retries](https://www.elastic.co/guide/en/elasticsearch/client/php-api/8.19/set-retries.html)
161186

162187
## Configure Elasticsearch Cloud
163188

@@ -217,33 +242,90 @@ ibexa_elasticsearch:
217242
### API key authentication
218243

219244
If your Elasticsearch cluster is protected by API keys, you must provide the key and secret in authentication configuration to connect [[= product_name =]] with the cluster.
220-
With API key authentication you can define different authorization levels, such as [`create_index` or `index`](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-privileges.html#privileges-list-indices).
245+
With API key authentication you can define different authorization levels, such as `create_index` or `index`.
221246
Such approach proves useful if the cluster is available to the public.
222247

223-
For more information, see [Create API key](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html).
248+
For more information, see:
224249

225-
When using API key authentication, you must pass the following parameters to authenticate access to the cluster:
250+
- Elasticsearch 7: [Create API key](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-api-create-api-key.html) and [Security privileges](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/security-privileges.html#privileges-list-indices)
251+
- Elasticsearch 8: [Create API key](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/security-api-create-api-key.html) and [Security privileges](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/security-privileges.html#privileges-list-indices)
226252

227-
``` yaml
228-
<connection_name>:
229-
# ...
230-
authentication:
231-
type: api_key
232-
credentials: ['<api_key>', '<api_secret>']
233-
```
253+
=== "Elasticsearch 7"
234254

235-
For example:
255+
When using API key authentication with Elasticsearch 7, you must pass the following parameters to authenticate access to the cluster:
236256

237-
``` yaml
238-
ibexa_elasticsearch:
239-
connections:
240-
cloud:
241-
debug: true
242-
elastic_cloud_id: 'test:ZWFzdHVzMi5henVyZS5lbGFzdGljLWNsb3VkLmNvbTo5MjQzJGUwZ'
243-
authentication:
244-
type: api_key
245-
credentials: ['8Ek5f3IBGQlWj6v4M7zG', 'rmI6IechSnSJymWJ4LZqUw']
246-
```
257+
``` yaml
258+
<connection_name>:
259+
# ...
260+
authentication:
261+
type: api_key
262+
credentials: ['<api_key>', '<api_secret>']
263+
```
264+
265+
For example:
266+
267+
``` yaml
268+
ibexa_elasticsearch:
269+
connections:
270+
cloud:
271+
debug: true
272+
elastic_cloud_id: 'test:ZWFzdHVzMi5henVyZS5lbGFzdGljLWNsb3VkLmNvbTo5MjQzJGUwZ'
273+
authentication:
274+
type: api_key
275+
credentials: ['8Ek5f3IBGQlWj6v4M7zG', 'rmI6IechSnSJymWJ4LZqUw']
276+
```
277+
278+
=== "Elasticsearch 8"
279+
280+
When using API key authentication with Elasticsearch 8, you can pass either the API key and key ID pair, or the encoded API key value, which Elasticsearch also calls "API key credentials".
281+
282+
**Using API key and key ID:**
283+
284+
``` yaml
285+
<connection_name>:
286+
# ...
287+
authentication:
288+
type: api_key
289+
credentials: ['<api_key>', '<api_key_id>']
290+
```
291+
292+
For example:
293+
294+
``` yaml
295+
ibexa_elasticsearch:
296+
connections:
297+
cloud:
298+
debug: true
299+
elastic_cloud_id: 'test:ZWFzdHVzMi5henVyZS5lbGFzdGljLWNsb3VkLmNvbTo5MjQzJGUwZ'
300+
authentication:
301+
type: api_key
302+
credentials: ['ui2lp2axTNmsyakw9tvNnw', 'VuaCfGcBCdbkQm-e5aOx']
303+
```
304+
305+
**Using encoded API key:**
306+
307+
``` yaml
308+
<connection_name>:
309+
# ...
310+
authentication:
311+
type: api_key
312+
credentials: ['<api_key_encoded>']
313+
```
314+
315+
For example:
316+
317+
``` yaml
318+
ibexa_elasticsearch:
319+
connections:
320+
cloud:
321+
debug: true
322+
elastic_cloud_id: 'test:ZWFzdHVzMi5henVyZS5lbGFzdGljLWNsb3VkLmNvbTo5MjQzJGUwZ'
323+
authentication:
324+
type: api_key
325+
credentials: ['VnVhQ2ZHY0JDZGJrUW0tZTVhT3g6dWkybHAyYXhUTm1zeWFrdzl0dk5udw==']
326+
```
327+
328+
To see the difference between API key, API key id, and encoded API key, refer to the [examples in Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/security-api-create-api-key.html#security-api-create-api-key-example).
247329

248330
### SSL
249331

@@ -293,24 +375,28 @@ To do this, pass the following setting under the `ssl` key:
293375
verification: false
294376
```
295377

296-
For more information, see [Elasticsearch: SSL Encryption](https://www.elastic.co/guide/en/elasticsearch/client/php-api/7.x/connceting.html#ssl-encryption).
378+
For more information, see:
379+
380+
- Elasticsearch 7: [SSL Encryption](https://www.elastic.co/guide/en/elasticsearch/client/php-api/7.x/connceting.html#ssl-encryption)
381+
- Elasticsearch 8: [Security by default (HTTPS)](https://www.elastic.co/guide/en/elasticsearch/client/php-api/8.19/connecting.html#auth-http)
297382

298383
### Enable debugging
299384

300385
In a staging environment, you can log messages about the status of communication with Elasticsearch.
301386
You can then use Symfony Profiler to review the logs.
302387

303-
By default, debugging is disabled. To enable debugging, you can toggle either of the following two settings:
388+
By default, debugging is disabled.
389+
To enable debugging, you can use the following settings:
304390

305391
``` yaml
306392
<connection_name>:
307393
# ...
308394
debug: <true/false>
309-
trace: <true/false>
395+
trace: <true/false> # Elasticsearch 7 only
310396
```
311397

312398
- `debug` logs basic information about a request, such as request status and time.
313-
- `trace` logs additional information, such as steps to reproduce an exact copy of a query.
399+
- `trace` logs additional information, such as steps to reproduce an exact copy of a query. Available only for Elasticsearch 7.
314400

315401
!!! tip
316402

@@ -371,7 +457,10 @@ Index names use the following pattern:
371457

372458
- `settings` - Settings under this key control all aspects related to an index.
373459

374-
For more information and a list of available settings, see [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/index-modules.html#index-modules-settings).
460+
For more information and a list of available settings, see:
461+
462+
- Elasticsearch 7: [Index modules](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/index-modules.html#index-modules-settings)
463+
- Elasticsearch 8: [Index modules](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/index-modules.html#index-modules-settings)
375464

376465
For example, you can define settings that convert text into a format that is optimized for search, like a normalizer that changes a case of all phrases in the index:
377466

@@ -393,16 +482,22 @@ For more information and a list of available settings, see [Elasticsearch docume
393482

394483
- `mappings` - Settings under this key define mapping for fields in the index.
395484

396-
For more information about mappings, see [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/mapping.html).
485+
For more information about mappings, see:
486+
487+
- Elasticsearch 7: [Mapping](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/mapping.html)
488+
- Elasticsearch 8: [Mapping](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/mapping.html)
397489

398490
When you create a custom index template, with settings for your own field and document types, make sure that it contains mappings for all searchable fields that are available in [[= product_name =]].
399-
For an example of default configuration with a list of searchable fields.
400-
To see the default configuration, go to `vendor/ibexa/elasticsearch/src/bundle/Resources/config/` and open the `default-config.yaml` file.
491+
492+
To see the default configuration, go to `vendor/ibexa/elasticsearch/src/bundle/Resources/config/` and open the `default-config.yaml` file.
401493

402494
### Fine-tune the search results
403495

404496
Your search results can be adjusted by configuring additional parameters.
405-
For a list of available mapping parameters and their usage, see [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/mapping-params.html).
497+
For a list of available mapping parameters and their usage, see:
498+
499+
- Elasticsearch 7: [Mapping parameters](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/mapping-params.html)
500+
- Elasticsearch 8: [Mapping parameters](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/mapping-params.html)
406501

407502
For example, you can apply a mapping parameter, in this case, a normalizer, to a specific mapping under the `dynamic_templates` key:
408503

@@ -488,9 +583,12 @@ For more information about specifying the pattern for your language, see [Define
488583

489584
#### Create config for language specific analyzer
490585

491-
For information about configuring an analyzer for each specific language, see [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/analysis-lang-analyzer.html).
586+
For information about configuring an analyzer for each specific language, see:
492587

493-
An adoption of the [English analyzer](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/analysis-lang-analyzer.html#english-analyzer) in [[= product_name =]] configuration looks like this:
588+
- Elasticsearch 7: [Language analyzers](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/analysis-lang-analyzer.html)
589+
- Elasticsearch 8: [Language analyzers](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/analysis-lang-analyzer.html)
590+
591+
An adoption of the `english` analyzer in [[= product_name =]] configuration looks like this:
494592

495593
```yaml hl_lines="3-5 15-23 35 41-52 94 99"
496594
[[= include_file('code_samples/search/custom/config/packages/elasticsearch-en.yaml') =]]
@@ -520,7 +618,10 @@ ibexa_elasticsearch:
520618
- ger_de
521619
```
522620

523-
For more information about how Elasticsearch handles settings and mappings from multiple templates that match the same index, see [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-templates-v1.html#multiple-templates-v1).
621+
For more information about how Elasticsearch handles settings and mappings from multiple templates that match the same index, see:
622+
623+
- Elasticsearch 7: [Multiple templates](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/indices-templates-v1.html#multiple-templates-v1)
624+
- Elasticsearch 8: [Index templates](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/index-templates.html)
524625

525626
# Extend Elasticsearch
526627

docs/search/search_engines/elasticsearch/elasticsearch_overview.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ As a result of having distributed architecture, Elasticsearch can analyze massiv
1414
Instead of searching text directly, it searches and index.
1515
Thanks to this mechanism, it's able to achieve fast response.
1616

17-
For a detailed description of advanced settings that you might require in a specific production environment, see the documentation provided by Elastic.
18-
Start with the [Set up Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/7.7/setup.html) section.
17+
For a detailed description of advanced settings that you might require in a specific production environment, see the documentation provided by Elastic:
18+
19+
- Elasticsearch 7: [Set up Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/7.7/setup.html)
20+
- Elasticsearch 8: [Set up Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/setup.html)
1921

2022
**Prerequisite**
2123

0 commit comments

Comments
 (0)