Update api & Indices stats: fixed version checks for no-op updates which got in after 1.3 was released
Also added basic bw comp test for indices stats api. Relates to #6822
This commit is contained in:
parent
90dfb350e0
commit
ba8df3b5ba
|
@ -672,10 +672,8 @@ public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest>
|
|||
docAsUpsert = in.readBoolean();
|
||||
version = Versions.readVersion(in);
|
||||
versionType = VersionType.fromValue(in.readByte());
|
||||
if (in.getVersion().onOrAfter(Version.V_1_3_0)) {
|
||||
detectNoop = in.readBoolean();
|
||||
}
|
||||
if (in.getVersion().onOrAfter(Version.V_1_4_0)) {
|
||||
detectNoop = in.readBoolean();
|
||||
scriptedUpsert = in.readBoolean();
|
||||
}
|
||||
}
|
||||
|
@ -727,10 +725,8 @@ public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest>
|
|||
out.writeBoolean(docAsUpsert);
|
||||
Versions.writeVersion(version, out);
|
||||
out.writeByte(versionType.getValue());
|
||||
if (out.getVersion().onOrAfter(Version.V_1_3_0)) {
|
||||
out.writeBoolean(detectNoop);
|
||||
}
|
||||
if (out.getVersion().onOrAfter(Version.V_1_4_0)) {
|
||||
out.writeBoolean(detectNoop);
|
||||
out.writeBoolean(scriptedUpsert);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public class IndexingStats implements Streamable, ToXContent {
|
|||
deleteTimeInMillis = in.readVLong();
|
||||
deleteCurrent = in.readVLong();
|
||||
|
||||
if (in.getVersion().onOrAfter(Version.V_1_3_0)) {
|
||||
if (in.getVersion().onOrAfter(Version.V_1_4_0)) {
|
||||
noopUpdateCount = in.readVLong();
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class IndexingStats implements Streamable, ToXContent {
|
|||
out.writeVLong(deleteTimeInMillis);
|
||||
out.writeVLong(deleteCurrent);
|
||||
|
||||
if (out.getVersion().onOrAfter(Version.V_1_3_0)) {
|
||||
if (out.getVersion().onOrAfter(Version.V_1_4_0)) {
|
||||
out.writeVLong(noopUpdateCount);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotR
|
|||
import org.elasticsearch.action.admin.indices.alias.Alias;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.count.CountResponse;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
import org.elasticsearch.action.deletebyquery.DeleteByQueryResponse;
|
||||
|
@ -723,6 +724,16 @@ public class BasicBackwardsCompatibilityTest extends ElasticsearchBackwardsCompa
|
|||
assertThat(fields.terms("field").size(), equalTo(8l));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIndicesStats() {
|
||||
createIndex("test");
|
||||
ensureYellow("test");
|
||||
|
||||
IndicesStatsResponse indicesStatsResponse = client().admin().indices().prepareStats().all().get();
|
||||
assertThat(indicesStatsResponse.getIndices().size(), equalTo(1));
|
||||
assertThat(indicesStatsResponse.getIndices().containsKey("test"), equalTo(true));
|
||||
}
|
||||
|
||||
private static String indexOrAlias() {
|
||||
return randomBoolean() ? "test" : "alias";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue