20.15. Indexing

[Note]Note

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

For more details about indexes and the optional schema in Neo4j, see the section called “Schema”.

Create index

This will start a background job in the database that will create and populate the index. You can check the status of your index by listing all the indexes for the relevant label.

Example request

  • POST http://localhost:7474/db/data/schema/index/label_1465360186231_1
  • Accept: application/json; charset=UTF-8
  • Content-Type: application/json
{
  "property_keys" : [ "property_1465360186231_1" ]
}

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
{
  "label" : "label_1465360186231_1",
  "property_keys" : [ "property_1465360186231_1" ]
}

List indexes for a label

Example request

  • GET http://localhost:7474/db/data/schema/index/label_1465360186032_1
  • Accept: application/json; charset=UTF-8

Example response

  • 200: OK
  • Content-Type: application/json; charset=UTF-8
[ {
  "property_keys" : [ "property_1465360186032_1" ],
  "label" : "label_1465360186032_1"
} ]

Drop index

Drop index

Example request

  • DELETE http://localhost:7474/db/data/schema/index/label_1465360186161_1/property_1465360186161_1
  • Accept: application/json; charset=UTF-8

Example response

  • 204: No Content