3.5.1. Indexes

This section explains how to work with indexes in Neo4j and Cypher.

3.5.1.1. Introduction

A database index is a redundant copy of some of the data in the database for the purpose of making searches of related data more efficient. This comes at the cost of additional storage space and slower writes, so deciding what to index and what not to index is an important and often non-trivial task.

Cypher enables the creation of indexes on one or more properties for all nodes that have a given label:

  • An index that is created on a single property for any given label is called a single-property index.
  • An index that is created on more than one property for any given label is called a composite index. Differences in the usage patterns between composite and single-property indexes are detailed in the examples below.

Section 3.6.4, “Planner hints and the USING keyword” describes how to make the Cypher planner use specific indexes (especially in cases where the planner would not necessarily have used them).

Once an index has been created, it will automatically be managed and kept up to date by the database when the graph is changed. Neo4j will automatically pick up and start using the index once it has been created and brought online.

3.5.1.2. Create a single-property index

An index on a single property for all nodes that have a particular label can be created with CREATE INDEX ON :Label(property). Note that the index is not immediately available, but will be created in the background.

Query. 

CREATE INDEX ON :Person(firstname)

Result. 

+--------------------------------------------+
| No data returned, and nothing was changed. |
+--------------------------------------------+

3.5.1.3. Create a composite index

An index on multiple properties for all nodes that have a particular label — i.e. a composite index — can be created with CREATE INDEX ON :Label(prop1, …​, propN). Only nodes labeled with the specified label and which contain all the properties in the index definition will be added to the index. The following statement will create a composite index on all nodes labeled with Person and which have both an age and country property:

Query. 

CREATE INDEX ON :Person(age, country)

Assume we execute the query CREATE (a:Person {firstname: 'Bill', age: 34, country: 'USA'}), (b:Person {firstname: 'Sue', age: 39}). Node a has both an age and a country property, and so it will be added to the composite index. However, as node b has no country property, it will not be added to the composite index. Note that the composite index is not immediately available, but will be created in the background.

Result. 

+-------------------+
| No data returned. |
+-------------------+
Indexes added: 1

3.5.1.4. Get a list of all indexes in the database

Calling the built-in procedure db.indexes will list all the indexes in the database.

Query. 

CALL db.indexes

Result. 

+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
| description                   | label    | properties    | state    | type                  | provider                                   | failureMessage |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
| "INDEX ON :Person(firstname)" | "Person" | ["firstname"] | "ONLINE" | "node_label_property" | {version -> "2.0", key -> "lucene+native"} | ""             |
| "INDEX ON :Person(highScore)" | "Person" | ["highScore"] | "ONLINE" | "node_label_property" | {version -> "2.0", key -> "lucene+native"} | ""             |
| "INDEX ON :Person(location)"  | "Person" | ["location"]  | "ONLINE" | "node_label_property" | {version -> "2.0", key -> "lucene+native"} | ""             |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
3 rows

3.5.1.5. Drop a single-property index

An index on all nodes that have a label and single property combination can be dropped with DROP INDEX ON :Label(property).

Query. 

DROP INDEX ON :Person(firstname)

Result. 

+-------------------+
| No data returned. |
+-------------------+
Indexes removed: 1

3.5.1.6. Drop a composite index

A composite index on all nodes that have a label and multiple property combination can be dropped with DROP INDEX ON :Label(prop1, …​, propN). The following statement will drop a composite index on all nodes labeled with Person and which have both an age and country property:

Query. 

DROP INDEX ON :Person(age, country)

Result. 

+-------------------+
| No data returned. |
+-------------------+
Indexes removed: 1

3.5.1.7. Use index

There is usually no need to specify which indexes to use in a query, Cypher will figure that out by itself. For example the query below will use the Person(firstname) index, if it exists.

Query. 

