Elasticsearch 分词器安装与使用
ES内置分词器
- standard:默认分词器,简单会被拆分,英文统一转换为小写
- simlle:按照非字母分词,英文统一转换为小写
- whitespace:按照空格分词
- stop:去除无意义的单词,比如:the、is、a、an
- keyword:不做分词,把文本的整体当作一个单独的关键词
测试分词结果
指定分词器测试结果
GET http://192.168.213.154:9200/_analyze
POST http://192.168.213.154:9200/_analyze
{
"text":"The Super Man",
"analyzer":"standard"
}
测试文本中的字段分词结果
GET http://192.168.213.154:9200/index_test_1/_analyze
POST http://192.168.213.154:9200/index_test_1/_analyze
{
"analyzer": "standard",
"field": "name",
"text": "