Description
I was trying to update/test the example code for https://docs.couchbase.com/nodejs-sdk/current/howtos/full-text-searching-with-sdk.html#consistency and found some issues with scan consistency.
It would be good to get some clarification on whether we should tell users to use `consistentWith` or `consistency` in the search query options for the Node SDK.
For example looking at the Python docs we have both options documented: https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#scanconsistency-and-consistentwith
Also, regardless of which option I use there seem to be errors. Maybe my code is incorrect, would appreciate some feedback on how to make this work if that's the case. Or this could be a bug, please let me know.
Example consistentWith:
async function ftsAirlineByDateRange(startDate, endDate) {
|
const mutationResult = await collection.upsert('airline_fts', { |
name: 'AirlineFTS', |
created: new Date('2010-11-10 18:33:50 +0300'), |
type: 'airline', |
})
|
const mutationState = new couchbase.MutationState(mutationResult.token) |
return await cluster.searchQuery( |
'travel-sample-index', |
couchbase.SearchQuery.dateRange().start(startDate).end(endDate),
|
{
|
limit: 5, |
consistentWith: mutationState,
|
}
|
)
|
}
|
|
result = await ftsAirlineByDateRange('2010-11-10', '2010-11-20') |
Error:
/modules/node_modules/couchbase/dist/bindingutilities.js:194 |
return new errs.ParsingFailureError(codeErr, context); |
^ParsingFailureError: parsing failure
|
at Object.translateCppError (/modules/node_modules/couchbase/dist/bindingutilities.js:194:20) |
at /modules/node_modules/couchbase/dist/connection.js:237:54 { |
cause: LibcouchbaseError: libcouchbase error 208 |
at Object.translateCppError (/modules/node_modules/couchbase/dist/bindingutilities.js:174:21) |
at /modules/node_modules/couchbase/dist/connection.js:237:54 { |
code: 208 |
},
|
context: SearchErrorContext {
|
error_message: 'rest_index: Query, indexName: travel-sample-index, err: bleve: QueryBleve parsing queryCtlParams, err: cbgt.QueryCtlParams: Ctl: cbgt.QueryCtl: Consistency: cbgt.ConsistencyParams: Vectors: readUint64: unexpected character: �, error found in #10 byte of ...|":{"599":[132,"19833|..., bigger context ...|vel":"at_plus","vectors":{"travel-sample":{"599":[132,"198332723028427"]}}},"timeout":75000},"indexN|...', |
index_name: 'travel-sample-index', |
query: '', |
parameters: '', |
http_response_code: 400, |
http_response_body: '' |
}
|
}
|
Example consistency:
result = await cluster.searchQuery(
|
'travel-sample-index', |
couchbase.SearchQuery.match('swanky'), |
{ consistency: couchbase.SearchScanConsistency.NotBounded }
|
)
|
Error:
[Error: LCB_ERR_HTTP (1053): HTTP Operation failed. Inspect status code for details] { |
code: 1053, |
ctxtype: 'search', |
error_message: 'rest_index: Query, indexName: travel-sample-index, err: bleve: QueryBleve validating consistency, err: unsupported consistencyLevel: not_bounded', |
index_name: 'travel-sample-index', |
query: '', |
parameters: '', |
http_response_code: 400, |
http_response_body: '' |
}
|