Reputation: 171
Spring Data Neo4j 4 does not support @Index annotation anymore. With standalone Neo4j database I have to deploy indexes on my own using its REST or web interface. However, with database in embedded mode there are no such interfaces. Do I have to deploy database in standalone mode, set appropriate indexes and then use database folder in embedded mode or use neo4j-shell to access database deployed by SDN4 after stopping the server with my application?
Upvotes: 0
Views: 72
Reputation: 19373
You could do what you suggested, or you can also get a handle to the GraphDatabaseService in your application and create the index using the Java API. Here's an example:
EmbeddedDriver embeddedDriver = (EmbeddedDriver) Components.driver();
GraphDatabaseService databaseService = embeddedDriver.getGraphDatabaseService();
try (Transaction tx = databaseService.beginTx()) {
databaseService.index().forNodes(indexName);
...
tx.success();
}
Update based on comment:
If using the HttpDriver, then you can send a request to the rest endpoint
String uri = Components.driver().getConfiguration().getURI() +
"/db/data/...";
HttpPost httpPost = new HttpPost(uri);
//Construct the JSON statements
try {
httpPost.setEntity(new StringEntity(json.toString()));
HttpRequest.execute(httpClient, httpPost,
Components.driver().getConfiguration().getCredentials());
} catch (Exception e) {
//Handle any exceptions
}
Upvotes: 4