illegal_argument_exception 弹性搜索错误
illegal_argument_exception error elasticsearch
下面是我的映射,我试图在我的弹性实例中为其创建索引。我正在创建一个分析器和分词器来分析 url。我正在使用已安装在我的 elasticsearch 实例中的自定义 elasticsearch 分析器。我的elasticsearch版本是5.6.16.
curl -X PUT localhost:9200/example-test?pretty -H 'Content-Type: application/json' -d'{
"settings": {
"analysis": {
"filter": {
"url_host": {
"type": "url",
"part": [
"protocol",
"whole",
"host",
"port",
"path",
"query",
"ref"
],
"url_decode": true,
"allow_malformed": true,
"passthrough": true,
"tokenize_malformed": true
}
},
"analyzer": {
"url_host": {
"filter": [
"url_host",
"lowercase"
],
"tokenizer": "split_on_non_word"
}
},
"tokenizer": {
"split_on_non_word": {
"type": "pattern",
"pattern": "\W+"
}
}
},
"mappings": {
"example_type": {
"properties": {
"url": {
"type": "text",
"fields": {
"url": {
"type": "string"
},
"host": {
"type": "string",
"analyzer": "url_host"
}
}
}
}
}
}
}
}'
但是当我尝试创建它时,出现以下错误。
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "unknown setting [index.mappings.example_type.properties.url.fields.host.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}
],
"type" : "illegal_argument_exception",
"reason" : "unknown setting [index.mappings.example_type.properties.url.fields.host.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status" : 400
}
mappings
部分应该是 settings
部分的兄弟。这将起作用:
curl -X PUT localhost:9200/example-test?pretty -H 'Content-Type: application/json' -d'{
"settings": {
"analysis": {
"filter": {
"url_host": {
"type": "url",
"part": [
"protocol",
"whole",
"host",
"port",
"path",
"query",
"ref"
],
"url_decode": true,
"allow_malformed": true,
"passthrough": true,
"tokenize_malformed": true
}
},
"analyzer": {
"url_host": {
"filter": [
"url_host",
"lowercase"
],
"tokenizer": "split_on_non_word"
}
},
"tokenizer": {
"split_on_non_word": {
"type": "pattern",
"pattern": ""
}
}
}
},
"mappings": {
"example_type": {
"properties": {
"url": {
"type": "text",
"fields": {
"url": {
"type": "string"
},
"host": {
"type": "string",
"analyzer": "url_host"
}
}
}
}
}
}
}'
下面是我的映射,我试图在我的弹性实例中为其创建索引。我正在创建一个分析器和分词器来分析 url。我正在使用已安装在我的 elasticsearch 实例中的自定义 elasticsearch 分析器。我的elasticsearch版本是5.6.16.
curl -X PUT localhost:9200/example-test?pretty -H 'Content-Type: application/json' -d'{
"settings": {
"analysis": {
"filter": {
"url_host": {
"type": "url",
"part": [
"protocol",
"whole",
"host",
"port",
"path",
"query",
"ref"
],
"url_decode": true,
"allow_malformed": true,
"passthrough": true,
"tokenize_malformed": true
}
},
"analyzer": {
"url_host": {
"filter": [
"url_host",
"lowercase"
],
"tokenizer": "split_on_non_word"
}
},
"tokenizer": {
"split_on_non_word": {
"type": "pattern",
"pattern": "\W+"
}
}
},
"mappings": {
"example_type": {
"properties": {
"url": {
"type": "text",
"fields": {
"url": {
"type": "string"
},
"host": {
"type": "string",
"analyzer": "url_host"
}
}
}
}
}
}
}
}'
但是当我尝试创建它时,出现以下错误。
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "unknown setting [index.mappings.example_type.properties.url.fields.host.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}
],
"type" : "illegal_argument_exception",
"reason" : "unknown setting [index.mappings.example_type.properties.url.fields.host.analyzer] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status" : 400
}
mappings
部分应该是 settings
部分的兄弟。这将起作用:
curl -X PUT localhost:9200/example-test?pretty -H 'Content-Type: application/json' -d'{
"settings": {
"analysis": {
"filter": {
"url_host": {
"type": "url",
"part": [
"protocol",
"whole",
"host",
"port",
"path",
"query",
"ref"
],
"url_decode": true,
"allow_malformed": true,
"passthrough": true,
"tokenize_malformed": true
}
},
"analyzer": {
"url_host": {
"filter": [
"url_host",
"lowercase"
],
"tokenizer": "split_on_non_word"
}
},
"tokenizer": {
"split_on_non_word": {
"type": "pattern",
"pattern": ""
}
}
}
},
"mappings": {
"example_type": {
"properties": {
"url": {
"type": "text",
"fields": {
"url": {
"type": "string"
},
"host": {
"type": "string",
"analyzer": "url_host"
}
}
}
}
}
}
}'