Skip to content

Commit c597f7b

Browse files
committed
fix serialization of count request
1 parent 5faf6db commit c597f7b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/elasticsearch/src/main/java/org/elasticsearch/action/count/ShardCountRequest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ public String[] types() {
8484
@Override public void readFrom(StreamInput in) throws IOException {
8585
super.readFrom(in);
8686
minScore = in.readFloat();
87-
querySource = new byte[in.readVInt()];
87+
querySourceLength = in.readVInt();
88+
querySourceOffset = 0;
89+
querySource = new byte[querySourceLength];
8890
in.readFully(querySource);
8991
if (in.readBoolean()) {
9092
queryParserName = in.readUTF();
@@ -101,8 +103,8 @@ public String[] types() {
101103
@Override public void writeTo(StreamOutput out) throws IOException {
102104
super.writeTo(out);
103105
out.writeFloat(minScore);
104-
out.writeVInt(querySource.length);
105-
out.writeBytes(querySource);
106+
out.writeVInt(querySourceLength);
107+
out.writeBytes(querySource, querySourceOffset, querySourceLength);
106108
if (queryParserName == null) {
107109
out.writeBoolean(false);
108110
} else {

0 commit comments

Comments
 (0)