v2.5的环境
private static void createIndex(NebulaPool pool)
throws IOErrorException, AuthFailedException, NotValidConnectionException {
Session session = pool.getSession(USER, PASSWORD, false);
String createIndex = "USE movie; "
// + "CREATE TAG INDEX IF NOT EXISTS actor_index on actor();"
// + "CREATE TAG INDEX IF NOT EXISTS drama_index on drama();"
+ "REBUILD TAG INDEX actor_index; "
+ "REBUILD TAG INDEX drama_index;";
ResultSet resp = session.execute(createIndex);
if (!resp.isSucceeded()) {
log.error(String.format("Execute: `%s'\n failed: %s",
createIndex, resp.getErrorMessage()));
System.exit(1);
}
}
报错提示space为空
ERROR [main] - Execute: `USE movie; REBUILD TAG INDEX drama_index;'
failed: SemanticError: Get index failed in space `': SpaceNotFound:
Process finished with exit code 1
确认index就在这个space里。用console重建索引就成功了。