使用Ektorp ExecuteBulk()和ExecuteAllOrNothing()API在Cloudant CouchDB中执行批量更新时出错
我面临使用Ektorp executeBulk和ExecuteAllOrNothing函数对Cloudant数据库(CouchDB)中的文档列表进行批量更新的问题 对于使用Ektorp ExecuteBulk()和ExecuteAllOrNothing()API在Cloudant CouchDB中执行批量更新时出错,couchdb,bulkinsert,bulk,ektorp,cloudant,Couchdb,Bulkinsert,Bulk,Ektorp,Cloudant,我面临使用Ektorp executeBulk和ExecuteAllOrNothing函数对Cloudant数据库(CouchDB)中的文档列表进行批量更新的问题 对于couchDbConnector.executeAllOrNothing(列表),我得到如下错误: org.ektorp.DbAccessException: 417:Expectation Failed URI: /let-ut-app/_bulk_docs Response Body: null at org.ekt
couchDbConnector.executeAllOrNothing(列表)
,我得到如下错误:
org.ektorp.DbAccessException: 417:Expectation Failed
URI: /let-ut-app/_bulk_docs
Response Body:
null
at org.ektorp.http.StdResponseHandler.createDbAccessException(StdResponseHandler.java:44)
at org.ektorp.http.StdResponseHandler.error(StdResponseHandler.java:62)
at org.ektorp.http.RestTemplate.handleResponse(RestTemplate.java:98)
at org.ektorp.http.RestTemplate.post(RestTemplate.java:61)
at org.ektorp.impl.StdCouchDbConnector.executeBulk(StdCouchDbConnector.java:536)
at org.ektorp.impl.StdCouchDbConnector.executeAllOrNothing(StdCouchDbConnector.java:494)
如果我将相同的逻辑更改为使用executeBulk作为
couchDbConnector.executeBulk(列表)
错误消息如下所示:
org.ektorp.DbAccessException: 500:Internal Server Error
URI: /let-ut-app/_bulk_docs
Response Body:
{
"error" : "case_clause",
"reason" : "{12,11}",
"stack" : [ "fabric_doc_update:handle_message/3", "rexi_utils:process_mailbox/6", "rexi_utils:recv/6", "fabric_doc_update:go/3", "fabric:update_docs/3", "chttpd_db:db_req/2", "chttpd:handle_request/1", "mochiweb_http:headers/5" ]
}
at org.ektorp.http.StdResponseHandler.createDbAccessException(StdResponseHandler.java:44)
at org.ektorp.http.StdResponseHandler.error(StdResponseHandler.java:62)
at org.ektorp.http.RestTemplate.handleResponse(RestTemplate.java:98)
at org.ektorp.http.RestTemplate.post(RestTemplate.java:61)
at org.ektorp.impl.StdCouchDbConnector.executeBulk(StdCouchDbConnector.java:536)
at org.ektorp.impl.StdCouchDbConnector.executeBulk(StdCouchDbConnector.java:498)
请让我知道你们中是否有人遇到过这个问题,以及你们是如何解决的
谢谢你的帮助
太多了 我在cloudant服务器上看到了类似的情况。我直接使用rest客户端拨打电话: 不幸的是,此代码段不处理大容量保存的2个选项(UUID和all或none)。您可以查看couchrest代码并自己实现(但我没有这样做)
# this couchrest will throw an exception on some couchdb servers
# db.bulk_save(design_docs, false, true) # no uuids, all or nothing
bulk_docs = {'docs' => design_docs}
responses = CouchRest.post("#{db.root}/_bulk_docs", bulk_docs)