This is for setting up docker-composer to test Elasticsearch and Kuromoji for Liferay 7.x
- Docker 4.5.0 >=
- Java8 or Java11
- Clone this repository
- Change the file permission of
/es/docker-entrypoint.sh
to executable. - Copy
.env.exampl
and create.env
in the repository root directory. - Go back to the root folder and run
docker-compose up --build
or justdocker-compose up
- Start Liferay 7.x
- Login as an administrator and navigate to Control Panel -> Configuration -> System Setting -> Search -> Elasticsearch 7
- Check
Production Mode Enabled
true. - Open
index-settings.json
and paste it intoAdditional Index Configurations
Text field. - Open
liferay-type-mappings.json
and paste it intoOverride Type Mappings
Text field. - Click save and restart Liferay server
- Loging as an administrator, navigate to Control Panel -> Configuration -> Server Configuration and run reindex.
- Open /es/config/userdict_ja.txt
- Modify contents according to the user guide
- Stop services with
docker-compose stop
- Delete folders under
/es/data
- Run
docker rm -f `docker ps -qa`
- Run
docker rmi `docker images | sed -ne '2,$p' -e 's/ */ /g' | awk '{print $1":"$2}'`
- If 4 doesn't work, try
docker rmi $(docker images | awk '/^<none>/ { print $3 }')
under /es/logs
under /es/data
Enable slow query log with low threshold would be the easiest way.
- Navigate to Sense
http://localhost:5601/app/dev_tools#/console
e.g. - Find index names at
http://localhost:5601/app/management/data/index_management/indices
. - Modify query below appropriately.
PUT /[index_name]/_settings
{
"index.search.slowlog.threshold.query.warn": "0s",
"index.search.slowlog.threshold.query.info": "0s",
"index.search.slowlog.threshold.query.debug": "0s",
"index.search.slowlog.threshold.query.trace": "0s",
"index.search.slowlog.threshold.fetch.warn": "0s",
"index.search.slowlog.threshold.fetch.info": "0s",
"index.search.slowlog.threshold.fetch.debug": "0s",
"index.search.slowlog.threshold.fetch.trace": "0s",
"index.indexing.slowlog.threshold.index.warn": "0s",
"index.indexing.slowlog.threshold.index.info": "0s",
"index.indexing.slowlog.threshold.index.debug": "0s",
"index.indexing.slowlog.threshold.index.trace": "0s",
"index.indexing.slowlog.level": "trace",
"index.indexing.slowlog.source": "1000"
}
- Search / index and you'll see log files under ./es/logs
you can also change ./es/config/elasticsearch.yml for above settings and run
docker-compose up --build
- Navigate to
http://localhost:5601/app/dev_tools#/console
- Paste query below
GET /[index_name]/_analyze
{
"field": "title_ja_JP",
"text": "東京都清掃局"
}
http://localhost:9200
http://localhost:5601