AddIndex

Creates a new index.

Parameters

  • index_type: Specifies if the index if for entities or connections.
  • class: Specified the class of the entity/connection.
  • property_key: Specifies the name of the property indexed.
  • property_type: Specifies the property type.
  • [optional] populate: boolean to indicate whether we should look through existing metadata and add existing entities/connections to the new index.

Details

This command checks if the index already exists and adds one if it doesn’t. The matches are case sensitive for all the parameters.

The index_type parameter can be either “entity” or “connection”.

The property_type parameters specified the data type for the index. The suppoerted types are:

  • “boolean”
  • “integer”
  • “float”
  • “string”
  • “time”

If populate is true (default) and the graph is very large (> 10 million entities or connections to traverse), it is likely that the transaction might fail due to lack of resources. The support for such queries will be improved in future releases.

It is advisable to do only one AddIndex call per query, particularly if populate is going to be true.

Examples

Create an index for the String property “name” for the entities of the class “Person”:

[ {
    "AddIndex" : {
        "index_type":    "entity",
        "class" :        "Person",
        "property_key" : "name",
        "property_type": "string",
        "populate":      false
    }
}]