Documents not available for Views immediately after insert

I insert documents into the buckets and on running views immediately after insertion, I get a RuntimeException: Timed out waiting for operation.
When I stop my program and run the operation, I immediately get the results.
Any way to get it to work in the same run?

When you perform a write or SET() it:

  1. writes it to memory
  2. puts it in the write que to persist to disk
  3. then after on disk puts it in the write que to view mapper/reducer.
  4. Then to retrieve the latest view set view to stale=false.
    If you have SSD then making the views is pretty fast. if you have spinning disk not a fast. Check your disk write que in the gui to see how long it is taking to persist to disk. the Graph will tell you in XX sec based on load.

I’m having the same problem.
Is there any way to overcome this?
My infrastructure is running on some EC2 instances, and sometimes I have to wait more than 15 seconds before I can retrieve my document again…

Maybe I’m doing something wrong?