Skip to content

Commit

Permalink
Guard serialization with version check
Browse files Browse the repository at this point in the history
Signed-off-by: Owais <[email protected]>
  • Loading branch information
owaiskazi19 committed Sep 20, 2024
1 parent b2c2001 commit a1bc82b
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ public SearchSourceBuilder(StreamInput in) throws IOException {
seqNoAndPrimaryTerm = in.readOptionalBoolean();
extBuilders = in.readNamedWriteableList(SearchExtBuilder.class);
profile = in.readBoolean();
searchPipeline = in.readOptionalString();
searchAfterBuilder = in.readOptionalWriteable(SearchAfterBuilder::new);
sliceBuilder = in.readOptionalWriteable(SliceBuilder::new);
collapse = in.readOptionalWriteable(CollapseBuilder::new);
Expand All @@ -300,6 +299,9 @@ public SearchSourceBuilder(StreamInput in) throws IOException {
derivedFields = in.readList(DerivedField::new);
}
}
if (in.getVersion().onOrAfter(Version.V_2_18_0)) {
searchPipeline = in.readOptionalString();
}
}

@Override
Expand Down Expand Up @@ -350,7 +352,6 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalBoolean(seqNoAndPrimaryTerm);
out.writeNamedWriteableList(extBuilders);
out.writeBoolean(profile);
out.writeOptionalString(searchPipeline);
out.writeOptionalWriteable(searchAfterBuilder);
out.writeOptionalWriteable(sliceBuilder);
out.writeOptionalWriteable(collapse);
Expand Down Expand Up @@ -381,6 +382,9 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeList(derivedFields);
}
}
if (out.getVersion().onOrAfter(Version.V_2_18_0)) {
out.writeOptionalString(searchPipeline);
}
}

/**
Expand Down

0 comments on commit a1bc82b

Please sign in to comment.