Adding filters on metadata with the Java SDK

I’m using the Java SDK to interact with Pinecone. For each vector that I create, I’m adding a few metadata fields, in this case, the most important ones are named “documentId”.

I’d like to create a query to return the top values that match a given embedding but exclude a given set of document IDs. I wasn’t really sure how to do this, here’s some of the code that I’ve started with but I’m not sure where to go from here.

Any thoughts on how to best do this?

EmbeddingResult embeddingResult = this.openAiClient.getEmbeddings(Collections.singletonList(query));
Embedding embedding = embeddingResult.getData().get(0);
List<Float> queryEmbedding = embedding.getEmbedding().stream().map(Double::floatValue).collect(Collectors.toList());
PineconeConnectionConfig config = new PineconeConnectionConfig().withIndexName(this.indexName);
PineconeConnection connection = this.pineconeClient.connect(config);

/* I imagine something here needs to change */
Struct filter = null;
if (excludedDocumentIds != null && excludedDocumentIds.size() > 0) {
	filter = Struct.newBuilder()
		.putFields("documentId", Value.newBuilder()
			// Potentially something here as well but how to negate the document IDs in this list?

	QueryRequest request = QueryRequest.newBuilder()

QueryResponse response = connection.getBlockingStub().query(request);

Thanks so much!