From ba08313417b96086eea8de9d5a8d8501bf2b9806 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 19 Apr 2016 15:06:14 +0200 Subject: [PATCH] settings: Removed `action.get.realtime` setting Closes #12543 --- .../elasticsearch/action/RealtimeRequest.java | 6 ++---- .../elasticsearch/action/get/GetRequest.java | 21 +++++-------------- .../action/get/GetRequestBuilder.java | 2 +- .../action/get/MultiGetRequest.java | 21 +++++-------------- .../action/get/MultiGetRequestBuilder.java | 2 +- .../action/get/MultiGetShardRequest.java | 21 +++++-------------- .../action/get/TransportGetAction.java | 6 ------ .../get/TransportShardMultiGetAction.java | 11 ---------- .../termvectors/MultiTermVectorsRequest.java | 2 +- .../termvectors/TermVectorsRequest.java | 11 ++++------ .../TermVectorsRequestBuilder.java | 2 +- .../rest/action/get/RestGetAction.java | 2 +- .../rest/action/get/RestGetSourceAction.java | 2 +- .../rest/action/get/RestHeadAction.java | 2 +- .../rest/action/get/RestMultiGetAction.java | 2 +- .../action/percolate/RestPercolateAction.java | 2 +- .../termvectors/RestTermVectorsAction.java | 2 +- docs/reference/docs/get.asciidoc | 7 ++----- .../migration/migrate_5_0/settings.asciidoc | 7 +++++++ 19 files changed, 40 insertions(+), 91 deletions(-) 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