Skip to content

Commit 142d7bd

Browse files
committed
Internal: fixed bw comp in ShardSearchTransportRequest
Original indices were introduced in 1.4.0.Beta1 as optional, preceded by a boolean flag that told whether they were empty or not. We have to keep serializing as optional only when reading and writing from/to 1.4.0.Beta1, although the original indices are not optional whenever we go and serialize the request they belong to (which is why the boolean got removed in 1.4.0).
1 parent 694cc08 commit 142d7bd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/org/elasticsearch/search/internal/ShardSearchTransportRequest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.elasticsearch.search.internal;
2121

22+
import org.elasticsearch.Version;
2223
import org.elasticsearch.action.IndicesRequest;
2324
import org.elasticsearch.action.OriginalIndices;
2425
import org.elasticsearch.action.search.SearchRequest;
@@ -163,13 +164,23 @@ public void readFrom(StreamInput in) throws IOException {
163164
super.readFrom(in);
164165
shardSearchLocalRequest = new ShardSearchLocalRequest();
165166
shardSearchLocalRequest.innerReadFrom(in);
167+
if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1) && in.getVersion().before(Version.V_1_4_0)) {
168+
//original indices used to be optional in 1.4.0.Beta1 but ended up being empty only when the
169+
// shard search request was used locally and never serialized
170+
in.readBoolean();
171+
}
166172
originalIndices = OriginalIndices.readOriginalIndices(in);
167173
}
168174

169175
@Override
170176
public void writeTo(StreamOutput out) throws IOException {
171177
super.writeTo(out);
172178
shardSearchLocalRequest.innerWriteTo(out, false);
179+
if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta1) && out.getVersion().before(Version.V_1_4_0)) {
180+
//original indices used to be optional in 1.4.0.Beta1 although ended up being empty only when the
181+
//shard search request was used locally and never serialized
182+
out.writeBoolean(true);
183+
}
173184
OriginalIndices.writeOriginalIndices(originalIndices, out);
174185
}
175186

0 commit comments

Comments
 (0)