private void decrementVectorCounters(List<IdHistogram> deleteList, Iterator<IdHistogram> iter1,
			Iterator<IdHistogram> iter2, int maxVectors) throws ElasticException {
		StringBuilder buffer = new StringBuilder();
		for (int i = 0; i < maxVectors; ++i) {
			if (!iter1.hasNext()) {
				break;
			}
			IdHistogram entry = iter1.next();
			buffer.append("{ \"update\": { \"_index\": \"").append(repository).append("_meta\", ");
			buffer.append("\"_id\": \"");
			Base64Lite.encodeLongBase64(buffer, entry.id);
			buffer.append("\", \"retry_on_conflict\": 5 } }\n");
			buffer.append(
				"{ \"script\": { \"inline\": \"if ((ctx._source.count -= params.count) <=0) { ctx.op = \\\"delete\\\" }\", ");
			buffer.append("\"params\": { \"count\": ").append(entry.count).append("} } }\n");
		}
		JsonObject resp = connection.executeBulk("/_bulk", buffer.toString());
		JsonArray items = (JsonArray) resp.get("items");
		for (int i = 0; i < maxVectors; ++i) {
			if (!iter2.hasNext()) {
				break;
			}
			IdHistogram entry = iter2.next();
			JsonObject item = (JsonObject) items.get(i);
			JsonObject update = (JsonObject) item.get("update");
			long id = Base64Lite.decodeLongBase64(update.get("_id").getAsString());
			if (id != entry.id) {
				throw new ElasticException("Mismatch in decrementVectorCounters");
			}
			if ("deleted".equals(ElasticConnection.convertToString(update.get("result")))) {
				deleteList.add(entry);				// Mark this vector for full deletion
			}
		}
	}
Decrement the "meta" document counter by the histogram count for a set of vectors.  If any counter reaches zero,
delete the meta document and add the vector record to the list of vectors scheduled for full deletion.
@param deleteList accumulates records of counters that have reached zero
@param iter1 is an iterator over records indicating the vector id and the count to decrement by
@param iter2 is a copy of the first iterator
@param maxVectors is the maximum number of counter updates to issue in this window
@throws ElasticException for communication problems with the server
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java