spring-projects/spring-ai · warning

Deleted only ${deleteCount} entries from requested ${idList.

Error message

Deleted only ${deleteCount} entries from requested ${idList.size()}

What it means

MilvusVectorStore.doDelete compares the deleteCnt returned by the Milvus server's delete MutationResult with the number of requested ids and warns when fewer entries were actually deleted. Some requested document ids did not exist (or did not match) in the collection/partition, so the delete was partial.

Source

Thrown at vector-stores/spring-ai-milvus-store/src/main/java/org/springframework/ai/vectorstore/milvus/MilvusVectorStore.java:321

		// used by MilvusFilterExpressionConverter so quotes, backslashes and control
		// chars cannot break out of the string literal and inject filter syntax.
		String deleteExpression = String.format("%s in [%s]", this.idFieldName,
				idList.stream()
					.map(MilvusFilterExpressionConverter::toFilterExpressionLiteral)
					.collect(Collectors.joining(",")));

		DeleteParam.Builder deleteParamBuilder = DeleteParam.newBuilder()
			.withDatabaseName(this.databaseName)
			.withCollectionName(this.collectionName)
			.withExpr(deleteExpression);
		if (StringUtils.hasText(this.partitionName)) {
			deleteParamBuilder.withPartitionName(this.partitionName);
		}
		R<MutationResult> status = this.milvusClient.delete(deleteParamBuilder.build());

		long deleteCount = status.getData().getDeleteCnt();
		if (logger.isWarnEnabled() && deleteCount != idList.size()) {
			logger.warn("Deleted only " + deleteCount + " entries from requested " + idList.size());
		}
	}

	@Override
	protected void doDelete(Filter.Expression filterExpression) {
		Assert.notNull(filterExpression, "Filter expression must not be null");

		try {
			String nativeFilterExpression = this.filterExpressionConverter.convertExpression(filterExpression);

			DeleteParam.Builder deleteParamBuilder = DeleteParam.newBuilder()
				.withDatabaseName(this.databaseName)
				.withCollectionName(this.collectionName)
				.withExpr(nativeFilterExpression);
			if (StringUtils.hasText(this.partitionName)) {
				deleteParamBuilder.withPartitionName(this.partitionName);
			}
			R<MutationResult> status = this.milvusClient.delete(deleteParamBuilder.build());

View on GitHub (pinned to 98a7beda4f)

Solutions

  1. Verify each id exists before deleting (query by primary key) or tolerate partial deletes as normal
  2. Check that the partitionName configuration matches the partition where the documents were inserted
  3. Ensure documents were inserted through the same store/collection (same collectionName and id field) you are deleting from
  4. If deletes must be exact, wrap the operation and reconcile ids whose deletion count differs

Example fix

// before
vectorStore.delete(ids); // may silently delete fewer

// after
long existing = ids.stream().filter(id -> vectorStore.getById(id) != null).count();
vectorStore.delete(ids);
logger.info("requested " + ids.size() + ", expected deletable " + existing);
Defensive patterns

Strategy: validation

Validate before calling

// verify ids exist before delete to interpret partial results
Set<String> existing = ids.stream()
    .filter(id -> milvusVectorStore.getById(id) != null)
    .collect(Collectors.toSet());

Prevention

When it happens

Trigger: vectorStore.delete(List.of(id1, id2, ...)) where one or more ids are absent from the collection, were already deleted, or were written to a different partition than this.partitionName.

Common situations: Deleting documents that were added with a different MilvusVectorStore configuration (different collection/partition); stale ids from an external registry; re-running an idempotency retry that already deleted the docs; ids changed because idFieldName/custom id mapping differs.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of spring-projects/spring-ai@98a7beda4f (2026-09-11). Data as JSON: /api/errors/fb005e272f199bed. Report an issue: GitHub.