ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Elasticsearch 분석기 테스트
    내가 공부하고 싶은 IT/지식정리 2022. 12. 25. 20:34

    Tokenizer 확인

    • 주어진 문장(text)이 어떻게 형태소 분리되는지 확인
    • 분석하려는 index 를 지정함
      여기서는 cn-place
    • Tokenizer 지정
      여기서는 korean_tokenizer
    GET cn-place/_analyze?pretty
    {
       "tokenizer":"korean_tokenizer",
       "text":"운동장"
    }

    결과

    {
      "tokens" : [
        {
          "token" : "운동장",
          "start_offset" : 0,
          "end_offset" : 3,
          "type" : "word",
          "position" : 0,
          "positionLength" : 2
        },
        {
          "token" : "운동",
          "start_offset" : 0,
          "end_offset" : 2,
          "type" : "word",
          "position" : 0
        },
        {
          "token" : "장",
          "start_offset" : 2,
          "end_offset" : 3,
          "type" : "word",
          "position" : 1
        }
      ]
    }

     

    사용자 정의 Analyzer 확인

    • Tokenizer + filter 의 조합
    • 주어진 문장(text)이 어떻게 형태소 분리가 되는지 그리고 필터링이 되는지 확인
    • 분석하려는 index 를 지정함
      여기서는 cn-place
    • Analyzer 지정
      여기서는 korean_tokenizer
    GET cn-place/_analyze?pretty
    {
       "analyzer":"korean_analyzer",
       "text":"운동장"
    }

    결과

    {
      "tokens" : [
        {
          "token" : "운동장",
          "start_offset" : 0,
          "end_offset" : 3,
          "type" : "word",
          "position" : 0,
          "positionLength" : 2
        },
        {
          "token" : "플레이",
          "start_offset" : 0,
          "end_offset" : 3,
          "type" : "SYNONYM",
          "position" : 2
        },
        {
          "token" : "놀이터",
          "start_offset" : 0,
          "end_offset" : 3,
          "type" : "SYNONYM",
          "position" : 2,
          "positionLength" : 3
        },
        {
          "token" : "운동",
          "start_offset" : 0,
          "end_offset" : 2,
          "type" : "word",
          "position" : 2,
          "positionLength" : 2
        },
        {
          "token" : "그라운드",
          "start_offset" : 0,
          "end_offset" : 3,
          "type" : "SYNONYM",
          "position" : 3,
          "positionLength" : 2
        },
        {
          "token" : "장",
          "start_offset" : 2,
          "end_offset" : 3,
          "type" : "word",
          "position" : 4
        }
      ]
    }

    '내가 공부하고 싶은 IT > 지식정리' 카테고리의 다른 글

    Elasticsearch bool 쿼리  (0) 2023.01.01
    Elasticsearch DSL 기본  (0) 2023.01.01
    Elasticsearch Inverted Index 의 이해  (0) 2022.12.25
    Elasticsearch 분석기  (0) 2022.12.25
    포인트(Point) 테이블 설계  (0) 2022.11.20
Copyright @ 2016-2020 AmazonEberea