elasticsearch 설치 및 한글형태소분석기 적용 따라하기.
Elastic/Elasticsearch 2012. 11. 16. 13:03[ElasticSearch 설치하기]
※ 참고 URL
http://www.elasticsearch.org/tutorials/2010/07/01/setting-up-elasticsearch.html
http://mimul.com/pebble/default/2012/02/23/1329988075236.html
https://github.com/chanil1218/elasticsearch-analysis-korean
http://apmlinux.egloos.com/2976457
※ 다운로드
wget --no-check-certificate https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.11.tar.gz
※ 압축해제
tar -xvzf elasticsearch-0.19.11.tar.gz
※ 링크생성
ln -s elasticsearch-0.19.11 elasticsearch
※ 설정
cd elasticsearch/config
vi elasticsearch.yml
# cluster.name: elasticsearch
cluster.name: MyCluster
# network.host: 192.168.0.1
network.host: 10.101.254.223
# http.port: 9200
http.port: 9200
※ 실행
bin/elasticsearch -f
OR
bin/elasticsearch -p pidfile
※ 기능확인
curl -X GET http://10.101.254.223:9200/
※ 관리툴설치
bin/plugin -install mobz/elasticsearch-head
http://10.101.254.223:9200/_plugin/head/
※ 한글형태소분석기설치
bin/plugin -install chanil1218/elasticsearch-analysis-korean/1.1.0
※ 한글형태소분석기 설정 (elasticsearch 재실행 후 설정)
curl -XPUT http://10.101.254.223:9200/test -d '{
"settings" : {
"index": {
"analysis": {
"analyzer": {
"kr_analyzer": {
"type": "custom"
, "tokenizer": "kr_tokenizer"
,"filter" : ["trim","kr_filter"]
}
, "kr_analyzer": {
"type": "custom"
, "tokenizer": "kr_tokenizer"
,"filter" : ["trim","kr_filter"]
}
}
}
}
}
}'
※ 한글형태소분석기 테스트
curl -XGET 'http://10.101.254.223:9200/test/_analyze?analyzer=kr_analyzer&pretty=true' -d '전주비빔밥'
※ 한글형태소분석결과
{
"tokens" : [ {
"token" : "전주비빔밥",
"start_offset" : 0,
"end_offset" : 5,
"type" : "word",
"position" : 1
}, {
"token" : "전주",
"start_offset" : 0,
"end_offset" : 2,
"type" : "word",
"position" : 2
}, {
"token" : "비빔밥",
"start_offset" : 2,
"end_offset" : 5,
"type" : "word",
"position" : 3
} ]
}