Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-12-2022 07:16 AM
I want write a cypher query that shows the index names of a certain type so that I can drop them. I'm using Neo4J-Enterprise v4.4.6 on an AWS EC2 instance running the most recent version of Rocky Linux (CentOS 8).
The documentation asserts that this can be done:
One of the output columns from SHOW INDEXES is the name of the index. This can be used to drop the index with the DROP INDEX command.
I can't find a cypher incantation that puts the name in scope so that I can then drop it.
For example, I can get the name (and type) like this:
SHOW INDEXES YIELD name, type WHERE type='LOOKUP'
This displays the name in Neo4J browser ("index_343aff4e", "index_f7700477" in my case).
How do I then pass the name to `DROP INDEX ..."?
I've tried various permutations of "WITH" and even tried a subquery with no joy.
For example, I tried the following:
CALL {
SHOW INDEXES YIELD name, type WHERE type='LOOKUP'
}
RETURN name, type
Cypher complains that "SHOW" doesn't work inside the sub-query.
I don't see anything in the docs or on stackoverflow that clarifies this.
05-12-2022 04:58 PM
show indexes yield *
will report many more columns then the default show indexes
.
this does include a column named createStatement
To get a Drop statement one can run
show indexes yield name return 'DROP INDEX ' + name + ';' ;
will create the DROP statements
05-17-2022 12:19 PM
I appreciate your response.
When I get neo4j back on its feet again, I'll try it.
All the sessions of the conference are now available online