cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Missing Indexes - solved

Hello folks,

I have a node like this:

@NodeEntity
public class ExampleNode {

    @GraphId
    Long id;

    @Index
    String symbol;  

//two additional attributes with the Index annotation and a few more without
}

I use the embedded driver to create the nodes but when I run the CALL db.indexes it returns nothing... Am I doing something wrong?

1 REPLY 1

Apparently the Index annotation is not enough, indexing is disabled by default. You need to change your configuration to enable indexing:

  @Value("${spring.data.neo4j.uri}")
  private String embeddedDataDir;

  @Primary
  @Bean
  public SessionFactory sessionFactory() {
    org.neo4j.ogm.config.Configuration config = new org.neo4j.ogm.config.Configuration();

    config
            .driverConfiguration()
            .setDriverClassName("org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver")
            .setURI(embeddedDataDir);
    config.autoIndexConfiguration().setAutoIndex("assert");
    return new SessionFactory(config, "com.example");
  }