Help with N1QL query using variables

You can pass the values as named parameters or positional parameters

select recordId
from Documents
where cultureCode = ‘en-US’
and recordId >=  $startid and recordId <=  $endid;

Set the $startid, $endid.

If you need further help let us know how you executing. Query Workbench, cbq shell, REST API, which SDK will point to the right place how to set those.