Search code examples
orientdb

How to create an index in orientdb (native java api)


I am getting the following warning when the graph starts to grow:

'bertex = false' fetched more than 50000 records: to speed up the execution, create an index or change the query to use an existent index

Is there a way to create the index from the java api?

I do not seem to find the right javadocs.

Thanks a lot!


Solution

  • Try this:

    graph.createKeyIndex("name", Vertex.class, new Parameter("type", "UNIQUE"));
    

    For more information take a look at this link: http://orientdb.com/docs/2.1/Graph-Database-Tinkerpop.html#using-indices

    Hope it helps.

    Regards