index - edge index

How to add an edge index.


index('index_name').[outE('edgeLabel') | inE('edgeLabel') | bothE('edgeLabel')].by('propertykey_name').add()


An edge index specifies an index that is built using an edge property key in DSE Graph. A vertex label must be specified, and edge indexes are only defined in relationship to a vertex label. The index name must be unique.

An edge index can be created using either outgoing edges (outE()) from a vertex label, incoming edges (inE()) from a vertex label, or both outgoing and incoming (bothE()). The last type, bothE(), is rarely used, but could be used in a situation where the index must track both the incoming and outgoing edges from a particular vertex label. An example would be a graph storing reviewers who can both be liked and like other reviewers. To search for reviewers who are liked and who like a particular reviewer, both incoming and outgoing edges would be searched.


Create an index ratedByStars with an outE edge label using the property key stars. The vertex label is specified as reviewer.
Create an index ratedByStars2Way with a bothE edge label using the property key year. The edge index allows queries that find both recipes with a certain year and reviewers who gave a review in a certain year.
It can replace two indexes: