ElasticStack/Elasticsearch

[es] plugin 4 - custom analyzer 사용

닉의네임 2021. 12. 15. 22:42
반응형

인덱스 생성

PUT test_doo
{
  "settings": {
    "analysis": {
      "analyzer": {
        "nori_analyzer": {
          "tokenizer": "nori_tokenizer"
        },
        "jamo_analyzer": {
          "type": "custom",
          "tokenizer": "whitespace",
          "filter": [
            "lowercase",
            "stop",
            "snowball",
            "doo-jamo"
          ]
        },
        "chosung_analyzer": {
          "type": "custom",
          "tokenizer": "whitespace",
          "filter": [
            "lowercase",
            "stop",
            "snowball",
            "doo-chosung"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "message": {
        "type": "text",
        "fields": {
          "jamo": {
            "type": "text",
            "analyzer": "jamo_analyzer"
          },
          "chosung": {
            "type": "text",
            "analyzer": "chosung_analyzer"
          },
          "nori": {
            "type": "text",
            "analyzer": "nori_analyzer"
          }
        }
      }
    }
  }
}

 

 

테스트 데이터 색인

 

PUT test_doo/_doc/1
{
  "message" : "언제나 내게 오래된 뚜뚜같은 누이비똥이 있어요"
}

 

텀백터로 확인

GET test_doo/_termvectors/1?fields=message
반응형