What are the Cypher commands to delete index and index entry

ⅰ亾dé卋堺 提交于 2019-12-10 15:47:04

问题


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?


回答1:


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)



回答2:


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..



来源:https://stackoverflow.com/questions/17516809/what-are-the-cypher-commands-to-delete-index-and-index-entry

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!