15.1 自定义分词器

创建自定义分词器
测试分词器
DELETE /test_analyzer
PUT /test_analyzer
{
  "settings": {
    "analysis": {
      "char_filter": {
        "sign_to_word": {
          "type": "mapping",
          "mappings": ["&=> and","+=>add"]
        }
      },
      "filter": {
        "my_stopwords": {
          "type": "stop",
          "stopwords": ["the", "a", "her", "his"]
        }
      },
      "analyzer": {
        "my_analyzer": {
          "type": "custom",
          "char_filter": ["html_strip", "sign_to_word"],
          "tokenizer": "standard",
          "filter": ["lowercase", "my_stopwords"]
        }
      }
    }
  }
}
 
GET /test_analyzer/_analyze
{
  "text": "ruru is a her <a href/> HAHA!!!",
  "analyzer": "my_analyzer"
}
posted @ 2019-06-16 20:42  Snow~Forever  阅读(241)  评论(0编辑  收藏  举报