# Customize a Dictionary\_Decompounder

**URL:** <https://discuss.elastic.co/t/customize-a-dictionary-decompounder/219668>\
**Category:** Elasticsearch\
**Created:** [February 17, 2020, 6:23pm UTC](https://discuss.elastic.co/t/customize-a-dictionary-decompounder/219668 "2020-02-17T18:23:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![highchem](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/highchem/32/41289_2.png) [@highchem](https://discuss.elastic.co/u/highchem)\
**Post date:** [February 17, 2020, 6:23pm UTC](https://discuss.elastic.co/t/customize-a-dictionary-decompounder/219668/1 "2020-02-17T18:23:37Z")

</div>

Hello Elasticsearch experts,

I have a question about writing a custom analyzer using a dictionary\_decompounder.

Here is a simplified example of the current mappings and settings of my index.

> PUT my\_index  
> {  
> "mappings": {  
> "properties": {  
> "content": {  
> "type": "text"  
> }  
> }  
> },  
> "settings": {  
> "analysis": {  
> "filter": {  
> "decomp\_de":{  
> "type": "dictionary\_decompounder",  
> "word\_list":["dreh", "moment", "schlüssel"]  
> }  
> },  
> "analyzer": {  
> "my\_analyzer": {  
> "tokenizer": "standard",  
> "filter": ["decomp\_de"]  
> }  
> }  
> }  
> }  
> }

When using the custom analyzer, I see that the decompounding is working as expected:

> GET /my\_index/\_analyze  
> {  
> "text": ["drehmomentschlüssel"],  
> "analyzer": "my\_analyzer"{  
> "content": "schlüssel additional text“  
> }  
> }

As a result I get the tokens (drehmomentschlüssel, dreh, moment, schlüssel).

Next I index following two documents:  
Document 1:

> {"content":"drehmomentschlüssel additional text"}

Document 2:

> {"content": "schlüssel additional text“}

Currently when I am searching for  
(1)drehmomentschlüssel we get Document1, Document2  
(2)schlüssel we get Document1, Document2

My desired result is the following:  
Searching for  
(1)drehmomentschlüssel we get Document1  
(2)schlüssel we get Document1, Document2

So when indexing the decompounding hast to be done. Otherwise search (2) would not return Document1. So I have to use a different analyzer during search time.  
Any ideas?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 18, 2020, 10:07am UTC](https://discuss.elastic.co/t/customize-a-dictionary-decompounder/219668/2 "2020-02-18T10:07:43Z")

</div>

please share your query. It looks as if you are combining terms with an `OR` instead of an `AND`.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 17, 2020, 10:07am UTC](https://discuss.elastic.co/t/customize-a-dictionary-decompounder/219668/3 "2020-03-17T10:07:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
