RemoteTransportException on _analyze request to specific index, closes #1770.

This commit is contained in:
Shay Banon 2012-03-08 21:11:02 +02:00
parent 876caba615
commit 3789983c7a
1 changed files with 8 additions and 30 deletions

View File

@ -142,16 +142,10 @@ public class AnalyzeRequest extends SingleCustomOperationRequest {
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
super.readFrom(in); super.readFrom(in);
if (in.readBoolean()) { index = in.readOptionalUTF();
index = in.readUTF();
}
text = in.readUTF(); text = in.readUTF();
if (in.readBoolean()) { analyzer = in.readOptionalUTF();
analyzer = in.readUTF(); tokenizer = in.readOptionalUTF();
}
if (in.readBoolean()) {
tokenizer = in.readUTF();
}
int size = in.readVInt(); int size = in.readVInt();
if (size > 0) { if (size > 0) {
tokenFilters = new String[size]; tokenFilters = new String[size];
@ -159,23 +153,16 @@ public class AnalyzeRequest extends SingleCustomOperationRequest {
tokenFilters[i] = in.readUTF(); tokenFilters[i] = in.readUTF();
} }
} }
if (in.readBoolean()) { field = in.readOptionalUTF();
field = in.readUTF();
}
} }
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out); super.writeTo(out);
if (index == null) { out.writeOptionalUTF(index);
out.writeBoolean(false);
out.writeUTF(index);
} else {
out.writeUTF(index);
}
out.writeUTF(text); out.writeUTF(text);
writeOption(out, analyzer); out.writeOptionalUTF(analyzer);
writeOption(out, tokenizer); out.writeOptionalUTF(tokenizer);
if (tokenFilters == null) { if (tokenFilters == null) {
out.writeVInt(0); out.writeVInt(0);
} else { } else {
@ -184,15 +171,6 @@ public class AnalyzeRequest extends SingleCustomOperationRequest {
out.writeUTF(tokenFilter); out.writeUTF(tokenFilter);
} }
} }
writeOption(out, field); out.writeOptionalUTF(field);
}
private void writeOption(StreamOutput out, String value) throws IOException {
if (value == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
out.writeUTF(value);
}
} }
} }