2

I'm using gremlin-java. And I want to create a unique index and a composite-index. But Graph object doesn't provide createIndex function. I will work on aws-neptune.

Is there a way to create composite-index and unique-index on aws-neptune?

My expected indexes are:

CREATE INDEX ON :`VertexLabel1`(`country`,`value`)
CREATE UNIQUE INDEX ON :`VertexLabel2`(`x_id`)

Graph configuration:

@Bean
public Cluster gremlinCluster()
{
    return Cluster.build()
            .addContactPoint(GREMLIN_ENDPOINT)
            .port(GREMLIN_PORT)
            .enableSsl(GREMLIN_SSL_ENABLED)
            .create();
} 
...
@Bean
public GraphTraversalSource gremlinGraph(Cluster gremlinCluster)
{
    return traversal().withRemote(DriverRemoteConnection.using(gremlinCluster, "g"));
}
Sha
  • 921
  • 17
  • 46

1 Answers1

2

Every property and label that you add to Neptune is automatically indexed three different ways. There is no need to explicitly create an index. In fact Neptune does not have an index creation API. However, you can optionally enable integration with Elastic Search if you need to do full text search type indexing. The documentation describing the Neptune indices is here:

https://docs.aws.amazon.com/neptune/latest/userguide/feature-overview-data-model.html

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
  • Kelvin, but there is no multiple-property-index, only single-property index, isn't it? If it is, how does it achieve the multiple-property-index? – Sha Feb 23 '21 at 08:30
  • Neptune maintains (by default) 3 different indices and the query optimizer will commonly use more than one index at a time while processing a given query. – Kelvin Lawrence Feb 27 '21 at 17:28
  • @KelvinLawrence Right, but I think the question is saying "I want an index on the combination of these *n* properties", e.g., "I look this particular stuff up a lot". I don't think you can like the example, but you can add a synthetic property based off the desired props, which will then be indexed normally. – Dave Newton Dec 09 '22 at 19:42