我尝试通过bash脚本执行此命令,但我收到以下错误:
#!/bin/bash
curl -XPOST 'localhost:9200/my_index/_close'
curl -XPUT 'localhost:9200/my_index/_settings' -d '{
"analysis": {
"analyzer": {
"ar_analyzer": {
"tokenizer": "standard",
"filter" : ["standard", "lowercase", "synonym", "ar_stemmer"]
},
"fr_analyzer": {
"tokenizer": "standard",
"filter" : ["standard", "lowercase", "synonym", "fr_stemmer"]
}
},
"filter" : {
"ar_stemmer" : {
"type" : "stemmer",
"name" : "arabic"
},
"fr_stemmer" : {
"type" : "stemmer",
"name" : "french"
},
"synonym" : {
"type" : "synonym",
"synonyms_path" : "synonyms.txt"
}
}
}
}'
curl -XPOST 'localhost:9200/my_index/_open'
Run Code Online (Sandbox Code Playgroud)
错误堆栈跟踪:
{"error":"IndexPrimaryShardNotAllocatedException [[my_index] primary …
我正在尝试创建一个测试分析器来试验对弹性搜索的分析。我创建了一个名为“mytest”的索引,该索引可用且可搜索,但是当我尝试创建自定义分析器时,出现以下错误
{
"error": "ElasticsearchIllegalArgumentException[Can't update non dynamic settings[[index.analysis.analyzer.content.type, index.analysis.analyzer.content.tokenizer]] for open indices [[mytest]]]",
"status": 400
}
Run Code Online (Sandbox Code Playgroud)
现在我不确定更新设置的限制,但我在文档中找不到任何内容。我可以在创建索引时创建分析,但更新不起作用。
使用下面的源创建分析器
PUT mytest/_settings
{
"analysis" : {
"analyzer":{
"content":{
"type":"custom",
"tokenizer":"whitespace"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗 ?
我是弹性搜索的新手,我想知道是否可以从索引中删除自定义分析器或自定义过滤器.
例如,假设以下索引设置:
"settings" : {
"analysis": {
"filter":{
"filter_metaphone":{
"encoder": "metaphone",
"type": "phonetic",
"replace": "false"
},
"filter_unused":{
"type": "edgeNGram",
"max_gram": "10",
"min_gram": "1"
}
},
"analyzer":{
"name":{
"type": "custom",
"filter": ["filter_metaphone"],
"tokenizer": "standard"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法通过curl删除过滤器"filter_unused"而不删除并使用新的设置配置创建索引?