MATCH (person:Person { firstname: 'Andy' })
RETURN person

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| Operator        | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other              |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| +ProduceResults |              1 |    1 |       0 |               0 |                 1 |               0.0000 | person    |                    |
| |               +----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| +NodeIndexSeek  |              1 |    1 |       3 |               0 |                 1 |               0.0000 | person    | :Person(firstname) |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+

Total database accesses: 3

3.5.1.8. Equality check using WHERE (single-property index)

A query containing equality comparisons of a single indexed property in the WHERE clause is backed automatically by the index. It is also possible for a query with multiple OR predicates to use multiple indexes, if indexes exist on the properties. For example, if indexes exist on both :Label(p1) and :Label(p2), MATCH (n:Label) WHERE n.p1 = 1 OR n.p2 = 2 RETURN n will use both indexes.

Query. 

MATCH (person:Person)
WHERE person.firstname = 'Andy'
RETURN person

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| Operator        | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other              |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| +ProduceResults |              1 |    1 |       0 |               0 |                 1 |               0.0000 | person    |                    |
| |               +----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| +NodeIndexSeek  |              1 |    1 |       3 |               0 |                 1 |               0.0000 | person    | :Person(firstname) |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+

Total database accesses: 3

3.5.1.9. Equality check using WHERE (composite index)

A query containing equality comparisons for all the properties of a composite index will automatically be backed by the same index. The following query will use the composite index defined earlier:

Query. 

MATCH (n:Person)
WHERE n.age = 35 AND n.country = 'UK'
RETURN n

However, the query MATCH (n:Person) WHERE n.age = 35 RETURN n will not be backed by the composite index, as the query does not contain an equality predicate on the country property. It will only be backed by an index on the Person label and age property defined thus: :Person(age); i.e. a single-property index. Moreover, unlike single-property indexes, composite indexes currently do not support queries containing the following types of predicates on properties in the index: existence check: exists(n.prop); range search: n.prop > value; prefix search: STARTS WITH; suffix search: ENDS WITH; and substring search: CONTAINS.

Result. 

+-------------------------------------------------------------------------------------------+
| n                                                                                         |
+-------------------------------------------------------------------------------------------+
| Node[0]{surname:"Smith",age:35,name:"john",highScore:54321,firstname:"John",country:"UK"} |
+-------------------------------------------------------------------------------------------+
1 row

3.5.1.10. Range comparisons using WHERE (single-property index)

Single-property indexes are also automatically used for inequality (range) comparisons of an indexed property in the WHERE clause. Composite indexes are currently not able to support range comparisons.

Query. 

MATCH (person:Person)
WHERE person.firstname > 'B'
RETURN person

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+
| Operator              | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other                                |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+
| +ProduceResults       |             10 |    1 |       0 |               0 |                 1 |               0.0000 | person    |                                      |
| |                     +----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+
| +NodeIndexSeekByRange |             10 |    1 |       3 |               0 |                 1 |               0.0000 | person    | :Person(firstname) > {  AUTOSTRING0} |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+

Total database accesses: 3

3.5.1.11. Multiple range comparisons using WHERE (single-property index)

When the WHERE clause contains multiple inequality (range) comparisons for the same property, these can be combined in a single index range seek.

Query. 

MATCH (person:Person)
WHERE 10000 < person.highScore < 20000
RETURN person

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-------------------------------------------------------------------------+
| Operator              | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other                                                                   |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-------------------------------------------------------------------------+
| +ProduceResults       |              5 |    1 |       0 |               0 |                 1 |               0.0000 | person    |                                                                         |
| |                     +----------------+------+---------+-----------------+-------------------+----------------------+-----------+-------------------------------------------------------------------------+
| +NodeIndexSeekByRange |              5 |    1 |       3 |               0 |                 1 |               0.0000 | person    | :Person(highScore) > {  AUTOINT1} AND :Person(highScore) < {  AUTOINT0} |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-------------------------------------------------------------------------+

Total database accesses: 3

3.5.1.12. List membership check using IN (single-property index)

