# Synonyms in synonyms.txt not recognized

**URL:** <https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417>\
**Category:** Elasticsearch\
**Created:** [December 28, 2017, 8:49am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417 "2017-12-28T08:49:07Z")\
**Posts on this page:** 18\
**Page:** 2

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [December 28, 2017, 5:17pm UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/21 "2017-12-28T17:17:05Z")

</div>

`./esconfig` is a sample name I chose to denote the config folder on your host. You need to change that to whatever name that config folder has on your local system. And that needs to be mapped to `/usr/share/elasticsearch/config` inside the Docker container.

Exactly what you did with your local folder `esdata1` being mapped to `/usr/share/elasticsearch/data` inside your container

---

<div class="post-metadata">

**Author:** ![Aurelien\_Quillet](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Aurelien\_Quillet](https://discuss.elastic.co/u/Aurelien_Quillet)\
**Post date:** [December 29, 2017, 9:10am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/22 "2017-12-29T09:10:52Z")

</div>

Isn't it what I did by following your suggestions?  
I created a repertory esconfig at the same location where esdata1 is.  
Then added the ligne "- ./esconfig:/usr/share/elasticsearch/config" to my docker-compose.yml file to map the volume as you suggested in your previous posts.

And in my /usr/share/elasticsearch/config repertory, there is a /analysis/synonyms.txt file.

However, with this set up, I cannot start my docker.

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [December 29, 2017, 9:19am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/23 "2017-12-29T09:19:33Z")

</div>

`/analysis/synonyms.txt` should be inside your local `esconfig` folder so that it gets mapped to `/usr/share/elasticsearch/config/analysis/synonyms.txt` inside your container. Is it the case ?

---

<div class="post-metadata">

**Author:** ![Aurelien\_Quillet](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Aurelien\_Quillet](https://discuss.elastic.co/u/Aurelien_Quillet)\
**Post date:** [December 29, 2017, 9:32am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/24 "2017-12-29T09:32:14Z")

</div>

I put /analysis/synonyms.txt in the local esconfig folder.  
I then did the following commands :

> sudo docker-compose stop  
> sudo docker-compose up -d --build  
> sudo docker ps -a

The response was again :

> CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES  
> f2cfd2187bea [docker.elastic.co/elasticsearch/elasticsearch:6.1.0](http://docker.elastic.co/elasticsearch/elasticsearch:6.1.0) "/usr/local/bin/do..." 19 hours ago Exited (78) 14 seconds ago elasticsearch  
> 9b12332577eb [docker.elastic.co/kibana/kibana:6.1.0](http://docker.elastic.co/kibana/kibana:6.1.0) "/bin/bash /usr/lo..." 13 days ago Up 15 seconds 0.0.0.0:5601-\>5601/tcp kibana

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [December 29, 2017, 9:34am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/25 "2017-12-29T09:34:53Z")

</div>

if you go into the container and check the folder, what do you see?

```
$> docker exec -it <container-id> bash
$> ls -la /usr/share/elasticsearch/config/analysis/
```

---

<div class="post-metadata">

**Author:** ![Aurelien\_Quillet](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Aurelien\_Quillet](https://discuss.elastic.co/u/Aurelien_Quillet)\
**Post date:** [December 29, 2017, 9:43am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/26 "2017-12-29T09:43:34Z")

</div>

Command :

docker exec -it \<f2cfd2187bea\> bash

Response :

> bash: f2cfd2187bea: No such file or directory

Command:

> ls -la /usr/share/elasticsearch/config/analysis/

Response:

> total 16  
> drwxr-xr-x 2 root root 4096 déc. 28 10:14 .  
> drwxr-xr-x 3 root root 4096 déc. 26 15:39 ..  
> -rw-r--r-- 1 root root 60 déc. 28 10:14 out.txt  
> -rwxrwxrwx 1 root root 60 déc. 28 10:28 synonyms.txt

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [December 29, 2017, 9:49am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/27 "2017-12-29T09:49:32Z")

</div>

You need to execute without the angle brackets

`docker exec -it f2cfd2187bea bash`

---

<div class="post-metadata">

**Author:** ![Aurelien\_Quillet](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Aurelien\_Quillet](https://discuss.elastic.co/u/Aurelien_Quillet)\
**Post date:** [December 29, 2017, 9:54am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/28 "2017-12-29T09:54:16Z")

</div>

I get an error:

> Error response from daemon: Container f2cfd2187bea1c9e8b2c94a8acbdcdf867615357b732a58f2d8a94d87ef9e01d is not running

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [December 29, 2017, 9:55am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/29 "2017-12-29T09:55:29Z")

</div>

You need to take the proper container ID you get when running `docker ps`

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [December 29, 2017, 10:01am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/30 "2017-12-29T10:01:16Z")

</div>

Doh, forgive me, your container isn't starting, so that's normal.  
How much memory have you given to your docker machine?

Also how much heap is allocated to your ES container (see in `config/jvm.options`)

---

<div class="post-metadata">

**Author:** ![Aurelien\_Quillet](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Aurelien\_Quillet](https://discuss.elastic.co/u/Aurelien_Quillet)\
**Post date:** [December 29, 2017, 10:16am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/31 "2017-12-29T10:16:28Z")

</div>

For the memory, I don't know. I didn't touch this parameter. So it must be the default value.

For the heap:  
There was no jvm.options in /usr/share/elasticsearch/config/  
So I put the one that is in my local ES (~/elasticsearch-6.0.1/config) in /usr/share/elasticsearch/config/ but nothing changed. The elasticsearch docker still won't run.

Otherwise, the heap parameter in the jvm.options is:  
-Xms1g  
-Xmx1g

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [December 29, 2017, 10:18am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/32 "2017-12-29T10:18:51Z")

</div>

Can you run this? What do you see?

`docker logs -f f2cfd2187bea --tail 200`

---

<div class="post-metadata">

**Author:** ![Aurelien\_Quillet](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Aurelien\_Quillet](https://discuss.elastic.co/u/Aurelien_Quillet)\
**Post date:** [December 29, 2017, 10:20am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/33 "2017-12-29T10:20:59Z")

</div>

> ERROR: no log4j2.properties found; tried [/usr/share/elasticsearch/config] and its subdirectories  
> 2017-12-28 14:32:12,517 main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")

And a list of about 20 subdirectories.  
This error printed itself 7 times.

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 2, 2018, 5:44am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/34 "2018-01-02T05:44:12Z")

</div>

Actually, the official Docker image has XPack installed and additional config files in the config folder, so we cannot override those files. Instead, we can bind mount your synonyms file directly:

Change this:

```
- ./esconfig:/usr/share/elasticsearch/config

```

With this:

```
- ./esconfig/analysis/synonyms.txt:/usr/share/elasticsearch/config/analysis/synonyms.txt

```

Does it work better?

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 4, 2018, 2:16pm UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/35 "2018-01-04T14:16:30Z")

</div>

Any luck with this?

---

<div class="post-metadata">

**Author:** ![Aurelien\_Quillet](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Aurelien\_Quillet](https://discuss.elastic.co/u/Aurelien_Quillet)\
**Post date:** [January 4, 2018, 2:44pm UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/36 "2018-01-04T14:44:08Z")

</div>

Sorry, I am away from my office this week. I will try your suggestion on monday for sure.  
Thank you very much for all your help and the speed with which you respond to my issues.

Sincerely,  
Aurélien.

---

<div class="post-metadata">

**Author:** ![Aurelien\_Quillet](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Aurelien\_Quillet](https://discuss.elastic.co/u/Aurelien_Quillet)\
**Post date:** [January 8, 2018, 8:27am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/37 "2018-01-08T08:27:26Z")

</div>

The docker starts well now. But when I test the analyzer, it still does not recognize the synonyms of the synonyms.txt file. The file is in the right place. And it works if I don't use the docker.

---

<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:** [February 5, 2018, 8:27am UTC](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417/38 "2018-02-05T08:27:26Z")

</div>

Closed on February 5, 2018, 8:27am UTC

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

[Previous page](https://discuss.elastic.co/t/synonyms-in-synonyms-txt-not-recognized/113417.md?page=1)
