public void close() {
}
@Override
public void addEvent(Event event, IndexNameBuilder indexNameBuilder, String indexType, long ttlMs) throws Exception {
BytesReference content = serializer.getContentBuilder(event).bytes();
Map<String, Map<String, String>> parameters = new HashMap<String, Map<String, String>>();
Map<String, String> indexParameters = new HashMap<String, String>();
indexParameters.put(INDEX_PARAM, indexNameBuilder.getIndexName(event));
indexParameters.put(TYPE_PARAM, indexType);
if (ttlMs > 0) {
indexParameters.put(TTL_PARAM, Long.toString(ttlMs));
}
parameters.put(INDEX_OPERATION_NAME, indexParameters);
Gson gson = new Gson();
synchronized(bulkBuilder) {
bulkBuilder.append(gson.toJson(parameters));
bulkBuilder.append("\n");
bulkBuilder.append(content.toBytesArray().toUtf8());
bulkBuilder.append("\n");
}
}