Synonyms in synonyms.txt not recognized

./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

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.

/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 ?

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 "/usr/local/bin/do..." 19 hours ago Exited (78) 14 seconds ago elasticsearch
9b12332577eb 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

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/

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

You need to execute without the angle brackets

docker exec -it f2cfd2187bea bash

I get an error:

Error response from daemon: Container f2cfd2187bea1c9e8b2c94a8acbdcdf867615357b732a58f2d8a94d87ef9e01d is not running

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

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)

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

Can you run this? What do you see?

docker logs -f f2cfd2187bea --tail 200

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.

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?

Any luck with this?

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.

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.

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