The IN predicate on person.firstname in the following query will use the single-property index Person(firstname) if it exists.

Query. 

MATCH (person:Person)
WHERE person.firstname IN ['Andy', 'John']
RETURN person

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| Operator        | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other              |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| +ProduceResults |             24 |    2 |       0 |               2 |                 0 |               1.0000 | person    |                    |
| |               +----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| +NodeIndexSeek  |             24 |    2 |       5 |               2 |                 0 |               1.0000 | person    | :Person(firstname) |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+

Total database accesses: 5

3.5.1.13. List membership check using IN (composite index)

The IN predicates on person.age and person.country in the following query will use the composite index Person(age, country) if it exists.

Query. 

MATCH (person:Person)
WHERE person.age IN [10, 20, 35] AND person.country IN ['Sweden', 'USA', 'UK']
RETURN person

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+----------------------+
| Operator        | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other                |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+----------------------+
| +ProduceResults |            451 |    1 |       0 |               0 |                 0 |               0.0000 | person    |                      |
| |               +----------------+------+---------+-----------------+-------------------+----------------------+-----------+----------------------+
| +NodeIndexSeek  |            451 |    1 |      11 |               0 |                 0 |               0.0000 | person    | :Person(age,country) |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+----------------------+

Total database accesses: 11

3.5.1.14. Prefix search using STARTS WITH (single-property index)

The STARTS WITH predicate on person.firstname in the following query will use the Person(firstname) index, if it exists. Composite indexes are currently not able to support STARTS WITH.

Query. 

MATCH (person:Person)
WHERE person.firstname STARTS WITH 'And'
RETURN person

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-------------------------------------------------+
| Operator              | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other                                           |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-------------------------------------------------+
| +ProduceResults       |             26 |    1 |       0 |               1 |                 0 |               1.0000 | person    |                                                 |
| |                     +----------------+------+---------+-----------------+-------------------+----------------------+-----------+-------------------------------------------------+
| +NodeIndexSeekByRange |             26 |    1 |       3 |               1 |                 0 |               1.0000 | person    | :Person(firstname STARTS WITH $`  AUTOSTRING0`) |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+-------------------------------------------------+

Total database accesses: 3

3.5.1.15. Suffix search using ENDS WITH (single-property index)

The ENDS WITH predicate on person.firstname in the following query will use the Person(firstname) index, if it exists. All values stored in the Person(firstname) index will be searched, and entries ending with 'hn' will be returned. This means that although the search will not be optimized to the extent of queries using =, IN, >, < or STARTS WITH, it is still faster than not using an index in the first place. Composite indexes are currently not able to support ENDS WITH.

Query. 

MATCH (person:Person)
WHERE person.firstname ENDS WITH 'hn'
RETURN person

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+
| Operator               | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other                                |
+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+
| +ProduceResults        |             26 |    1 |       0 |               0 |                 0 |               0.0000 | person    |                                      |
| |                      +----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+
| +NodeIndexEndsWithScan |             26 |    1 |       3 |               1 |                 0 |               1.0000 | person    | :Person(firstname); $`  AUTOSTRING0` |
+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+

Total database accesses: 3

3.5.1.16. Substring search using CONTAINS (single-property index)

The CONTAINS predicate on person.firstname in the following query will use the Person(firstname) index, if it exists. All values stored in the Person(firstname) index will be searched, and entries containing 'h' will be returned. This means that although the search will not be optimized to the extent of queries using =, IN, >, < or STARTS WITH, it is still faster than not using an index in the first place. Composite indexes are currently not able to support CONTAINS.

Query. 

MATCH (person:Person)
WHERE person.firstname CONTAINS 'h'
RETURN person

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+
| Operator               | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other                                |
+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+
| +ProduceResults        |             26 |    1 |       0 |               0 |                 0 |               0.0000 | person    |                                      |
| |                      +----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+
| +NodeIndexContainsScan |             26 |    1 |       3 |               1 |                 0 |               1.0000 | person    | :Person(firstname); $`  AUTOSTRING0` |
+------------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------------------------+

