要不要也来分享分享一下啊

elasticsearch 指定缺省的分析器

Elasticsearch | 作者 zz_hello | 发布于2018年11月06日 | 阅读数:1742

PUT /mindex
{
"settings": {
"analysis": {
"analyzer": {
"default": {
"type": "english"
}
}
}
},
"mappings": {
"my_type": {
"properties": {
"title": {
"type": "text",
"analyzer": "standard"
},
"name": {
"type": "text"
}
}
}
}
}
忘记了怎么设置了,这样写的对name这个字段好像没作用,查看mapping,name字段并没有分析器
已邀请:

rochy - rochy_he

赞同来自:

2.X 是配置在 elasticsearch.yml 里面,类似下面的配置
index:
analysis:
analyzer:
default_index:
type: custom
tokenizer: hanlp_index
default_search:
type: custom
tokenizer: hanlp_search

rochy - rochy_he

赞同来自:

{
"settings": {
"analysis": {
"analyzer": {
"default": {
"type": "ik_max_word",
"tokenizer": "ik_max_word"
}
}
}
}
}

请参考上述设置

要回复问题请先登录注册