iur*_*rti 9 elasticsearch elasticsearch-plugin
首先,我想设置ES的默认分析器,但失败了.然后根据其他问题和网站,我试图设置一个索引的默认分析器.但也有一些问题.
我已经配置了ik分析器,我可以设置一些字段的分析器,这是我的命令:
curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/test/_mapping -d'{
"test":{
"properties":{
"name":{
"type":"string",
"analyzer":"ik"
}
}
}
}'
Run Code Online (Sandbox Code Playgroud)
并得到消息:
{"acknowledged":true}
Run Code Online (Sandbox Code Playgroud)
它也符合我的愿望.
但是,如果我尝试设置索引的默认分析器:
curl -XPOST localhost:9200/test1?pretty -d '{ "index":{
"analysis" : {
"analyzer" : {
"default" : {
"type" : "ik"
}
}
}
}
}'
Run Code Online (Sandbox Code Playgroud)
我会收到错误消息:
{
"error" : {
"root_cause" : [ {
"type" : "index_creation_exception",
"reason" : "failed to create index"
} ],
"type" : "illegal_argument_exception",
"reason" : "no default analyzer configured"
},
"status" : 400
}
Run Code Online (Sandbox Code Playgroud)
太奇怪了,不是吗?期待您对此问题的看法.谢谢!:)
Val*_*Val 10
你几乎就在那里,你只是错过/_settings了你的道路.这样做是这样的.另请注意,您需要先关闭索引,然后在更新分析器后重新打开它.
// close index
curl -XPOST 'localhost:9200/test1/_close'
add this to the path
|
v
curl -XPUT localhost:9200/test1/_settings?pretty -d '{ "index":{
"analysis" : {
"analyzer" : {
"default" : {
"type" : "ik"
}
}
}
}
}'
// re-open index
curl -XPOST 'localhost:9200/test1/_open'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3653 次 |
| 最近记录: |