我想更改 ElasticSearch 中现有索引的分析器,但我无法弄清楚语法(而且我没有理解错误消息)。
GET /ccc_test/_mapping
{
"ccc_test": {
"mappings": {
"test_article": {
"properties": {
"id": {
"type": "text"
},
"language": {
"type": "text"
},
"text": {
"type": "text"
},
"title": {
"type": "text"
},
"url": {
"type": "keyword"
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
然后我用以下命令关闭索引:
POST /ccc_test/_close
Run Code Online (Sandbox Code Playgroud)
然后我尝试将“标题”字段的分析器更新为葡萄牙语:
PUT /ccc_test/_mapping/test_article
{
"properties" : {
"title" : {
"type" : "text",
"analyzer" : "portuguese"
}
}
}
Run Code Online (Sandbox Code Playgroud)
但我收到这个错误:
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[instance-0000000004][172.17.0.8:19760][indices:admin/mapping/put]"
}
],
"type": "illegal_argument_exception",
"reason": "Mapper for [title] conflicts with existing mapping in other types:\n[mapper [title] has different [analyzer]]"
},
"status": 400
}
Run Code Online (Sandbox Code Playgroud)
所以我不清楚什么有不同的分析仪。ccc_test 索引仅包含一种类型(test_article)。我使用的是 ElasticSearch 5.6
事实证明,你做不到我想做的事。正确答案是:
那么详细
POST /ccc_test_new
{
"mappings": {
"test_article": {
"properties": {
"id": {
"type": "text"
},
"language": {
"type": "text"
},
"text": {
"type": "text"
},
"title": {
"type": "text"
},
"url": {
"type": "keyword"
}
}
}
}
}
POST /_reindex
"""{
"source" : {
"index" : "ccc_test"
},
"dest" : {
"index" : "ccc_test_new",
"version_type" : "external"
}
}
POST /_aliases
{
"actions" : [
{
"add" : {
"index" : "ccc_test_new",
"alias" : "ccc_test"
}
},
{
"remove_index" : {
"index": "ccc_test"
}
}
]
}
归档时间: |
|
查看次数: |
7555 次 |
最近记录: |