IndexLabel API

1.5 IndexLabel

Assuming PropertyKeys from version 1.1.3, VertexLabels from version 1.2.3, and EdgeLabels from version 1.3.3 have already been created.

1.5.1 Create an IndexLabel

Method & Url
1. POST http://localhost:8080/graphs/hugegraph/schema/indexlabels
Request Body
1. {
2. "name": "personByCity",
3. "base_type": "VERTEX_LABEL",
4. "base_value": "person",
5. "index_type": "SECONDARY",
6. "fields": [
7. "city"
8. ]
9. }
Response Status
1. 202
Response Body
1. {
2. "index_label": {
3. "id": 1,
4. "base_type": "VERTEX_LABEL",
5. "base_value": "person",
6. "name": "personByCity",
7. "fields": [
8. "city"
9. ],
10. "index_type": "SECONDARY"
11. },
12. "task_id": 2
13. }

1.5.2 Get all IndexLabels

Method & Url
1. GET http://localhost:8080/graphs/hugegraph/schema/indexlabels
Response Status
1. 200
Response Body
1. {
2. "indexlabels": [
3. {
4. "id": 3,
5. "base_type": "VERTEX_LABEL",
6. "base_value": "software",
7. "name": "softwareByPrice",
8. "fields": [
9. "price"
10. ],
11. "index_type": "RANGE"
12. },
13. {
14. "id": 4,
15. "base_type": "EDGE_LABEL",
16. "base_value": "created",
17. "name": "createdByDate",
18. "fields": [
19. "date"
20. ],
21. "index_type": "SECONDARY"
22. },
23. {
24. "id": 1,
25. "base_type": "VERTEX_LABEL",
26. "base_value": "person",
27. "name": "personByCity",
28. "fields": [
29. "city"
30. ],
31. "index_type": "SECONDARY"
32. },
33. {
34. "id": 3,
35. "base_type": "VERTEX_LABEL",
36. "base_value": "person",
37. "name": "personByAgeAndCity",
38. "fields": [
39. "age",
40. "city"
41. ],
42. "index_type": "SECONDARY"
43. }
44. ]
45. }

1.5.3 Get IndexLabel by name

Method & Url
1. GET http://localhost:8080/graphs/hugegraph/schema/indexlabels/personByCity
Response Status
1. 200
Response Body
1. {
2. "id": 1,
3. "base_type": "VERTEX_LABEL",
4. "base_value": "person",
5. "name": "personByCity",
6. "fields": [
7. "city"
8. ],
9. "index_type": "SECONDARY"
10. }

1.5.4 Delete IndexLabel by name

Deleting an IndexLabel will result in the deletion of related index data. This operation will generate an asynchronous task.

Method & Url
1. DELETE http://localhost:8080/graphs/hugegraph/schema/indexlabels/personByCity
Response Status
1. 202
Response Body
1. {
2. "task_id": 1
3. }

Note:

You can query the execution status of an asynchronous task by using GET http://localhost:8080/graphs/hugegraph/tasks/1 (where “1” is the task_id). For more information, refer to the Asynchronous Task RESTful API.

Last modified May 19, 2023: Update indexlabel.md (#243) (0ec43c25)