下面是我試圖在我的彈性實體中創建索引的映射。我正在創建一個分析器和標記器來分析一個 url。我正在使用已安裝在我的彈性搜索實體中的自定義彈性搜索分析器。我的彈性搜索版本是 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
}
uj5u.com熱心網友回復:
該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"
}
}
}
}
}
}
}'
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/448768.html
上一篇:elasticsearchbulkinsert在寫執行緒佇列中占用多少空間?
下一篇:彈性搜索-僅存盤欄位
