17.11. Indexing

17.11.1. Create schema index
17.11.2. List indexes for a label
17.11.3. Drop schema index
[Note]Note

This documents schema based indexes, a feature that was introduced in Neo4j 2.0, see Section 17.15, “Legacy indexing” for legacy indexing.

For more details about schema based indexes and the optional schema in Neo4j, see Section 3.7, “Schema”.

17.11.1. Create schema index

This will start a background job in the database that will create and populate the new index. You can check the status of your index by listing all the indexes for the relevant label. The new index will show up, but have a state of "POPULATING" until the index is ready.

Figure 17.55. Final Graph


Example request

  • POST http://localhost:7474/db/data/schema/index/person
  • Accept: application/json
  • Content-Type: application/json
{
  "property_keys" : [ "name" ]
}

Example response

  • 200: OK
  • Content-Type: application/json
{
  "label" : "person",
  "property-keys" : [ "name" ]
}

17.11.2. List indexes for a label

Figure 17.56. Final Graph


Example request

  • GET http://localhost:7474/db/data/schema/index/user
  • Accept: application/json

Example response

  • 200: OK
  • Content-Type: application/json
[ {
  "label" : "user",
  "property-keys" : [ "name" ]
} ]

17.11.3. Drop schema index

Drop schema index

Figure 17.57. Final Graph


Example request

  • DELETE http://localhost:7474/db/data/schema/index/SomeLabel/name
  • Accept: application/json

Example response

  • 204: No Content