Drops one or more indexes of a table by name, on any database, and reports what happened to each one. A name the table does not have is NOT_FOUND, not an error.
Method
POST
URL
/api/system-api/admin/drop-indexes : admin is the user path of your account
Body
{ instance, database, collection | table, indexes: [ names ], ifExists?, continueOnError? } or an array of them
{"success":true,"statusCode":200,"data":[{"instance":"mysql8","database":"inventory","collection":"orders","name":"am_ix_orders_customer_id_status_3f9a1c","fields":["customer_id","status"],"status":"DROPPED"},{"instance":"mysql8","database":"inventory","collection":"orders","name":"old_idx_status","fields":[],"status":"NOT_FOUND","message":"The index \"old_idx_status\" does not exist."}]}
The fields of a dropped index are the ones it had. Every drop is logged in the index logs of Index Maker with its source.
constresults=awaitg.sys.system.dropIndexes({instance:'mysql8',database:'inventory',table:'orders',indexes:['am_ix_orders_customer_id_status_3f9a1c','old_idx_status'],ifExists:true,// default : a missing index is NOT_FOUNDcontinueOnError:true,// default : one refused drop does not stop the others});// results[0] : { status: 'DROPPED', fields: ['customer_id', 'status'], ... }// results[1] : { status: 'NOT_FOUND', message: 'The index "old_idx_status" does not exist.', ... }
results=awaitg.sys.system.drop_indexes('mysql8','inventory',table='orders',indexes=['am_ix_orders_customer_id_status_3f9a1c','old_idx_status'],if_exists=True,# default : a missing index is NOT_FOUNDcontinue_on_error=True,# default : one refused drop does not stop the others)# results[0] : { status: 'DROPPED', fields: ['customer_id', 'status'], ... }# results[1] : { status: 'NOT_FOUND', message: 'The index "old_idx_status" does not exist.', ... }
$results = $g->sys->system->dropIndexes( 'mysql8', 'inventory', table: 'orders', indexes: ['am_ix_orders_customer_id_status_3f9a1c', 'old_idx_status'], ifExists: true, // default : a missing index is NOT_FOUND continueOnError: true, // default : one refused drop does not stop the others);// results[0] : { status: 'DROPPED', fields: ['customer_id', 'status'], ... }// results[1] : { status: 'NOT_FOUND', message: 'The index "old_idx_status" does not exist.', ... }
varresults=awaitg.Sys.System.DropIndexes(newDropIndexes{Instance="mysql8",Database="inventory",Table="orders",Indexes=["am_ix_orders_customer_id_status_3f9a1c","old_idx_status"],IfExists=true,// default : a missing index is NOT_FOUNDContinueOnError=true,// default : one refused drop does not stop the others});// results[0] : { status: 'DROPPED', fields: ['customer_id', 'status'], ... }// results[1] : { status: 'NOT_FOUND', message: 'The index "old_idx_status" does not exist.', ... }
results,err:=g.Sys.System.DropIndexes(am.DropIndexes{Instance:"mysql8",Database:"inventory",Table:"orders",Indexes:[]string{"am_ix_orders_customer_id_status_3f9a1c","old_idx_status"},IfExists:am.Ptr(true),// default : a missing index is NOT_FOUNDContinueOnError:am.Ptr(true),// default : one refused drop does not stop the others})iferr!=nil{returnnil,err}// results[0] : { status: 'DROPPED', fields: ['customer_id', 'status'], ... }// results[1] : { status: 'NOT_FOUND', message: 'The index "old_idx_status" does not exist.', ... }
letresults=g.sys.system.drop_indexes(DropIndexes::default().instance("mysql8").database("inventory").table("orders").indexes(["am_ix_orders_customer_id_status_3f9a1c","old_idx_status"]).if_exists(true)// default : a missing index is NOT_FOUND.continue_on_error(true),// default : one refused drop does not stop the others)?;// results[0] : { status: 'DROPPED', fields: ['customer_id', 'status'], ... }// results[1] : { status: 'NOT_FOUND', message: 'The index "old_idx_status" does not exist.', ... }
varresults=g.sys.system.dropIndexes(newDropIndexes().instance("mysql8").database("inventory").table("orders").indexes("am_ix_orders_customer_id_status_3f9a1c","old_idx_status").ifExists(true)// default : a missing index is NOT_FOUND.continueOnError(true));// default : one refused drop does not stop the others// results[0] : { status: 'DROPPED', fields: ['customer_id', 'status'], ... }// results[1] : { status: 'NOT_FOUND', message: 'The index "old_idx_status" does not exist.', ... }
valresults=g.sys.system.dropIndexes(DropIndexes().instance("mysql8").database("inventory").table("orders").indexes("am_ix_orders_customer_id_status_3f9a1c","old_idx_status").ifExists(true)// default : a missing index is NOT_FOUND.continueOnError(true),// default : one refused drop does not stop the others)// results[0] : { status: 'DROPPED', fields: ['customer_id', 'status'], ... }// results[1] : { status: 'NOT_FOUND', message: 'The index "old_idx_status" does not exist.', ... }
Over HTTP, a system API answers once its settings give it apiAccessType: TOKEN_ACCESS (the token of an API user whose group grants this system API, in x-am-authorization) or IS_PUBLIC. Without settings it is NO_ACCESS : your code calls it through g.sys, the admin panel tests it, and an HTTP call is refused.
The settings can also cache the answer or require person tokens (authProviders) ; pre and post hooks run around it like around any API.
The request headers apply : x-am-response-case, x-am-content-type-response, x-am-internationalization, x-am-tenant-username…