1.下载地址
2.查询
查询安装的分词
curl localhost:9200/_cat/plugins
测试ik分词
http://localhost:9200/_analyze?analyzer=ik_smart&text=无花果支付宝
3.使用
查询已有索引
curl localhost:9200/_cat/indices?v
创建索引
curl -XPUT localhost:9200/knowledge
创建映射
curl -XPOST localhost:9022/konwledge/student/_mapping -d "{"student":{"properties":{"name":{"type":"text","analyzer":"ik_max_word","search_analyzer":"ik_smart"},"age":{"type": "long"}}}}"
4. ik和pinyin分词
4.1 setting设置
curl -XPUT "http://localhost:9200/medcl/" -d'
{
"index": {
"analysis": {
"analyzer": {
"default": {
"tokenizer": "ik_max_word"
},
"pinyin_analyzer": {
"tokenizer": "shopmall_pinyin"
}
},
"tokenizer": {
"shopmall_pinyin": {
"keep_joined_full_pinyin": "true",
"keep_first_letter": "true",
"keep_separate_first_letter": "false",
"lowercase": "true",
"type": "pinyin",
"limit_first_letter_length": "16",
"keep_original": "true",
"keep_full_pinyin": "true"
}
}
}
}
}'
4.2 创建mapping
curl -XPOST http://localhost:9200/medcl/folks/_mapping -d'
{
"folks": {
"properties": {
"name": {
"type": "text",
"analyzer": "ik_max_word",
"include_in_all": true,
"fields": {
"pinyin": {
"type": "text",
"analyzer": "pinyin_analyzer"
}
}
}
}
}
}'
拼音分词效果:
http://localhost:9200/medcl/folks/_search?q=name.pinyin:zhrmghg
中文分词测试:
curl -XPOST "http://localhost:9200/medcl/folks/_search?q=name:刘德"