Skip to content

Commit 2ac0d08

Browse files
committed
Merge pull request #81 from skurfuerst/dev-full-configuration
[FEATURE] allow to configure full ElasticSearch mapping, e.g. including _all field
2 parents 097127d + b8cf962 commit 2ac0d08

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Mapping/NodeTypeMappingBuilder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ public function buildMappingInformation(Index $index) {
9191

9292
$type = $index->findType(self::convertNodeTypeNameToMappingName($nodeTypeName));
9393
$mapping = new Mapping($type);
94+
$fullConfiguration = $nodeType->getFullConfiguration();
95+
if (isset($fullConfiguration['search']['elasticSearchMapping'])) {
96+
$mapping->setFullMapping($fullConfiguration['search']['elasticSearchMapping']);
97+
}
9498

9599
// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-root-object-type.html#_dynamic_templates
96100
// 'not_analyzed' is necessary

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,46 @@ TYPO3:
400400
indexing: ${Indexing.indexAsset(value)}
401401
```
402402

403+
## Configurable ElasticSearch Mapping
404+
405+
(included in version >= 2.1)
406+
407+
If you want to fine-tune the indexing and mapping on a more detailed level, you can do so in the following way.
408+
409+
First, configure the index settings as you need them, e.g. configuring analyzers:
410+
411+
```
412+
Flowpack:
413+
ElasticSearch:
414+
indexes:
415+
default:
416+
'typo3cr': # This index name must be the same as in the TYPO3.TYPO3CR.Search.elasticSearch.indexName setting
417+
analysis:
418+
filter:
419+
elision:
420+
type: 'elision'
421+
articles: [ 'l', 'm', 't', 'qu', 'n', 's', 'j', 'd' ]
422+
analyzer:
423+
custom_french_analyzer:
424+
tokenizer: 'letter'
425+
filter: [ 'asciifolding', 'lowercase', 'french_stem', 'elision', 'stop' ]
426+
tag_analyzer:
427+
tokenizer: 'keyword'
428+
filter: [ 'asciifolding', 'lowercase' ]
429+
```
430+
431+
Then, you can change the analyzers on a per-field level; or e.g. reconfigure the _all field with the following snippet
432+
in the NodeTypes.yaml. Generally this works by defining the global mapping at `[nodeType].search.elasticSearchMapping`:
433+
434+
```
435+
'TYPO3.Neos:Node':
436+
search:
437+
elasticSearchMapping:
438+
_all:
439+
index_analyzer: custom_french_analyzer
440+
search_analyzer: custom_french_analyzer
441+
```
442+
403443

404444
## Debugging
405445

0 commit comments

Comments
 (0)