Build all scopes indexes in a bucket when deffered state is true

Hi team ,

please share any script to build all deferred indexes at once in a bucket. I am using below for one scope and looking for all scopes including default scope indexes at once .

BUILD INDEX ON landmark ((
SELECT RAW name
FROM system:indexes
WHERE keyspace_id = ‘landmark’
AND scope_id = ‘inventory’
AND bucket_id = ‘travel-sample’
AND state = ‘deferred’ ));

Query for the list of all scopes and iterate over the list.

1 Like