You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/search/search_engines/elastic_search/configure_elastic_search.md
+53-6Lines changed: 53 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -475,19 +475,66 @@ ibexa_elasticsearch:
475
475
# ...
476
476
```
477
477
478
+
### Add language-specific analysers
479
+
480
+
You can configure Elasticsearch to perform language-specific analysis like stemming.
481
+
This way searching for "cars" returns hits with content that contains the word "car".
482
+
On a multilingual site, you can have different analyzers configured for different languages, something which is typically required because stemming rules are language-specific.
483
+
484
+
#### Make a copy of the default template
485
+
486
+
To enable a language-specific analyzer, create a new template for each language in `config/packages/ibexa_elasticsearch.yaml` first.
487
+
This template should be based on the `default` template found in `vendor/ibexa/elasticsearch/src/bundle/Resources/config/default-config.yaml`.
488
+
The name of the new template should indicate the language it applies to, for example `eng_gb`, `nor_no` or `fre_fr`.
489
+
490
+
#### Change match pattern for the new template
491
+
492
+
The default template matches on `*_location_*` and `*_content_*`.
493
+
These patterns are not language-specific and you cannot use them if you plan to use different templates for different languages.
494
+
In your copy of the default template, change the pattern as follows:
495
+
496
+
```diff
497
+
patterns:
498
+
- - '*_location_*'
499
+
- - '*_content_*'
500
+
+ - "*_eng_gb*"
501
+
```
502
+
503
+
This pattern matches on English.
504
+
For more information about specifying the pattern for your language, see [Define a template](#define-a-template).
505
+
506
+
#### Create config for language specific analyzer
507
+
508
+
For information about configuring an analyzer for each specific language, see [Elastic Search documentation](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/analysis-lang-analyzer.html).
509
+
510
+
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:
Then, you must bind this language template to your Elasticsearch connection.
517
+
478
518
## Bind templates with connections
479
519
480
-
Once you have created the field mapping template(s), you must establish a relationship between the templates and a connection. You do this by adding the "index_templates" key to a connection definition.
520
+
After you create an index template (for example, for specific data types or linguistic analysis), you must link it to an Elasticsearch connection by adding the `index_templates` key to the connection definition.
481
521
482
522
If your configuration file contains several connection definitions, you can reuse the same template for different connections.
483
523
If you have several index templates, you can apply different combinations of templates to different connections.
484
524
485
525
``` yaml
486
-
<connection_name>:
487
-
# ...
488
-
index_templates:
489
-
- default
490
-
- default_en_us
526
+
ibexa_elasticsearch:
527
+
connections:
528
+
<connection_for_english_only_repository>:
529
+
# ...
530
+
index_templates:
531
+
- eng_gb
532
+
<connection_for_multilangual_repository>:
533
+
# ...
534
+
index_templates:
535
+
- eng_gb
536
+
- fre_fr
537
+
- ger_de
491
538
```
492
539
493
540
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).
0 commit comments