N1QL query issue

Before updating document,N1QL query (SELECT * from bucketName where name = “XXXXX”) gives result but after updating document, above query doesn’t providing any result.However querying the same document with key(SELECT * from bucketName use keys “KKKKK”) provides result.What could be the issue…??

Couchase GSI indices are asynchronously maintained…meaning, it’ll take few milliseconds to seconds for the index to catch up to the update.
If you’ve updated the name field and have the index on it, there will be a lag when you do: stale=ok (unbounded)

See: https://blog.couchbase.com/2016/july/n1ql-scan-consistency-including-new-atplus-video

Yes,I know that there is lag but it have been more than 3 days and search query still not provinding any result.

WHERE (name = “XXXXX”); In this case name is a field in the document.
When you say USE KEYS “KKKKK”; this is a document ID.

Try this:
1. create a bucket named: b1
2. CREATE PRIMARY INDEX on b1;
3. CREATE INDEX i1 ON b1(b);
4. INSERT INTO b1 values(UUID(), {“a”:1, “b”:“Hello”});
5. SELECT * FROM b1 WHERE b = "Hello"
6. UPDATE b1 SET b = “World”;
7. SELECT * FROM b1 WHERE b = “World”;