Search code examples
neo4jfull-text-searchneo4j-apoc

Neo4j Aura does not support apoc.cypher.runSchema


Is there a workaround for this apoc call on neo4j Aura? I need it to be able to create a fulltext search index.

If I try it with apoc.cypher.run this error occurs:

Neo.ClientError.Security.Forbidden 
Schema operations on database 'neo4j' are not allowed for user 'neo4j' with FULL overridden by READ.

Neo4j query:

CALL db.propertyKeys() YIELD propertyKey 
CALL db.labels() YIELD label 
WITH apoc.text.join(collect(DISTINCT propertyKey), "`, n.`") as properties, apoc.text.join(collect(DISTINCT label), "`|`") AS labels 
CALL apoc.cypher.runSchema("CREATE FULLTEXT INDEX fullSearchIndex FOR(n:`" + labels + "`) ON EACH [n.`"+properties+"`]", {}) YIELD value RETURN value

Solution

  • Only a subset of what APOC offers is available to Aura. See the full list here: https://neo4j.com/docs/aura/platform/apoc/

    In your specific case, apoc.cypher.runSchema is only useful because you create statements dynamically and run them within a single query.

    Since apoc.cypher.runSchema cannot be used, you will need to create and run these statements on the client side.

    Run first:

    CALL db.propertyKeys() YIELD propertyKey 
    CALL db.labels() YIELD label 
    RETURN collect(DISTINCT propertyKey) as properties, collect(DISTINCT label) AS labels
    

    Process the results in C# and create the statements there.

    Then, you can run the statements one by one.

    It's obviously less efficient than doing everything on the server side but I don't think there is a way around it.