I’m using Couchbase server 4.5.1 with the node.js SDK. I’m also using couchbase-promises.
When the application start, it first check if all indexes are created and ready. If one or many are missing or are in deferred
mode it create and/or build it.
Once the query BUILD INDEX
has been terminated, it start running queries that will use those indexes. But when the first query is sent to the server, indexes are still in building
state and an error message is being thrown:
No index available for join term event
I tried to use the consistency
attribute, with REQUEST_PLUS
or STATEMENT_PLUS
but neither the first nor the second one resolved my issue.
Here is my code to run a query:
const query = async function(bucket, statement, params) {
const q = N1qlQuery.fromString(statement).consistency(N1qlQuery.Consistency.STATEMENT_PLUS);
return await bucket.queryAsync(q, params);
}
And it correctly run once all indexes are built.
How can I force the query to wait until all indexes are being correctly built? Or at least to wait for the indexes it must use?
Thank’s!