使用elasticsearch-river-mongodb插件将数据从mongodb移动到elasticsearch时出错。
_river命令是:
curl -XPUT "localhost:9200/_river/ComponentUsageDataEntity/_meta" -d '
{
"type":"mongodb",
"mongodb":{
"servers":[{"host":"corp.com","port":27017 }],
"db":"udc","collection":"ComponentUsageDataEntity",
"script":"ctx.document.user2 = ctx.document.user;"
},
"index":{
"name":"udc","type":"ComponentUsageDataEntity"
}
}'
mongodb数据如下所示:
{
"_id" : ObjectId("5146cf67e4b0015f31b25cad"),
"user" : "Photoshop",
"module" : "EASE Get Latest Codex Build Plugin",
"comment" : "http://sj2slu348.corp.adobe.com:8088/",
"collectDate" : ISODate("2013-03-18T08:25:11.601Z")
}
我试图将user
重命名为user2
,但它失败了。似乎脚本不正确,但我不知道原因。
错误消息为SCRIPT_IMPORT_FAILED
:
[2014-07-24 19:05:22,680][WARN ][org.elasticsearch.river.mongodb.Indexer] failed to script process {id=51498345e4b0015f31b2692d, operation=i, document={ "_id" : { "$oid" : "51498345e4b0015f31b2692d"} , "user" : "easetest" , "module" : "EASE Cloud Plugin" , "comment" : "http://com:8080/" , "collectDate" : { "$date" : "2013-03-20T09:37:09.358Z"}}}, ignoring
org.elasticsearch.ElasticsearchIllegalArgumentException: script_lang not supported [js]
at org.elasticsearch.script.ScriptService.compile(ScriptService.java:143)
at org.elasticsearch.script.ScriptService.executable(ScriptService.java:151)
at org.elasticsearch.river.mongodb.Indexer.processBlockingQueue(Indexer.java:181)
at org.elasticsearch.river.mongodb.Indexer.run(Indexer.java:73)
at java.lang.Thread.run(Thread.java:745)
谢谢。
答案 0 :(得分:0)
您必须安装另一个Elasticsearch插件:Lang-Javascript 请在此处找到文档:https://github.com/elasticsearch/elasticsearch-lang-javascript/