Search code examples
mapreducecouchdbcouchdb-futoncouchdb-2.0couchdb-3.x

timeout with couchdb mapReduce when database is huge


Details:

  • Apache CouchDB v. 3.1.1
  • about 5 GB of twitter data have been dumped in partitions

Map reduce function that I have written:

{
 "_id": "_design/Info",
 "_rev": "13-c943aaf3b77b970f4e787be600dd240e",
 "views": {
   "trial-view": {
     "map": "function (doc) {\n  emit(doc.account_name, 1);\n}",
     "reduce": "_count"
   }
 },
 "language": "javascript",
 "options": {
   "partitioned": true
 }
}

when I am trying the following command in postman:

http://<server_ip>:5984/mydb/_partition/partition1/_design/Info/_view/trial-view?key="BT"&group=true

I am getting following error:

{
    "error": "timeout",
    "reason": "The request could not be processed in a reasonable amount of time."
}

Kindly help me how to apply mapReduce on such huge data?


Solution

  • So, I thought of answering my own question, after realizing my mistake. The answer to this is simple. It just needed more time, as the indexing takes a lot of time. you can see the metadata to see the db data being indexed.