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

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

Signed-off-by: Nicholas Walter Knize <[email protected]>
Signed-off-by: Ivan Brusic <[email protected]>
  • Loading branch information
nknize authored and brusic committed Sep 25, 2023
1 parent ae44551 commit 9ba8eb6
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 9ba8eb6

Please sign in to comment.