Immediate N1Ql Query is not giving the inserted data

Hi team,

I am calling java SDK insert/upsert API’s to insert data. & immediately I am using cluster.query API for querying the same data. but in 90% times I am not getting the inserted record immediately.

if I put pause of 200 ms or more between these two operations. then I am able to get the data for cluster.query.

Tried same approach with async cluster & sync cluster.
I am using
couchbase server : 6.5.1 CE
couchbase java SKD: 3.0.10

@Narayan I’m sure you read the documentation on that topic (N1QL Queries from the SDK | Couchbase Docs), but to highlight: by default it is eventually consistent, so you want to set the QueryScanConsistency.REQUEST_PLUS scan consistency on the query options to get “read your own write” semantics.

@daschl Thanks for your response. it worked for me.

but is there any way, so that upsert or insert api return response once data is committed with AsyncBucket.