新建索引(1.1.6)
功能介绍
根据给定的indexName,IndexType等信息创建索引。目前支持的索引:复合索引。
- 复合索引有全局点索引(GlobalCompositeVertexIndex)和全局边索引(GlobalCompositeEdgeIndex)。复合索引可在label和property上创建索引,使用索引查询可以加快速度。
 
索引特性
| 
        特性  | 
      
        模糊查询  | 
      
        速度  | 
      
        灵活度  | 
     
|---|---|---|---|
| 
        复合索引  | 
      
        不支持  | 
      
        快速  | 
      
        仅限于固定组合属性键。  | 
     
URI
| 
         参数  | 
       
         是否必选  | 
       
         类型  | 
       
         说明  | 
      
|---|---|---|---|
| 
         project_id  | 
       
         是  | 
       
         String  | 
       
         项目ID。获取方法请参见获取项目ID。  | 
      
| 
         graph_name  | 
       
         是  | 
       
         String  | 
       
         图名称。  | 
      
请求参数
| 
        参数  | 
      
        是否必选  | 
      
        类型  | 
      
        说明  | 
     
|---|---|---|---|
| 
        indexName  | 
      
        是  | 
      
        String  | 
      
        索引名称。只能包含字母,数字,-和_。不能包含其他字符。索引名称的长度需在63字符以内。  | 
     
| 
        indexType  | 
      
        是  | 
      
        String  | 
      
        索引的类型。区分大小写。“GlobalCompositeVertexIndex”为全局的Composite类型的点索引。  | 
     
| 
        hasLabel  | 
      
        否  | 
      
        String  | 
      
        是否有label,默认为“false”。 
  | 
     
| 
        indexProperty  | 
      
        否(若hasLabel为false或null,则该项为必选)  | 
      
        String  | 
      
        索引的属性列表。  | 
     
 
   - 如果属性类型为string或者char array,属性长度建议不要超过40个字节,超出的部分会被截断。
 - 新建索引上限为10个。
 
响应参数
| 
        参数  | 
      
        类型  | 
      
        说明  | 
     
|---|---|---|
| 
        errorMessage  | 
      
        String  | 
      
        系统提示信息。 
  | 
     
| 
        errorCode  | 
      
        String  | 
      
        系统提示信息。 
  | 
     
| 
        jobId  | 
      
        String  | 
      
        执行该异步任务的jobId。 
         说明: 
         
  | 
     
| 
        jobType  | 
      
        String  | 
      
        执行该异步任务的jobType。  | 
     
请求示例
POST http://{SERVER_URL}/ges/v1.0/{project_id}/graphs/{graph_name}/indices
{
    "indexName":"ageIndex",
    "indexType": "GlobalCompositeVertexIndex",
    "hasLabel": "true",
    "indexProperty": ["age"]
}
   
  响应示例
状态码: 200
成功响应示例
Http Status Code: 200
{
"jobId": "f99f60f1-bba6-4cde-bd1a-ff4bdd1fd500000168232",
"jobType": 8
}
  状态码: 400
失败响应示例
Http Status Code: 400
{
    "errorMessage": "Not found. Please check the input parameters.",
    "errorCode": "GES.8000"
}
 状态码
| 
        返回值  | 
      
        说明  | 
     
|---|---|
| 
        400 Bad Request  | 
      
        请求错误。  | 
     
| 
        401 Unauthorized  | 
      
        鉴权失败。  | 
     
| 
        403 Forbidden  | 
      
        没有操作权限。  | 
     
| 
        404 Not Found  | 
      
        找不到资源。  | 
     
| 
        500 Internal Server Error  | 
      
        服务内部错误。  | 
     
| 
        503 Service Unavailable  | 
      
        服务不可用。  | 
     
错误码
请参见错误码。