String code = split[2];
String text = null;
if (split.length > 3) {
text = split[3];
}
LogBatch b = new LogBatch();
for (long id = start; id - start < count; id++) {
if (((id - start) % 1000) == 0 && id != start) {
System.out.println("sending " + id);
client.sendBatch(b);
b.get_records().clear();
}
LogRecord record = new LogRecord();
record.set_docid("d" + id);
record.set_timestamp_ms(System.currentTimeMillis());
record.set_index_code(code);
if (text != null) {
record.set_fields(ImmutableMap.of("text", text));
} else {
record.set_deleted(true);
}
b.add_to_records(record);
}
if (!b.get_records().isEmpty())
client.sendBatch(b);
}
}
}