elasticsearch 地图弹性搜索的再创造
我已经通过elasticsearch和kibana创建了我的索引,并上传了数据。现在我想更改索引的映射,并将一些字段更改为“未分析”。下面是我要从现有映射替换的映射。但当我在命令下面运行时,它会给我错误 {“错误”:{“根本原因”:[{“类型”:“索引已存在”\u异常”,“原因”:“已存在” 存在”,“索引”:“rettrmt”}],“类型”:“索引已存在\u异常”,“原因”:“已存在” 存在,“索引”:“rettrmt”},“状态”:400} 请帮我把它弄近elasticsearch 地图弹性搜索的再创造,elasticsearch,logstash,kibana,bigdata,elasticsearch,Logstash,Kibana,Bigdata,我已经通过elasticsearch和kibana创建了我的索引,并上传了数据。现在我想更改索引的映射,并将一些字段更改为“未分析”。下面是我要从现有映射替换的映射。但当我在命令下面运行时,它会给我错误 {“错误”:{“根本原因”:[{“类型”:“索引已存在”\u异常”,“原因”:“已存在” 存在”,“索引”:“rettrmt”}],“类型”:“索引已存在\u异常”,“原因”:“已存在” 存在,“索引”:“rettrmt”},“状态”:400} 请帮我把它弄近 curl -XPUT 'http:
curl -XPUT 'http://10.56.139.61:9200/rettrmt' -d '{
"rettrmt": {
"aliases": {},
"mappings": {
"RETTRMT": {
"properties": {
"@timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"@version": {
"type": "string"
},
"acid": {
"type": "string"
},
"actor_id": {
"type": "string",
"index": "not_analyzed"
},
"actor_type": {
"type": "string",
"index": "not_analyzed"
},
"channel_id": {
"type": "string",
"index": "not_analyzed"
},
"circle": {
"type": "string",
"index": "not_analyzed"
},
"cr_dr_indicator": {
"type": "string",
"index": "not_analyzed"
},
"host": {
"type": "string"
},
"message": {
"type": "string"
},
"orig_input_amt": {
"type": "double"
},
"path": {
"type": "string"
},
"r_cre_id": {
"type": "string"
},
"sub_use_case": {
"type": "string",
"index": "not_analyzed"
},
"tran_amt": {
"type": "double"
},
"tran_id": {
"type": "string"
},
"tran_particulars": {
"type": "string"
},
"tran_particulars_2": {
"type": "string"
},
"tran_remarks": {
"type": "string"
},
"tran_sub_type": {
"type": "string"
},
"tran_timestamp": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"tran_type": {
"type": "string"
},
"type": {
"type": "string"
},
"use_case": {
"type": "string",
"index": "not_analyzed"
}
}
}
},
"settings": {
"index": {
"creation_date": "1457331693603",
"uuid": "2bR0yOQtSqqVUb8lVE2dUA",
"number_of_replicas": "1",
"number_of_shards": "5",
"version": {
"created": "2000099"
}
}
},
"warmers": {}
}
}'
首先需要删除索引,然后使用正确的映射重新创建它。这里您将得到一个错误
索引\u已存在\u异常
,因为您试图在旧索引仍然存在的情况下创建索引,从而导致冲突
首先运行以下命令:
curl -XDELETE 'http://10.56.139.61:9200/rettrmt'
然后可以再次运行命令。请注意,这将删除您的数据,因此您必须重新填充索引。您是否尝试过类似的操作
curl -XPUT 'http://10.56.139.61:9200/rettrmt/_mapping/RETTRMT' -d '
{
"properties": {
"actor_id": { // or whichever properties you want to add
"type": "string",
"index": "not_analyzed"
}
}
}
对我有效如果我要删除索引,它也会删除数据,不是吗?但是我已经删除了索引,所以它也删除了数据,然后再次运行我的命令以更改映射。它只是把映射放在我需要的地方,但当我再次上传数据,然后通过kibana再次看到字段已分析,而我没有在映射中进行分析。猜猜我做错了什么。是的,但是如果你想更改映射,你真的没有选择的余地。你能分享一个你正在索引的文档,以及你认为不应该分析的字段吗?你有gmail吗?这样我们就可以快速聊天讨论?这真的很有帮助。