Site icon Kiat's Blog

ElasticSearch (4) – 内置分词器

#whitespace分词测试
GET _analyze
{
   "analyzer": "whitespace",
   "text":"he is-a boy"
}

# 响应如下:
{
  "tokens" : [
    {
      "token" : "he",
      "start_offset" : 0,
      "end_offset" : 2,
      "type" : "word",
      "position" : 0
    },
    {
      "token" : "is-a",
      "start_offset" : 3,
      "end_offset" : 7,
      "type" : "word",
      "position" : 1
    },
    {
      "token" : "boy",
      "start_offset" : 8,
      "end_offset" : 11,
      "type" : "word",
      "position" : 2
    }
  ]
}

Facebook评论
Exit mobile version