假设已经创建好了1.1.3中的 PropertyKeys 、1.2.3中的 VertexLabels 以及 1.3.3中的 EdgeLabels
POST http://localhost:8080/graphs/hugegraph/schema/indexlabels
{ "name": "personByCity", "base_type": "VERTEX_LABEL", "base_value": "person", "index_type": "SECONDARY", "fields": [ "city" ] }
202
{ "index_label": { "id": 1, "base_type": "VERTEX_LABEL", "base_value": "person", "name": "personByCity", "fields": [ "city" ], "index_type": "SECONDARY" }, "task_id": 2 }
GET http://localhost:8080/graphs/hugegraph/schema/indexlabels
200
{ "indexlabels": [ { "id": 3, "base_type": "VERTEX_LABEL", "base_value": "software", "name": "softwareByPrice", "fields": [ "price" ], "index_type": "RANGE" }, { "id": 4, "base_type": "EDGE_LABEL", "base_value": "created", "name": "createdByDate", "fields": [ "date" ], "index_type": "SECONDARY" }, { "id": 1, "base_type": "VERTEX_LABEL", "base_value": "person", "name": "personByCity", "fields": [ "city" ], "index_type": "SECONDARY" }, { "id": 3, "base_type": "VERTEX_LABEL", "base_value": "person", "name": "personByAgeAndCity", "fields": [ "age", "city" ], "index_type": "SECONDARY" } ] }
GET http://localhost:8080/graphs/hugegraph/schema/indexlabels/personByCity
200
{ "id": 1, "base_type": "VERTEX_LABEL", "base_value": "person", "name": "personByCity", "fields": [ "city" ], "index_type": "SECONDARY" }
删除 IndexLabel 会导致删除相关的索引数据,会产生一个异步任务
DELETE http://localhost:8080/graphs/hugegraph/schema/indexlabels/personByCity
202
{ "task_id": 1 }
注:
可以通过
GET http://localhost:8080/graphs/hugegraph/tasks/1
(其中“1”是task_id)来查询异步任务的执行状态,更多异步任务RESTful API