class DefaultEsClient implements EsClient<T> {

    @VisibleForTesting
    String buildBulkIndexPayload(List<T> tasks, String index, String type) {
        StringBuilder sb = new StringBuilder();

        final ObjectMapper mapper = CommonObjectMappers.jacksonDefaultMapper();

        tasks.forEach(taskDocument -> {
            final IndexHeader indexHeader = new IndexHeader(index, type, taskDocument.getId());
            final IndexHeaderLine indexHeaderLine = new IndexHeaderLine(indexHeader);
            try {
                final String indexLine = mapper.writeValueAsString(indexHeaderLine);
                sb.append(indexLine);
                sb.append("\n");
                final String fieldsLine = mapper.writeValueAsString(taskDocument);
                sb.append(fieldsLine);
                sb.append("\n");
            } catch (JsonProcessingException e) {
                logger.error("Exception in transforming taskDocument into JSON ", e);
            }
        });
        return sb.toString();
    }

    public  DefaultEsClient(EsWebClientFactory esWebClientFactory);

}