Adjust wire version for search context id

Relates #53143
This commit is contained in:
Nhat Nguyen 2020-03-11 08:34:19 -04:00
parent 6665ebe7ab
commit 1fd56698fa
3 changed files with 4 additions and 4 deletions

View File

@ -108,7 +108,7 @@ final class FetchSearchPhase extends SearchPhase {
final List<SearchPhaseResult> phaseResults = queryResults.asList();
final String scrollId;
if (isScrollSearch) {
final boolean includeContextUUID = clusterState.nodes().getMinNodeVersion().onOrAfter(Version.V_8_0_0);
final boolean includeContextUUID = clusterState.nodes().getMinNodeVersion().onOrAfter(Version.V_7_7_0);
scrollId = TransportSearchHelper.buildScrollId(queryResults, includeContextUUID);
} else {
scrollId = null;

View File

@ -39,7 +39,7 @@ public final class SearchContextId implements Writeable {
public SearchContextId(StreamInput in) throws IOException {
this.id = in.readLong();
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_7_0)) {
this.readerId = in.readString();
} else {
this.readerId = "";
@ -49,7 +49,7 @@ public final class SearchContextId implements Writeable {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeLong(id);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_7_0)) {
out.writeString(readerId);
}
}

View File

@ -357,7 +357,7 @@ public class ExceptionSerializationTests extends ESTestCase {
Version version = VersionUtils.randomVersion(random());
SearchContextMissingException ex = serialize(new SearchContextMissingException(contextId), version);
assertThat(ex.contextId().getId(), equalTo(contextId.getId()));
if (version.onOrAfter(Version.V_8_0_0)) {
if (version.onOrAfter(Version.V_7_7_0)) {
assertThat(ex.contextId().getReaderId(), equalTo(contextId.getReaderId()));
} else {
assertThat(ex.contextId().getReaderId(), equalTo(""));