Total database accesses: 3

3.5.1.17. Existence check using exists (single-property index)

The exists(p.firstname) predicate in the following query will use the Person(firstname) index, if it exists. Composite indexes are currently not able to support the exists predicate.

Query. 

MATCH (p:Person)
WHERE exists(p.firstname)
RETURN p

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| Operator        | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other              |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| +ProduceResults |              2 |    2 |       0 |               0 |                 0 |               0.0000 | p         |                    |
| |               +----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+
| +NodeIndexScan  |              2 |    2 |       4 |               0 |                 4 |               0.0000 | p         | :Person(firstname) |
+-----------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+--------------------+

Total database accesses: 4

3.5.1.18. Spatial distance searches (single-property index)

If a property with point values is indexed, the index is used for spatial distance searches as well as for range queries.

Query. 

MATCH (p:Person)
WHERE distance(p.location, point({ x: 1, y: 2 }))< 2
RETURN p.location

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------------------------------------------------------------------------+
| Operator              | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables       | Other                                                                             |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------------------------------------------------------------------------+
| +ProduceResults       |             15 |    9 |       0 |              30 |                 0 |               1.0000 | p, p.location   |                                                                                   |
| |                     +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------------------------------------------------------------------------+
| +Projection           |             15 |    9 |       9 |              30 |                 0 |               1.0000 | p.location -- p | {p.location : p.location}                                                         |
| |                     +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------------------------------------------------------------------------+
| +Filter               |             15 |    9 |       9 |              30 |                 0 |               1.0000 | p               | distance(p.location, point({x: $`  AUTOINT0`, y: $`  AUTOINT1`})) < $`  AUTOINT2` |
| |                     +----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------------------------------------------------------------------------+
| +NodeIndexSeekByRange |             15 |    9 |      11 |              30 |                 0 |               1.0000 | p               | :Person(location) WHERE distance(_,point(x,y)) < Parameter(  AUTOINT2,Integer)    |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------------+-----------------------------------------------------------------------------------+

Total database accesses: 29

3.5.1.19. Spatial bounding box searches (single-property index)

The ability to do index seeks on bounded ranges works even with the 2D and 3D spatial Point types.

Query. 

MATCH (person:Person)
WHERE point({ x: 1, y: 5 })< person.location < point({ x: 2, y: 6 })
RETURN person

Query Plan. 

Compiler CYPHER 3.4

Planner COST

Runtime INTERPRETED

Runtime version 3.4

+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------+
| Operator              | Estimated Rows | Rows | DB Hits | Page Cache Hits | Page Cache Misses | Page Cache Hit Ratio | Variables | Other                                                                                                                           |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------+
| +ProduceResults       |              7 |    1 |       0 |               7 |                 0 |               1.0000 | person    |                                                                                                                                 |
| |                     +----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------+
| +NodeIndexSeekByRange |              7 |    1 |       3 |               7 |                 0 |               1.0000 | person    | :Person(location) > point({x: {  AUTOINT2}, y: {  AUTOINT3}}) AND :Person(location) < point({x: {  AUTOINT0}, y: {  AUTOINT1}}) |
+-----------------------+----------------+------+---------+-----------------+-------------------+----------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------+

Total database accesses: 3

3.5.1.20. Use built-in procedures to manage and use explicit indexes

Explicit indexes are alternative data structures, in which a user can explicitly maintain search and seek data for nodes and relationships. These data structures are special-purpose and the procedures are primarily provided for users who have legacy deployments depending on such structures.

Signature Description

db.index.explicit.addNode

Add a node to an explicit index based on a specified key and value

db.index.explicit.addRelationship

Add a relationship to an explicit index based on a specified key and value

db.index.explicit.auto.searchNodes

