版本 6.4
索引1:
curl -X PUT "localhost:9200/index1?pretty" -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"index1": {
"properties": {....}
} } '
索引2:
curl -X PUT "localhost:9200/index2?pretty" -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"index2": {
"properties": {....}
} } '
数据同步
curl -u elastic:elastic -X POST "127.0.0.1:9200/_reindex?pretty" -H 'Content-Type: application/json' -d'
{
"source": {
"index": "index1"
},
"dest": {
"index": "index2"
}
}'
报错: Rejecting mapping update to [XXX] as the final mapping would have more than 1 type
===========
解决办法: 把index2中的type设成和index1中的同名才行
索引2:
curl -X PUT "localhost:9200/index2?pretty" -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"index1": {
"properties": {....}
} } '
-------------
总结: es 就TMD是个坑货