4

If I use the default Lucene index engine, what is the Cypher command to delete an index? and what is the Cypher command to delete an index entry within a specific index?

William Zhang
  • 125
  • 3
  • 9

2 Answers2

6

I do not know if your question is out of date because you know use a newer version of Neo4j but in version 2.2.1 there is the possibility to drop an index using Cypher via

DROP INDEX ON :Label(property)
d.r.91
  • 123
  • 1
  • 5
0

Well, I'm not sure if there's a way to delete an Index using Cypher..

But you can do it using Neo4j API as follows:

for ( String indexName : server.getDatabase().graph.index()
                    .nodeIndexNames() )
            {
                    try{
                        server.getDatabase().graph.index()
                                .forNodes( indexName )
                                .delete();
                    } catch(UnsupportedOperationException e) {
                            // Encountered a read-only index.
                    }
            }

            for ( String indexName : server.getDatabase().graph.index()
                    .relationshipIndexNames() )
            {
                    try {
                        server.getDatabase().graph.index()
                                .forRelationships( indexName )
                                .delete();
                    } catch(UnsupportedOperationException e) {
                            // Encountered a read-only index.
                    }
            }

You can have a look here, it may help you..

  • Hi ManSour, Thanks for the answer. I found that the Cypher command to delete an index is: index --delete "index_name". But still do not know the Cypher command to delete an index entry within a specific index. – William Zhang Jul 09 '13 at 18:06