Updated on 2022-09-14 GMT+08:00
Adding an Index
You can use a specific API provided by GES to add an index. The sample code is as follows:
public void excuteCreateIndex(GraphClient graphClient) throws ApiExcepti { CreateIndexReq req = new CreateIndexReq(); //Whether a label is available. The value is case-insensitive. If this parameter is left blank, the default value false is used. req.setHasLabel("true"); //Index name. It can contain only letters and digits. No default value is available. req.setIndexName("ageIndex"); //Element type. Possible values are vertex and edge. The value is case-insensitive and does not have a default value. req.setElementType("vertex"); // Index type. Possible values are GlobalCompositeVertexIndex and GlobalCompositeEdgeIndex. The value is case-insensitive and does not have a default value. //The value of indexType must correspond to that of elementType. For example, if elementType is set to vertex, indexType must be set to GlobalCompositeVertexIndex. If elementType is set to edge, indexType must be set to GlobalCompositeEdgeIndex. Otherwise, the index fails to be created. req.setIndexType("GlobalCompositeVertexIndex"); //Property list of indexes (Supported property types include int, float, double, long, enum, char array, string, date.) //If hasLabel is false or null, this item is mandatory. req.setIndexProperty(req.setIndexProperty(new String[] {"age"});) Map<String, Object> result = graphClient.createIndex(req); System.out.print(MapUtils.map2json(result)); }
Parent topic: Using the Service Plane SDK
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.