Is there any way to manipulate the stale flag ?
I was running some tests, inserting a bunch of data and retrieving it right after with a N1QL query, and after I created an index for a field, querying by that field right after inserting the document was not working. I dug a bit and found some information about the stale flag, and thought that if I set it to false (force a view update before running the query) then I would be able to do the query right after inserting the data.
So is there a way to manipulate this stale flag on a N1QL query ?
N1QL does not yet provide a way to specify the stale parameter.
One option is to upgrade to Couchbase Server 3.0 Beta, which has much faster view index updates. If you do so, please use
CREATE PRIMARY INDEX
to create a primary index on your bucket before querying it via N1QL.