Search nodes from explicit automatic index. Replaces START n=node:node_auto_index('key:foo*')

db.index.explicit.auto.searchRelationships

Search relationship from explicit automatic index. Replaces START r=relationship:relationship_auto_index('key:foo*')

db.index.explicit.auto.seekNodes

Get node from explicit automatic index. Replaces START n=node:node_auto_index(key = 'A')

db.index.explicit.auto.seekRelationships

Get relationship from explicit automatic index. Replaces START r=relationship:relationship_auto_index(key = 'A')

db.index.explicit.drop

Remove an explicit index - YIELD type, name, config

db.index.explicit.existsForNodes

Check if a node explicit index exists

db.index.explicit.existsForRelationships

Check if a relationship explicit index exists

db.index.explicit.forNodes

Get or create a node explicit index - YIELD type, name, config

db.index.explicit.forRelationships

Get or create a relationship explicit index - YIELD type, name, config

db.index.explicit.list

List all explicit indexes - YIELD type, name, config

db.index.explicit.removeNode(indexName

Remove a node from an explicit index with an optional key

db.index.explicit.removeRelationship

Remove a relationship from an explicit index with an optional key

db.index.explicit.searchNodes

Search nodes from explicit index. Replaces START n=node:nodes('key:foo*')

db.index.explicit.searchRelationships

Search relationship from explicit index. Replaces START r=relationship:relIndex('key:foo*')

db.index.explicit.searchRelationshipsBetween

Search relationship in explicit index, starting at the node 'in' and ending at 'out'

db.index.explicit.searchRelationshipsIn

Search relationship in explicit index, starting at the node 'in'

db.index.explicit.searchRelationshipsOut

Search relationship in explicit index, ending at the node 'out'

db.index.explicit.seekNodes

Get node from explicit index. Replaces START n=node:nodes(key = 'A')

db.index.explicit.seekRelationships

Get relationship from explicit index. Replaces START r=relationship:relIndex(key = 'A')

Table 3.385. db.index.explicit.addNode
Signature Description

db.index.explicit.addNode(indexName :: STRING?, node :: NODE?, key :: STRING?, value :: ANY?) :: (success :: BOOLEAN?)

Add a node to an explicit index based on a specified key and value

Table 3.386. db.index.explicit.addRelationship
Signature Description

db.index.explicit.addRelationship(indexName :: STRING?, relationship :: RELATIONSHIP?, key :: STRING?, value :: ANY?) :: (success :: BOOLEAN?)

Add a relationship to an explicit index based on a specified key and value

Table 3.387. db.index.explicit.auto.searchNodes
Signature Description

db.index.explicit.auto.searchNodes(query :: ANY?) :: (node :: NODE?, weight :: FLOAT?)

Search nodes from explicit automatic index. Replaces START n=node:node_auto_index('key:foo*')

Table 3.388. db.index.explicit.auto.searchRelationships
Signature Description

db.index.explicit.auto.searchRelationships(query :: ANY?) :: (relationship :: RELATIONSHIP?, weight :: FLOAT?)

Search relationship from explicit automatic index. Replaces START r=relationship:relationship_auto_index('key:foo*')

Table 3.389. db.index.explicit.auto.seekNodes
Signature Description

db.index.explicit.auto.seekNodes(key :: STRING?, value :: ANY?) :: (node :: NODE?)

Get node from explicit automatic index. Replaces START n=node:node_auto_index(key = 'A')

Table 3.390. db.index.explicit.auto.seekRelationships
Signature Description

db.index.explicit.auto.seekRelationships(key :: STRING?, value :: ANY?) :: (relationship :: RELATIONSHIP?)

Get relationship from explicit automatic index. Replaces START r=relationship:relationship_auto_index(key = 'A')

Table 3.391. db.index.explicit.drop
Signature Description

db.index.explicit.drop(indexName :: STRING?) :: (type :: STRING?, name :: STRING?, config :: MAP?)

Remove an explicit index - YIELD type, name, config

Table 3.392. db.index.explicit.existsForNodes
Signature Description

db.index.explicit.existsForNodes(indexName :: STRING?) :: (success :: BOOLEAN?)

Check if a node explicit index exists

Table 3.393. db.index.explicit.existsForRelationships
Signature Description

db.index.explicit.existsForRelationships(indexName :: STRING?) :: (success :: BOOLEAN?)

Check if a relationship explicit index exists

Table 3.394. db.index.explicit.forNodes
Signature Description

db.index.explicit.forNodes(indexName :: STRING?) :: (type :: STRING?, name :: STRING?, config :: MAP?)

Get or create a node explicit index - YIELD type, name, config

Table 3.395. db.index.explicit.forRelationships
Signature Description

db.index.explicit.forRelationships(indexName :: STRING?) :: (type :: STRING?, name :: STRING?, config :: MAP?)

Get or create a relationship explicit index - YIELD type, name, config

Table 3.396. db.index.explicit.list
Signature Description

db.index.explicit.list() :: (type :: STRING?, name :: STRING?, config :: MAP?)

List all explicit indexes - YIELD type, name, config

Table 3.397. db.index.explicit.removeNode
Signature Description

db.index.explicit.removeNode(indexName :: STRING?, node :: NODE?, key :: STRING?) :: (success :: BOOLEAN?)

Remove a node from an explicit index with an optional key

Table 3.398. db.index.explicit.removeRelationship
Signature Description

db.index.explicit.removeRelationship(indexName :: STRING?, relationship :: RELATIONSHIP?, key :: STRING?) :: (success :: BOOLEAN?)

Remove a relationship from an explicit index with an optional key

Table 3.399. db.index.explicit.searchNodes
Signature Description

db.index.explicit.searchNodes(indexName :: STRING?, query :: ANY?) :: (node :: NODE?, weight :: FLOAT?)

Search nodes from explicit index. Replaces START n=node:nodes('key:foo*')

Table 3.400. db.index.explicit.searchRelationships
Signature Description

db.index.explicit.searchRelationships(indexName :: STRING?, query :: ANY?) :: (relationship :: RELATIONSHIP?, weight :: FLOAT?)

Search relationship from explicit index. Replaces START r=relationship:relIndex('key:foo*')

Table 3.401. db.index.explicit.searchRelationshipsBetween
Signature Description

db.index.explicit.searchRelationshipsBetween(indexName :: STRING?, in :: NODE?, out :: NODE?, query :: ANY?) :: (relationship :: RELATIONSHIP?, weight :: FLOAT?)

Search relationship in explicit index, starting at the node 'in' and ending at 'out'

Table 3.402. db.index.explicit.searchRelationshipsIn
Signature Description

db.index.explicit.searchRelationshipsIn(indexName :: STRING?, in :: NODE?, query :: ANY?) :: (relationship :: RELATIONSHIP?, weight :: FLOAT?)

Search relationship in explicit index, starting at the node 'in'

Table 3.403. db.index.explicit.searchRelationshipsOut
Signature Description

db.index.explicit.searchRelationshipsOut(indexName :: STRING?, out :: NODE?, query :: ANY?) :: (relationship :: RELATIONSHIP?, weight :: FLOAT?)

Search relationship in explicit index, ending at the node 'out'

Table 3.404. db.index.explicit.seekNodes
Signature Description

db.index.explicit.seekNodes(indexName :: STRING?, key :: STRING?, value :: ANY?) :: (node :: NODE?)

Get node from explicit index. Replaces START n=node:nodes(key = 'A')

Table 3.405. db.index.explicit.seekRelationships
Signature Description

db.index.explicit.seekRelationships(indexName :: STRING?, key :: STRING?, value :: ANY?) :: (relationship :: RELATIONSHIP?)

Get relationship from explicit index. Replaces START r=relationship:relIndex(key = 'A')