在将数据从一个elasticsearch服务器迁移到另一个服务器时,如何解决elasticdump api中的缩进错误



在回答如何将数据从一个弹性搜索服务器迁移到另一个服务器时,我运行了复制映射的命令,并得到了以下错误:

sudo elasticdump --input=localhost:9200/e0399e012222b9fe70ec7949d1cc354f17369f20 --output=A.B.C.D:9200/e0399e012222b9fe70ec7949d1cc354f17369f20 --type=mapping                                   
Wed, 12 Dec 2018 07:01:31 GMT | starting dump
events.js:160
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, open 'localhost:9200/e0399e012222b9fe70ec7949d1cc354f17369f20'
at Error (native)

我该如何解决这个问题,或者有其他更好的方法来解决这个问题吗?

首先,您需要在URL前面加上http://,否则会弹性转储它处理的文件。

sudo elasticdump --input=http://localhost:9200/e0399e012222b9fe70ec7949d1cc354f17369f20 --output=http://35.200.253.43:9200/e0399e012222b9fe70ec7949d1cc354f17369f20 --type=mapping  
^
|
add this (also for output -->)

然后,您遇到的第二个错误与源索引中有1000多个字段有关。你可以通过在运行elasticdump:之前运行这个来更改目标索引中的设置来绕过这个问题

curl -XPUT -H 'Content-type: application/json' http://35.200.253.43:9200/e0399e012222b9fe70ec7949d1cc354f17369f20/_settings -d '{
"index" : {
"mapping" : {
"total_fields" : {
"limit" : "2000"
}
}
}
}'

最新更新