diff --git a/modules/percolator/src/main/java/org/opensearch/percolator/PercolateQueryBuilder.java b/modules/percolator/src/main/java/org/opensearch/percolator/PercolateQueryBuilder.java index 33077c11df092..b2130eca3bb02 100644 --- a/modules/percolator/src/main/java/org/opensearch/percolator/PercolateQueryBuilder.java +++ b/modules/percolator/src/main/java/org/opensearch/percolator/PercolateQueryBuilder.java @@ -230,12 +230,16 @@ protected PercolateQueryBuilder(String field, Supplier documentS name = in.readOptionalString(); if (in.getVersion().before(Version.V_2_0_0)) { String documentType = in.readOptionalString(); - assert documentType == null; + if (documentType != null) { + throw new IllegalStateException("documentType must be null"); + } } indexedDocumentIndex = in.readOptionalString(); if (in.getVersion().before(Version.V_2_0_0)) { String indexedDocumentType = in.readOptionalString(); - assert indexedDocumentType == null; + if (indexedDocumentType != null) { + throw new IllegalStateException("indexedDocumentType must be null"); + } } indexedDocumentId = in.readOptionalString();