How does stale query work?
Sorry, I know the documentation is very clear about how stale=ok should work. But, I am not seeing the right behavior.
I am running a _count reduce query with stale set to OK.
Query query = new Query(); query.setKey(key); query.setIncludeDocs(true); query.setReduce(true); query.setStale(Stale.OK);
I add a new document that changes the _count. I wait for about 10 seconds and then run the above query. I expect that automatic index to have run by now and should retrieve the latest count. But, I get back the old count. If the run the query again, I get the latest updated count. So, the system is behaving more like Stale.UPDATE_AFTER.
I have checked the auto index setting by running:
I get back:
Am I misunderstanding the way stale queries work? Thank you.
What is your version of Couchbase Server? Java Client?
Is it possible to provide us with some sample output screenshots on what you are seeing?
If **stale=ok** is set, Couchbase will not refresh the view even if it is stale. The benefit of this is a an improved query latency. If **stale=update_after** is set, Couchbase will update the view **after** the stale result is returned. If **stale=false** is set, Couchbase will refresh the view and return you most updated results.
Hope this helps!