# Compound words handling

**URL:** <https://discuss.elastic.co/t/compound-words-handling/225453>\
**Category:** Elasticsearch\
**Created:** [March 27, 2020, 6:17pm UTC](https://discuss.elastic.co/t/compound-words-handling/225453 "2020-03-27T18:17:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chari](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@chari](https://discuss.elastic.co/u/chari)\
**Post date:** [March 27, 2020, 6:17pm UTC](https://discuss.elastic.co/t/compound-words-handling/225453/1 "2020-03-27T18:17:07Z")

</div>

How can I get ES to search for the words "data base" and "database" in the index when the query word is "database" or "data base"?  
another example : when the user queries the word "clean up" or "cleanup", ES should search for both "clean up" and "cleanup".

I tried decompounding using the following code :

```
es.indices.create(
  index= "zentest",
  body= {
    "settings": {
      "analysis": {
        "analyzer": {
          "standard_dictionary_decompound": {
            "tokenizer": "standard",
            "filter": ["dictionary_decompound"]
          }
        },
        "filter": {
          "dictionary_decompound": {
            "type": "dictionary_decompounder",
            "word_list_path": "decompound_words.txt",
            "max_subword_size": 22
          }
        }
      }
    }
  }
)

```

the .txt file has the following words, one on each line  
database  
cleanup

Didn't work. the text has "clean up". When I query "clean up" I get a hit. I get nothing when I query "cleanup".

Do I need to filter using synonyms ?

---

<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:** [March 30, 2020, 2:36pm UTC](https://discuss.elastic.co/t/compound-words-handling/225453/2 "2020-03-30T14:36:23Z")

</div>

synonyms would be an alternative here indeed.

Maybe you can explain why you went with the decompounder in the first case to avoid any confusion.

--Alex

---

<div class="post-metadata">

**Author:** ![chari](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@chari](https://discuss.elastic.co/u/chari)\
**Post date:** [March 30, 2020, 4:02pm UTC](https://discuss.elastic.co/t/compound-words-handling/225453/3 "2020-03-30T16:02:08Z")

</div>

cleanup and database could be considered as closed compound words. just like basketball. i also wanted to know what ES considers compound words in English.

i suppose i could use (cleanup, clean) and (database,data) as synonyms, though it seems hacky.

---

<div class="post-metadata">

**Author:** ![chari](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@chari](https://discuss.elastic.co/u/chari)\
**Post date:** [March 31, 2020, 9:14pm UTC](https://discuss.elastic.co/t/compound-words-handling/225453/4 "2020-03-31T21:14:58Z")

</div>

using cleanup and clean as synonyms didn't work.  
I get a hit when I use clean but none when I use cleanup.

---

<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:** [April 28, 2020, 9:14pm UTC](https://discuss.elastic.co/t/compound-words-handling/225453/5 "2020-04-28T21:14:59Z")

</div>

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