更新时间:2023-07-19 gmt 08:00

新建索引(1.1.6)-凯发k8国际娱乐官网入口

功能介绍

根据给定的indexname,indextype等信息创建索引。目前支持的索引:复合索引。

  • 复合索引有全局点索引(globalcompositevertexindex)和全局边索引(globalcompositeedgeindex)。复合索引可在label和property上创建索引,使用索引查询可以加快速度。

索引特性

特性

模糊查询

速度

灵活度

复合索引

不支持

快速

仅限于固定组合属性键

uri

post /ges/v1.0/{project_id}/graphs/{graph_name}/indices
表1 路径参数

参数

是否必选

类型

说明

project_id

string

项目id。获取方法请参见。

graph_name

string

图名称。

请求示例

创建复合索引,索引名称为ageindex,索引类型为全局点索引。
post http://{server_url}/ges/v1.0/{project_id}/graphs/{graph_name}/indices
{
    "indexname":"ageindex",
    "indextype": "globalcompositevertexindex",
    "haslabel": "true",
    "indexproperty": ["age"]
}

server_url:图的访问地址,取值请参考。

请求参数

表2 body参数说明

参数

是否必选

类型

说明

indexname

string

索引名称。只能包含字母,数字,-和_。不能包含其他字符。索引名称的长度需在63字符以内。

indextype

string

索引的类型。区分大小写。“globalcompositevertexindex”为全局的composite类型的点索引。

haslabel

string

是否有label,默认为false。

  • true
  • false

indexproperty

否(若haslabel为false或null,则该项为必选)

string

索引的属性列表。

可以创建索引的属性类型有: integer、 float、 double、 long、 enum、 char array、 string、 date。

如果属性类型为string或者char array,属性长度建议不要超过40个字节,超出的部分会被截断。

响应参数

表3 响应body参数说明

参数

类型

说明

errormessage

string

系统提示信息。

  • 执行成功时,字段可能为空。
  • 执行失败时,用于显示错误信息。

errorcode

string

系统提示信息。

  • 执行成功时,字段可能为空。
  • 执行失败时,用于显示错误码。

jobid

string

执行该异步任务的jobid。

说明:
  • 可以查询jobid查看任务执行状态、获取返回结果,详情参考。

jobtype

string

执行该异步任务的jobtype。

result

string

成功时result值为success。

响应示例

状态码: 200

成功响应示例

http status code: 200
{
"jobid": "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232",
"jobtype": 8
}

状态码: 400

失败响应示例

http status code: 400
{
  "errormessage": "graph [demo] is not found",
  "errorcode": "ges.8603"
}

状态码

返回值

说明

400 bad request

请求错误。

401 unauthorized

鉴权失败。

403 forbidden

没有操作权限。

404 not found

找不到资源。

500 internal server error

服务内部错误。

503 service unavailable

服务不可用。

错误码

请参见。

分享:
网站地图