Skip to content

Commit

Permalink
[BWC] Change BWC version check for MediaType in PercolateQueryBuilder
Browse files Browse the repository at this point in the history
This changes the version check for MediaType in PercolateQueryBuilder
for BWC.

Signed-off-by: Nicholas Walter Knize <[email protected]>
  • Loading branch information
nknize committed Aug 1, 2023
1 parent f9158f3 commit 7ce57b2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -254,7 +254,7 @@ protected PercolateQueryBuilder(String field, Supplier<BytesReference> documentS
}
documents = in.readList(StreamInput::readBytesReference);
if (documents.isEmpty() == false) {
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
if (in.getVersion().onOrAfter(Version.V_2_10_0)) {
documentXContentType = in.readMediaType();
} else {
documentXContentType = in.readEnum(XContentType.class);
@@ -304,7 +304,7 @@ protected void doWriteTo(StreamOutput out) throws IOException {
out.writeBytesReference(document);
}
if (documents.isEmpty() == false) {
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
if (out.getVersion().onOrAfter(Version.V_2_10_0)) {
documentXContentType.writeTo(out);
} else {
out.writeEnum((XContentType) documentXContentType);

0 comments on commit 7ce57b2

Please sign in to comment.