본문 바로가기
elasticsearch

[elasticsearch] linux(centos7) nori plug-in설치

by bryan.oh 2020. 3. 6.
반응형

NORI 설치

 

노리 설치

 

nori 는 한글 발은 "놀이"에서 이름을 만들었다고 하네요.

  • Elastic에서 개발한 한국어 형태소 분석기
  • 사전은 기본으로 ‘mecab-ko-dic’ 을 사용
  • 6.4.x 이후 추가

 

일단 elasticsearch 설치는 아래 링크 참고하시고요. 

2020/03/02 - [elasticsearch] - [elasticsearch] yum 으로 elasticsearch 7.x 설치 (linux)

 

[elasticsearch] yum 으로 elasticsearch 7.x 설치 (linux)

Centos7 에 elasticsearch 설치 준비 - JVM 설치 ES는 JDK 가 필요합니다. 1.8버전 이상이 설치되어있어야 합니다. 우선 버전 확인 $ java -version openjdk version "1.8.0_242" 라고 나오네요. 이럼 설치 안해도..

hello-bryan.tistory.com

 

 

설치

elasticsearch 가 설치 된 상태에서 

폴더구조는 아래와 같습니다. home dir 로 이동합니다.

home dir : /usr/share/elasticsearch
config dir : /etc/elasticsearch
data dir : /var/lib/elasticsearch
log dir : /var/log/elasticsearch

$ cd /usr/share/elasticsearch
$ sudo bin/elasticsearch-plugin install analysis-nori
-> Installing analysis-nori
-> Downloading analysis-nori from elastic
[=================================================] 100%  
-> Installed analysis-nori

설치가 완료되었습니다.

 

엘라스틱서치 시작

엘라스틱 서치가 실행중이 었다면 재시작 합니다.

서비스에 등록되어있다면, ( 이전글참고 )

$ sudo systemctl stop elasticsearch
$ sudo systemctl start elasticsearch

이래야 서버 재시작해도 elasticsearch가 시작되니까요~

 

노리 실행 확인

$ curl -X POST http://localhost:9200/_analyze?pretty -H 'Content-Type: application/json' -d '{"analyzer":"nori", "text":"아버지가방에들어가신다"}'
{
  "tokens" : [
    {
      "token" : "아버지",
      "start_offset" : 0,
      "end_offset" : 3,
      "type" : "word",
      "position" : 0
    },
    {
      "token" : "가방",
      "start_offset" : 3,
      "end_offset" : 5,
      "type" : "word",
      "position" : 1
    },
    {
      "token" : "들어가",
      "start_offset" : 6,
      "end_offset" : 9,
      "type" : "word",
      "position" : 3
    }
  ]
}

 

 

 

 

728x90
반응형

댓글