analyzer使用

POST _analyze
{
  "tokenizer":"keyword",
  "char_filter":["html_strip"],
  "text":"<b>this is my test</b>"
}

POST _analyze
{
  "tokenizer": "standard",
  "char_filter": [{
    "type":"mapping",
    "mappings":["-=>_"]
  }],
  "text": "0318-5513103"
}
GET _analyze
{
  "tokenizer": "whitespace",
  "filter": ["lowercase","stop"],
  "text":"The rain is Spain fails mainly on the plain ."
  
}
PUT my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_custom_analyzer":{
          "type":"custom",
          "char_filter":["emotion"],
          "tokenizer":"punc",
          "filter":["lowercase","english_stop"]
        }
      },
      "tokenizer": {
        "punc":{
          "type":"pattern",
          "pattern":"[ .,!?]"
        }
      },
      "char_filter": {
        "emotion":{
          "type":"mapping",
          "mappings":[
            ":)=>happy",
            ":(=>sad"
            ]
        }
      },
      "filter": {
        "english_stop":{
          "type":"stop",
          "stopwords":"_english_"
        }
      }
    }
  }
}
POST my_index/_analyze
{
  "analyzer": "my_custom_analyzer",
  "text": "are you :) ?"
}

猜你喜欢

转载自blog.csdn.net/weixin_39394909/article/details/105338131