오락기/ELK

은전한닢 한글 형태소 분석기 적용

문방구앞오락기 2018. 5. 21. 11:07

은전한닢 플러그인 설치 

윈도우에 엘라스틱서치 6.2.4 설치 

 

 

Index셋업  

 

 

{ 

  "settings" : { 

    "index":{ 

      "analysis":{ 

        "analyzer":{ 

          "korean":{ 

            "type":"custom", 

            "tokenizer":"seunjeon_default_tokenizer" 

          } 

        }, 

          "tokenizer": { 

            "seunjeon_default_tokenizer": { 

              "index_eojeol": "false", 

              "type": "seunjeon_tokenizer", 

              "userwords" : ["낄끼+빠빠,-100", "c\\+\\+", "어그로", "버카충", "abc마트"]  

            } 

          } 

      } 

    } 

  }, 

    "mappings": { 

    "text" : { 

      "properties" : { 

        "text" : { 

          "type" : "text", 

          "analyzer": "korean" 

        } 

      } 

    } 

  } 

} 

 

 

 

 

데이터 1 입력 

 

 

{"text": "아버지가 방에 들어간다"} 

 

 

 

테스트 

 

 

{ 

"query": 

{ 

"bool":  

{ 

"must": [ 

{ 

"match":  

{ 

"text":"아버지" 

} 

} 

] 

 

} 

} 

 

결과 

 

{ 

    "took": 47, 

    "timed_out": false, 

    "_shards": { 

        "total": 5, 

        "successful": 5, 

        "skipped": 0, 

        "failed": 0 

    }, 

    "hits": { 

        "total": 1, 

        "max_score": 0.2876821, 

        "hits": [ 

            { 

                "_index": "seunjeon-idx", 

                "_type": "text", 

                "_id": "1", 

                "_score": 0.2876821, 

                "_source": { 

                    "text": "아버지가 방에 들어간다" 

                } 

            } 

        ] 

    }