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
…#9053)

This changes the version check for MediaType in PercolateQueryBuilder
for BWC.

Signed-off-by: Nicholas Walter Knize <[email protected]>
  • Loading branch information
nknize authored Aug 2, 2023
1 parent f9158f3 commit 11c8426
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 11c8426

Please sign in to comment.