I currently have 2 clusters installed on Linux. After I do XDCR from one bucket to another, if I query on the destination bucket, it always returns 0 result even though I can see the number of data on the bucket. I have secondary indexes placed before I did XDCR.
Hmm okay, on the face of it all that looks goodâŚdid you copy/paste those directly from your cluster and command-line? Keep in mind that even the smallest typo or mis-capitalization in the query will result in it not finding the document.
You can also look at the stats for each of those indexes (go to buckets->statistics and scroll down) to make sure that some items have actually been indexed.
Iâm sure this is a simple problem, itâs pretty straightforward functionality we just need to find the missing link.
When you say âdoesnât return anythingââŚdoes it return "results": [] or does it give you an error? Are you running from within the SDK or via the command-line?
That shouldnât matter, the indexes will keep themselves up to date either way.
Iâm a bit turned around nowâŚif you query through the Documents page in the Web Console, it should say âNo Resultsâ if it canât find anythingâŚbut if you query through the Query Editor or the command-line, you should receive "results":[]âŚcan you maybe send a screenshot of what youâre running and what the output is?
Well this is certainly getting interesting . All that looks reasonable and looks like it should be working.
Can you also try javaClass is not null in the WHERE clause?
Can you try manually adding a new document with the field "javaClass":"com.xc.apps.core.model.sales.Payment" ?
To be fair, Iâm testing this out along with you but Iâm using the Enterprise Edition 6.5 Beta so I suppose there could be a bug in that version of the Community EditionâŚI can try with that next but seems like a pretty big thing for us not to have picked up on.
Hmm okay, all very strange. I just tried it out on the same version youâre using and it all worked fine.
We can rule out anything w.r.t. XDCR since you just created a new document, so the issue must be somewhere within that cluster and would seem to be related to the query or indexer.
Can you go over to the Query link and try running the same commands from there? You can try: select * from sales where javaClass is not null explain select * from sales where javaClass is not null <- to see the index itâs using SELECT * from sales USE KEYS ("PAYMENT_1234"); <-to bypass any index scan select * from system:indexes; <- to make sure your indexes are online (although the query should fail anyway if it canât use an index)
The more I look at it the more I think thereâs a hidden issue with the indexer.
How many nodes do you have in this cluster?
You can try to manually kill the indexer process, it will be automatically restarted.
If that still doesnât work, can you try dropping and recreating the indexes?
Well we can see that the index has 38.5k âtotal indexed itemsâ which means it has actually captured those items. The â0 items scannedâ is showing you the throughputâŚand right now there are no requests so that makes sense.
Letâs also confirm that the query is using the right index: explain select * from sales where javaClass is not null
And you can also try forcing it to: select * from sales use index (idx_java_class) where javaClass is not null;
YesâŚI would expect to see more in there if thatâs how many you have. So that may also point to an issue with the indexer. We may need to take a look deeper in the logs.
If this is just for your development at the moment, you could also try spinning up an Enterprise Edition cluster with the 6.5 beta which will give us a lot more insight and error handling over 6.0âŚ