diff --git a/core/src/main/java/org/elasticsearch/action/RealtimeRequest.java b/core/src/main/java/org/elasticsearch/action/RealtimeRequest.java
index aefdcc5bdd9..28bcf1e8839 100644
--- a/core/src/main/java/org/elasticsearch/action/RealtimeRequest.java
+++ b/core/src/main/java/org/elasticsearch/action/RealtimeRequest.java
@@ -26,10 +26,8 @@ package org.elasticsearch.action;
public interface RealtimeRequest {
/**
- * @param realtime Controls whether this request should be realtime by reading from the translog. If null
- * is specified then whether the operation will be realtime depends on the api of the concrete request
- * subclass.
+ * @param realtime Controls whether this request should be realtime by reading from the translog.
*/
- R realtime(Boolean realtime);
+ R realtime(boolean realtime);
}
diff --git a/core/src/main/java/org/elasticsearch/action/get/GetRequest.java b/core/src/main/java/org/elasticsearch/action/get/GetRequest.java
index 4b27283d000..5d1bfc1ed23 100644
--- a/core/src/main/java/org/elasticsearch/action/get/GetRequest.java
+++ b/core/src/main/java/org/elasticsearch/action/get/GetRequest.java
@@ -57,7 +57,7 @@ public class GetRequest extends SingleShardRequest implements Realti
private boolean refresh = false;
- Boolean realtime;
+ boolean realtime = true;
private VersionType versionType = VersionType.INTERNAL;
private long version = Versions.MATCH_ANY;
@@ -218,11 +218,11 @@ public class GetRequest extends SingleShardRequest implements Realti
}
public boolean realtime() {
- return this.realtime == null ? true : this.realtime;
+ return this.realtime;
}
@Override
- public GetRequest realtime(Boolean realtime) {
+ public GetRequest realtime(boolean realtime) {
this.realtime = realtime;
return this;
}
@@ -277,12 +277,7 @@ public class GetRequest extends SingleShardRequest implements Realti
fields[i] = in.readString();
}
}
- byte realtime = in.readByte();
- if (realtime == 0) {
- this.realtime = false;
- } else if (realtime == 1) {
- this.realtime = true;
- }
+ realtime = in.readBoolean();
this.ignoreErrorsOnGeneratedFields = in.readBoolean();
this.versionType = VersionType.fromValue(in.readByte());
@@ -308,13 +303,7 @@ public class GetRequest extends SingleShardRequest implements Realti
out.writeString(field);
}
}
- if (realtime == null) {
- out.writeByte((byte) -1);
- } else if (!realtime) {
- out.writeByte((byte) 0);
- } else {
- out.writeByte((byte) 1);
- }
+ out.writeBoolean(realtime);
out.writeBoolean(ignoreErrorsOnGeneratedFields);
out.writeByte(versionType.getValue());
out.writeLong(version);
diff --git a/core/src/main/java/org/elasticsearch/action/get/GetRequestBuilder.java b/core/src/main/java/org/elasticsearch/action/get/GetRequestBuilder.java
index f785a3065ed..4b57c4ba92c 100644
--- a/core/src/main/java/org/elasticsearch/action/get/GetRequestBuilder.java
+++ b/core/src/main/java/org/elasticsearch/action/get/GetRequestBuilder.java
@@ -150,7 +150,7 @@ public class GetRequestBuilder extends SingleShardOperationRequestBuilder implements I
}
String preference;
- Boolean realtime;
+ boolean realtime = true;
boolean refresh;
public boolean ignoreErrorsOnGeneratedFields = false;
@@ -319,11 +319,11 @@ public class MultiGetRequest extends ActionRequest implements I
}
public boolean realtime() {
- return this.realtime == null ? true : this.realtime;
+ return this.realtime;
}
@Override
- public MultiGetRequest realtime(Boolean realtime) {
+ public MultiGetRequest realtime(boolean realtime) {
this.realtime = realtime;
return this;
}
@@ -509,12 +509,7 @@ public class MultiGetRequest extends ActionRequest implements I
super.readFrom(in);
preference = in.readOptionalString();
refresh = in.readBoolean();
- byte realtime = in.readByte();
- if (realtime == 0) {
- this.realtime = false;
- } else if (realtime == 1) {
- this.realtime = true;
- }
+ realtime = in.readBoolean();
ignoreErrorsOnGeneratedFields = in.readBoolean();
int size = in.readVInt();
@@ -529,13 +524,7 @@ public class MultiGetRequest extends ActionRequest implements I
super.writeTo(out);
out.writeOptionalString(preference);
out.writeBoolean(refresh);
- if (realtime == null) {
- out.writeByte((byte) -1);
- } else if (realtime == false) {
- out.writeByte((byte) 0);
- } else {
- out.writeByte((byte) 1);
- }
+ out.writeBoolean(realtime);
out.writeBoolean(ignoreErrorsOnGeneratedFields);
out.writeVInt(items.size());
diff --git a/core/src/main/java/org/elasticsearch/action/get/MultiGetRequestBuilder.java b/core/src/main/java/org/elasticsearch/action/get/MultiGetRequestBuilder.java
index ad587574075..6e32e1caf30 100644
--- a/core/src/main/java/org/elasticsearch/action/get/MultiGetRequestBuilder.java
+++ b/core/src/main/java/org/elasticsearch/action/get/MultiGetRequestBuilder.java
@@ -76,7 +76,7 @@ public class MultiGetRequestBuilder extends ActionRequestBuilder {
private final IndicesService indicesService;
- private final boolean realtime;
@Inject
public TransportGetAction(Settings settings, ClusterService clusterService, TransportService transportService,
@@ -53,8 +52,6 @@ public class TransportGetAction extends TransportSingleShardAction i
// TODO: change to String[]
private Set selectedFields;
- Boolean realtime;
+ private boolean realtime = true;
private Map perFieldAnalyzer;
@@ -394,14 +394,11 @@ public class TermVectorsRequest extends SingleShardRequest i
* Return whether term vectors should be generated real-time (default to true).
*/
public boolean realtime() {
- return this.realtime == null ? true : this.realtime;
+ return this.realtime;
}
- /**
- * Choose whether term vectors be generated real-time.
- */
@Override
- public TermVectorsRequest realtime(Boolean realtime) {
+ public TermVectorsRequest realtime(boolean realtime) {
this.realtime = realtime;
return this;
}
@@ -559,7 +556,7 @@ public class TermVectorsRequest extends SingleShardRequest i
if (filterSettings != null) {
filterSettings.writeTo(out);
}
- out.writeBoolean(realtime());
+ out.writeBoolean(realtime);
out.writeByte(versionType.getValue());
out.writeLong(version);
}
diff --git a/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequestBuilder.java b/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequestBuilder.java
index ae4bbc63f1d..9aa3ebca759 100644
--- a/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequestBuilder.java
+++ b/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequestBuilder.java
@@ -161,7 +161,7 @@ public class TermVectorsRequestBuilder extends ActionRequestBuilder