docs: private void addToBuffer(String index, String document) {
          if (timerMDC == null) {
              timerMDC = MDC.get("name");
          }
          // Remove old entries from the buffer
          int removedSize = 0;
          if (docBuffer.containsKey(index)) {
              log.debug("Removing buffer duplicate: '{}'", index);
              removedSize = docBuffer.get(index).length();
              docBuffer.remove(index);
          }
  
          int length = document.length() - removedSize;
          // If this is the first document in the buffer, record its age
          bufferYoungest = new Date().getTime();
          if (docBuffer.isEmpty()) {
              bufferOldest = new Date().getTime();
              log.debug("=== New buffer starting: {}", bufferOldest);
          }
          // Add to the buffer
          docBuffer.put(index, document);
          bufferSize += length;
          // Check if submission is required
          checkBuffer();
      }