I am wondering if there is a script or way to use n1Ql to get all Indexes on a bucket, then drop them and recreate them ?
I can use SELECT name, keyspace_id FROM system:indexes
to get the name of my indexes but that does not give me the conditions etc to recreate it again.
My issue at heart is that my Indexes are all screwed up and i can neither can rebalnce nor can i restore a backup for any of my buckets that have a large amount of docs and large indexes. So my plan is to use N1Ql as the swiss pocket knife , get all my indexes and then drop them and start rebuilding after i have my cluster back and are able to rebalance
curl -v user:pass@<indexerhost>:9102/getIndexStatus
select RAW CONCAT("DROP INDEX `",keyspace_id,"`.`", name,"`;") from system:indexes;
curl -s user:pass@127.0.0.1:9102/getIndexStatus | jq -r '(.status[].definition) + ";"'
CREATE PRIMARY INDEX `#primary` ON `default`;
CREATE INDEX `ix1` ON `default`(`c21`);
CREATE INDEX `ix10` ON `default`(`c1`);
CREATE INDEX `ix2` ON `default`(`c11`) WHERE (`type` = "source");