elasticsearch-docker-composer-for-liferay-7
elasticsearch-docker-composer-for-liferay-7 copied to clipboard
π Elasticsearch and Kuromoji against Liferay 7.x (Elasticsearch 7.17.1 and 8.0.x)
elasticsearch-docker-composer-for-liferay-7
This is for setting up docker-composer to test Elasticsearch and Kuromoji for Liferay 7.x
Required environment
- Docker 4.5.0 >=
- Java8 or Java11
How to set up
- Clone this repository
- Change the file permission of
/es/docker-entrypoint.shto executable. - Copy
.env.exampland create.envin the repository root directory. - Go back to the root folder and run
docker-compose up --buildor 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 Enabledtrue. - Open
index-settings.jsonand paste it intoAdditional Index ConfigurationsText field. - Open
liferay-type-mappings.jsonand paste it intoOverride Type MappingsText field. - Click save and restart Liferay server
- Loging as an administrator, navigate to Control Panel -> Configuration -> Server Configuration and run reindex.
Modify user dictionary
- Open /es/config/userdict_ja.txt
- Modify contents according to the user guide
Initialize set up after change configurations
- 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 }')
Log files
under /es/logs
Data files
under /es/data
How to investigate query of Liferay
Enable slow query log with low threshold would be the easiest way.
- Navigate to Sense
http://localhost:5601/app/dev_tools#/consolee.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
Search from query to see how analyzer works.
- Navigate to
http://localhost:5601/app/dev_tools#/console - Paste query below
GET /[index_name]/_analyze
{
"field": "title_ja_JP",
"text": "ζ±δΊ¬ι½ζΈ
ζε±"
}
How to access elasticsearch and tools
Elasticsearch
http://localhost:9200
Kibana (Analyzing tool for Elasticsearch)
http://localhost:5601