ElasticSearch로 일본어 검색을 위한 로컬 환경 구축
8460 단어 형태소 분석Elasticsearch
환경 구축해 보자
여기 에서 최신 버전을 DL, 적절한 디렉토리에 압축을 풉니 다.
Java 설치 및 경로를 통해 둡시다.
일본어로 검색하고 싶으므로 kuromoji plugin을 설치합니다.
내 환경에서는 프록시를 통과해야했습니다.
Windows에서는 다음 명령으로 OK. 공식 문서 그럼 "(더블 쿼트 첨부)의 기술이 있었습니다만 잘 가지 않고,"를 지우면 인스톨 할 수 있었습니다.
# set ES_JAVA_OPTS=-Dhttp.proxyHost=**.**.**.** -Dhttp.proxyPort=**** Dhttps.proxyHost=**.**.**.** -Dhttps.proxyPort=****
# elasticsearch\bin\elasticsearch-plugin install analysis-kuromoji
시작해 보겠습니다.
# elasticsearch\bin\elasticsearch.bat
http://localhost:9200 를 방문하여 다음과 같은 Json을 얻을 수 있으면 완료됩니다.
{
"name": "aV33ZuH",
"cluster_name": "elasticsearch",
"cluster_uuid": "-rHtAb19QzKUiJ1_aq_-ig",
"version": {
"number": "5.4.1",
"build_hash": "2cfe0df",
"build_date": "2017-05-29T16:05:51.443Z",
"build_snapshot": false,
"lucene_version": "6.5.1"
},
"tagline": "You Know, for Search"
}
검색해보기
적당히 데이터를 등록해 보겠습니다.
curl -XPOST http://localhost:9200/test/sample -d '{
"id" : "1",
"text" : "夏なのでアイスがおいしい季節になりました"
}'
curl -XPOST http://localhost:9200/test/sample -d '{
"id" : "2",
"text" : "桃アイスを頂いた"
}'
curl -XPOST http://localhost:9200/test/sample -d '{
"id" : "2",
"text" : "昨日桃ちゃんと遊んだよ"
}'
검색해 보겠습니다.
curl -XPOST http://localhost:9200/test/sample/_search -d '{
"query": {
"match": {
"text": "アイスが"
}
}
}
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 0.5398108,
"hits": [
{
"_index": "test",
"_type": "sample",
"_id": "AVzERcmBSCe8bM-UJRG3",
"_score": 0.5398108,
"_source": {
"id": "1",
"text": "夏なのでアイスがおいしい季節になりました"
}
},
{
"_index": "test",
"_type": "sample",
"_id": "AVzERh6cSCe8bM-UJRG4",
"_score": 0.2824934,
"_source": {
"id": "2",
"name": "桃アイスを頂いた"
}
}
]
}
}
검색 단어의 '아이스가'의 조사가 생략되어 있음을 알 수 있습니다.
Reference
이 문제에 관하여(ElasticSearch로 일본어 검색을 위한 로컬 환경 구축), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/natty420/items/bcaf9e6f4bbef433d69c텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)