You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assuming that the PropertyKeys listed in 1.1.3 have already been created.
10
10
11
+
**Note:**
12
+
The following examples are verified against HugeGraph Server v1.5.0.
13
+
PropertyKeys must be created before creating a VertexLabel.
14
+
When running HugeGraph via Docker with the PASSWORD parameter, authentication is enabled and requests must use Basic Auth.
15
+
11
16
Params Description:
12
17
13
18
- id: The ID value of the vertex type.
@@ -16,7 +21,7 @@ Params Description:
16
21
- properties: The property types associated with the vertex type.
17
22
- primary_keys: The primary key properties. This field must have a value when the ID strategy is PRIMARY_KEY, and must be empty for other ID strategies.
18
23
- enable_label_index: Whether to enable label indexing. It is disabled by default.
19
-
-index_names: The indexes created for the vertex type. See details in section 3.4.
24
+
-index_labels: The indexes created for the vertex type. See details in section 3.4.
20
25
- nullable_keys: Nullable properties.
21
26
- user_data: Setting the common information of the vertex type, similar to the property type.
22
27
@@ -32,86 +37,67 @@ POST http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlab
32
37
33
38
```json
34
39
{
35
-
"name": "person",
36
-
"id_strategy": "DEFAULT",
37
-
"properties": [
38
-
"name",
39
-
"age"
40
-
],
41
-
"primary_keys": [
42
-
"name"
43
-
],
44
-
"nullable_keys": [],
45
-
"enable_label_index": true
40
+
"name": "person",
41
+
"id_strategy": "PRIMARY_KEY",
42
+
"properties": ["name", "age"],
43
+
"primary_keys": ["name"],
44
+
"nullable_keys": [],
45
+
"enable_label_index": true
46
46
}
47
47
```
48
48
49
49
##### Response Status
50
50
51
51
```json
52
-
201
52
+
201Created
53
53
```
54
54
55
55
##### Response Body
56
56
57
57
```json
58
58
{
59
-
"id": 1,
60
-
"primary_keys": [
61
-
"name"
62
-
],
63
-
"id_strategy": "PRIMARY_KEY",
64
-
"name": "person2",
65
-
"index_names": [
66
-
],
67
-
"properties": [
68
-
"name",
69
-
"age"
70
-
],
71
-
"nullable_keys": [
72
-
],
73
-
"enable_label_index": true,
74
-
"user_data": {}
59
+
"id": 1,
60
+
"name": "person",
61
+
"id_strategy": "PRIMARY_KEY",
62
+
"primary_keys": ["name"],
63
+
"nullable_keys": [],
64
+
"index_labels": [],
65
+
"properties": ["name", "age"],
66
+
"status": "CREATED",
67
+
"ttl": 0,
68
+
"enable_label_index": true,
69
+
"user_data": {
70
+
"~create_time": "2025-12-16 15:08:57.458"
71
+
}
75
72
}
76
73
```
77
74
78
75
Starting from version v0.11.2, hugegraph-server supports Time-to-Live (TTL) functionality for vertices. The TTL for vertices is set through VertexLabel. For example, if you want the vertices of type "person" to have a lifespan of one day, you need to set the TTL field to 86400000 (in milliseconds) when creating the "person" VertexLabel.
79
76
80
77
```json
81
78
{
82
-
"name": "person",
83
-
"id_strategy": "DEFAULT",
84
-
"properties": [
85
-
"name",
86
-
"age"
87
-
],
88
-
"primary_keys": [
89
-
"name"
90
-
],
91
-
"nullable_keys": [],
92
-
"ttl": 86400000,
93
-
"enable_label_index": true
79
+
"name": "person",
80
+
"id_strategy": "PRIMARY_KEY",
81
+
"properties": ["name", "age"],
82
+
"primary_keys": ["name"],
83
+
"nullable_keys": [],
84
+
"ttl": 86400000,
85
+
"enable_label_index": true
94
86
}
95
87
```
96
88
97
89
Additionally, if the vertex has a property called "createdTime" and you want to use it as the starting point for calculating the vertex's lifespan, you can set the ttl_start_time field in the VertexLabel. For example, if the "person" VertexLabel has a property called "createdTime" of type Date, and you want the vertices of type "person" to live for one day starting from the creation time, the Request Body for creating the "person" VertexLabel would be as follows:
98
90
99
91
```json
100
92
{
101
-
"name": "person",
102
-
"id_strategy": "DEFAULT",
103
-
"properties": [
104
-
"name",
105
-
"age",
106
-
"createdTime"
107
-
],
108
-
"primary_keys": [
109
-
"name"
110
-
],
111
-
"nullable_keys": [],
112
-
"ttl": 86400000,
113
-
"ttl_start_time": "createdTime",
114
-
"enable_label_index": true
93
+
"name": "person",
94
+
"id_strategy": "PRIMARY_KEY",
95
+
"properties": ["name", "age", "createdTime"],
96
+
"primary_keys": ["name"],
97
+
"nullable_keys": [],
98
+
"ttl": 86400000,
99
+
"ttl_start_time": "createdTime",
100
+
"enable_label_index": true
115
101
}
116
102
```
117
103
@@ -131,14 +117,12 @@ PUT http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe
131
117
132
118
```json
133
119
{
134
-
"name": "person",
135
-
"properties": [
136
-
"city"
137
-
],
138
-
"nullable_keys": ["city"],
139
-
"user_data": {
140
-
"super": "animal"
141
-
}
120
+
"name": "person",
121
+
"properties": ["city"],
122
+
"nullable_keys": ["city"],
123
+
"user_data": {
124
+
"super": "animal"
125
+
}
142
126
}
143
127
```
144
128
@@ -152,26 +136,17 @@ PUT http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe
152
136
153
137
```json
154
138
{
155
-
"id": 1,
156
-
"primary_keys": [
157
-
"name"
158
-
],
159
-
"id_strategy": "PRIMARY_KEY",
160
-
"name": "person",
161
-
"index_names": [
162
-
],
163
-
"properties": [
164
-
"city",
165
-
"name",
166
-
"age"
167
-
],
168
-
"nullable_keys": [
169
-
"city"
170
-
],
171
-
"enable_label_index": true,
172
-
"user_data": {
173
-
"super": "animal"
174
-
}
139
+
"id": 1,
140
+
"primary_keys": ["name"],
141
+
"id_strategy": "PRIMARY_KEY",
142
+
"name": "person",
143
+
"index_labels": [],
144
+
"properties": ["city", "name", "age"],
145
+
"nullable_keys": ["city"],
146
+
"enable_label_index": true,
147
+
"user_data": {
148
+
"super": "animal"
149
+
}
175
150
}
176
151
```
177
152
@@ -193,50 +168,23 @@ GET http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe
193
168
194
169
```json
195
170
{
196
-
"vertexlabels": [
197
-
{
198
-
"id": 1,
199
-
"primary_keys": [
200
-
"name"
201
-
],
202
-
"id_strategy": "PRIMARY_KEY",
203
-
"name": "person",
204
-
"index_names": [
205
-
],
206
-
"properties": [
207
-
"city",
208
-
"name",
209
-
"age"
210
-
],
211
-
"nullable_keys": [
212
-
"city"
213
-
],
214
-
"enable_label_index": true,
215
-
"user_data": {
216
-
"super": "animal"
217
-
}
218
-
},
219
-
{
220
-
"id": 2,
221
-
"primary_keys": [
222
-
"name"
223
-
],
224
-
"id_strategy": "PRIMARY_KEY",
225
-
"name": "software",
226
-
"index_names": [
227
-
],
228
-
"properties": [
229
-
"price",
230
-
"name",
231
-
"lang"
232
-
],
233
-
"nullable_keys": [
234
-
"price"
235
-
],
236
-
"enable_label_index": false,
237
-
"user_data": {}
238
-
}
239
-
]
171
+
"vertexlabels": [
172
+
{
173
+
"id": 1,
174
+
"name": "person",
175
+
"id_strategy": "PRIMARY_KEY",
176
+
"primary_keys": ["name"],
177
+
"nullable_keys": [],
178
+
"index_labels": [],
179
+
"properties": ["name", "age"],
180
+
"status": "CREATED",
181
+
"ttl": 0,
182
+
"enable_label_index": true,
183
+
"user_data": {
184
+
"~create_time": "2025-12-16 15:08:57.458"
185
+
}
186
+
}
187
+
]
240
188
}
241
189
```
242
190
@@ -257,26 +205,25 @@ GET http://localhost:8080/graphspaces/DEFAULT/graphs/hugegraph/schema/vertexlabe
0 commit comments