Cannot drop primary index

DROP PRIMARY INDEX ‘BusinessCards’.‘Bcards-primary-index’;

I am getting a syntax error when trying to delete the primary index. Tried with/without quotes / with/without bucketname as prefix…no luck

Getting Status=400; code = 3000

DROP PRIMARY INDEX ON `BusinessCards`;
DROP INDEX  `BusinessCards`.`Bcards-primary-index`;
DROP INDEX  `BusinessCards`.`#primary`;

Tried all 3 individually. Still getting the exact same error message

don’t know…may be it doesn’t like ‘-’ in the name

Can you post complete error message you are getting.
Also post the output that of the record that you are dropping “SELECT * FROM system:indexes”

Sure.

[
{
“code”: 3000,
“msg”: “syntax error - at ON”,
“query_from_user”: “DROP INDEX ON OIIBusinessCards.Bcards-primary-index;”
}
]

{
“requestID”: “7377d384-5dc1-429b-9b11-ede565bcd304”,
“clientContextID”: “b4de4e21-14c1-46b1-b690-f970d0d2f219”,
“signature”: {
"": ""
},
“results”: [
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “5a9a7f18a8c2b5f4”,
“index_key”: [],
“is_primary”: true,
“keyspace_id”: “businessCards”,
“name”: “Bcards-primary-index”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “ecdae812e072a935”,
“index_key”: [],
“is_primary”: true,
“keyspace_id”: “OIIBusinessCards”,
“name”: “OIIBcards-primary-index”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “52f9d92d8b1ca09d”,
“index_key”: [
"(meta().id)"
],
“keyspace_id”: “bkt_businessCards”,
“name”: “id_ix”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “d389645607106064”,
“index_key”: [
"sourceairport"
],
“keyspace_id”: “travel-sample”,
“name”: “def_sourceairport”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “8a9626aee5ccb39c”,
“index_key”: [
"icao"
],
“keyspace_id”: “travel-sample”,
“name”: “def_icao”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “d69c6bdf9e4347b2”,
“index_key”: [
"city"
],
“keyspace_id”: “travel-sample”,
“name”: “def_city”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“condition”: “(type = “route”)”,
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “cece560385c7224c”,
“index_key”: [
"sourceairport",
"destinationairport",
"(distinct (array (v.day) for v in schedule end))"
],
“keyspace_id”: “travel-sample”,
“name”: “def_route_src_dst_day”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “45d16feaac0a5d4c”,
“index_key”: [],
“is_primary”: true,
“keyspace_id”: “businessCards”,
“name”: “Bcards-primary-index2”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “b90b9fcb0b9ac7f1”,
“index_key”: [
"CreatedOn"
],
“keyspace_id”: “OIIBusinessCards”,
“name”: “idxCreatedOn2”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “57a825be4f303d91”,
“index_key”: [],
“is_primary”: true,
“keyspace_id”: “bkt_businessCards”,
“name”: “BC-primary-index”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “4bc55fc556fabe2a”,
“index_key”: [
"type"
],
“keyspace_id”: “travel-sample”,
“name”: “def_type”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “236a9b5a9953a072”,
“index_key”: [
“array (s.utc) for s in schedule end”
],
“keyspace_id”: “travel-sample”,
“name”: “def_schedule_utc”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “c8f78a5502c9e66”,
“index_key”: [
"name"
],
“keyspace_id”: “bkt_businessCards”,
“name”: “id_ix1”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “60ad0e631cfc4f3a”,
“index_key”: [
"faa"
],
“keyspace_id”: “travel-sample”,
“name”: “def_faa”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“condition”: “(active = “0”)”,
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “145e34093776e6a”,
“index_key”: [
"active"
],
“keyspace_id”: “businessCards”,
“name”: “def_name_type”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “83894112d606e0b”,
“index_key”: [
"airportname"
],
“keyspace_id”: “travel-sample”,
“name”: “def_airportname”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“condition”: “(type is null)”,
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “d616d8b51a9b00e”,
“index_key”: [
"profile"
],
“keyspace_id”: “businessCards”,
“name”: “NullType”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“condition”: “(CreatedOn is not null)”,
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “32c0fcad80e64e18”,
“index_key”: [
"CreatedOn"
],
“keyspace_id”: “OIIBusinessCards”,
“name”: “idxCreatedOn”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “324c4a2d0606dbf6”,
“index_key”: [
"name"
],
“keyspace_id”: “bkt_businessCards”,
“name”: “id_ix3”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“condition”: “(Profile is null)”,
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “f6f08d8d8bcacb75”,
“index_key”: [
"profile"
],
“keyspace_id”: “businessCards”,
“name”: “NullProfile”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“condition”: “(_type = “User”)”,
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “346ee9b942a5e60a”,
“index_key”: [
"name"
],
“keyspace_id”: “travel-sample”,
“name”: “def_name_type”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
},
{
“indexes”: {
“datastore_id”: “http://127.0.0.1:8091”,
“id”: “24cab8f6114e48c1”,
“index_key”: [],
“is_primary”: true,
“keyspace_id”: “travel-sample”,
“name”: “def_primary”,
“namespace_id”: “default”,
“state”: “online”,
“using”: “gsi”
}
}
],
“status”: “success”,
“metrics”: {
“elapsedTime”: “121ms”,
“executionTime”: “121ms”,
“resultCount”: 22,
“resultSize”: 9861
}
}

You need to include the IDENTIFIERS in back ticks like below when there are special characters. You can also remove previous post if you any important information (As I requested only one matching record that you are dorpping). 
DROP INDEX  `OIIBusinessCards`.`Bcards-primary-index`;

I tried that already. Still getting the same error message:

[
{
“code”: 3000,
“msg”: “syntax error - at ON”,
“query_from_user”: “DROP INDEX ON OIIBusinessCards.Bcards-primary-index;”
}
]

Remove ON
 
DROP INDEX  `OIIBusinessCards`.`OIIBcards-primary-index`;

good
different message now
[
{
“code”: 5000,
“msg”: “GSI index Bcards-primary-index not found.”,
“query_from_user”: “DROP INDEX OIIBusinessCards.Bcards-primary-index;”
}
]

Gave proper index name

DROP INDEX  `OIIBusinessCards`.`OIIBcards-primary-index`;

IT WORKED this time !

Thanks!