public static int Record(long sync_id, String idx) { LogLine temp = rec_map.get(sync_id); if (null == temp) { idx_map.put(sync_id, idx); } else { temp.dstidx = idx; // tell score system about temp; rec_map.remove(sync_id); // tell elasticsearch; IndexResponse response = client .prepareIndex(DATABASEINDEX, DATABASETYPE) .setSource(gson.toJson(temp)) .execute() .actionGet(); if (!response.isCreated()) { System.out.println(PROMPT + "Elasticsearch recording failed!"); return ERROR; } // test WriteToDisk(temp); } return SUCCESS; }