Introduce aliases version (#41397)
This commit introduces aliases versions to index metadata. This will be useful in CCR when we replicate aliases.
This commit is contained in:
parent
7c2e151bf2
commit
65af47eb31
|
@ -341,6 +341,7 @@ public class ClusterState implements ToXContentFragment, Diffable<ClusterState>
|
||||||
sb.append(": v[").append(indexMetaData.getVersion())
|
sb.append(": v[").append(indexMetaData.getVersion())
|
||||||
.append("], mv[").append(indexMetaData.getMappingVersion())
|
.append("], mv[").append(indexMetaData.getMappingVersion())
|
||||||
.append("], sv[").append(indexMetaData.getSettingsVersion())
|
.append("], sv[").append(indexMetaData.getSettingsVersion())
|
||||||
|
.append("], av[").append(indexMetaData.getAliasesVersion())
|
||||||
.append("]\n");
|
.append("]\n");
|
||||||
for (int shard = 0; shard < indexMetaData.getNumberOfShards(); shard++) {
|
for (int shard = 0; shard < indexMetaData.getNumberOfShards(); shard++) {
|
||||||
sb.append(TAB).append(TAB).append(shard).append(": ");
|
sb.append(TAB).append(TAB).append(shard).append(": ");
|
||||||
|
|
|
@ -260,6 +260,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
static final String KEY_VERSION = "version";
|
static final String KEY_VERSION = "version";
|
||||||
static final String KEY_MAPPING_VERSION = "mapping_version";
|
static final String KEY_MAPPING_VERSION = "mapping_version";
|
||||||
static final String KEY_SETTINGS_VERSION = "settings_version";
|
static final String KEY_SETTINGS_VERSION = "settings_version";
|
||||||
|
static final String KEY_ALIASES_VERSION = "aliases_version";
|
||||||
static final String KEY_ROUTING_NUM_SHARDS = "routing_num_shards";
|
static final String KEY_ROUTING_NUM_SHARDS = "routing_num_shards";
|
||||||
static final String KEY_SETTINGS = "settings";
|
static final String KEY_SETTINGS = "settings";
|
||||||
static final String KEY_STATE = "state";
|
static final String KEY_STATE = "state";
|
||||||
|
@ -282,6 +283,8 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
private final long mappingVersion;
|
private final long mappingVersion;
|
||||||
|
|
||||||
private final long settingsVersion;
|
private final long settingsVersion;
|
||||||
|
|
||||||
|
private final long aliasesVersion;
|
||||||
|
|
||||||
private final long[] primaryTerms;
|
private final long[] primaryTerms;
|
||||||
|
|
||||||
|
@ -310,15 +313,31 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
private final ActiveShardCount waitForActiveShards;
|
private final ActiveShardCount waitForActiveShards;
|
||||||
private final ImmutableOpenMap<String, RolloverInfo> rolloverInfos;
|
private final ImmutableOpenMap<String, RolloverInfo> rolloverInfos;
|
||||||
|
|
||||||
private IndexMetaData(Index index, long version, long mappingVersion, long settingsVersion, long[] primaryTerms, State state,
|
private IndexMetaData(
|
||||||
int numberOfShards, int numberOfReplicas, Settings settings,
|
final Index index,
|
||||||
ImmutableOpenMap<String, MappingMetaData> mappings, ImmutableOpenMap<String, AliasMetaData> aliases,
|
final long version,
|
||||||
ImmutableOpenMap<String, DiffableStringMap> customData, ImmutableOpenIntMap<Set<String>> inSyncAllocationIds,
|
final long mappingVersion,
|
||||||
DiscoveryNodeFilters requireFilters, DiscoveryNodeFilters initialRecoveryFilters,
|
final long settingsVersion,
|
||||||
DiscoveryNodeFilters includeFilters, DiscoveryNodeFilters excludeFilters,
|
final long aliasesVersion,
|
||||||
Version indexCreatedVersion, Version indexUpgradedVersion,
|
final long[] primaryTerms,
|
||||||
int routingNumShards, int routingPartitionSize, ActiveShardCount waitForActiveShards,
|
final State state,
|
||||||
ImmutableOpenMap<String, RolloverInfo> rolloverInfos) {
|
final int numberOfShards,
|
||||||
|
final int numberOfReplicas,
|
||||||
|
final Settings settings,
|
||||||
|
final ImmutableOpenMap<String, MappingMetaData> mappings,
|
||||||
|
final ImmutableOpenMap<String, AliasMetaData> aliases,
|
||||||
|
final ImmutableOpenMap<String, DiffableStringMap> customData,
|
||||||
|
final ImmutableOpenIntMap<Set<String>> inSyncAllocationIds,
|
||||||
|
final DiscoveryNodeFilters requireFilters,
|
||||||
|
final DiscoveryNodeFilters initialRecoveryFilters,
|
||||||
|
final DiscoveryNodeFilters includeFilters,
|
||||||
|
final DiscoveryNodeFilters excludeFilters,
|
||||||
|
final Version indexCreatedVersion,
|
||||||
|
final Version indexUpgradedVersion,
|
||||||
|
final int routingNumShards,
|
||||||
|
final int routingPartitionSize,
|
||||||
|
final ActiveShardCount waitForActiveShards,
|
||||||
|
final ImmutableOpenMap<String, RolloverInfo> rolloverInfos) {
|
||||||
|
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
@ -326,6 +345,8 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
this.mappingVersion = mappingVersion;
|
this.mappingVersion = mappingVersion;
|
||||||
assert settingsVersion >= 0 : settingsVersion;
|
assert settingsVersion >= 0 : settingsVersion;
|
||||||
this.settingsVersion = settingsVersion;
|
this.settingsVersion = settingsVersion;
|
||||||
|
assert aliasesVersion >= 0 : aliasesVersion;
|
||||||
|
this.aliasesVersion = aliasesVersion;
|
||||||
this.primaryTerms = primaryTerms;
|
this.primaryTerms = primaryTerms;
|
||||||
assert primaryTerms.length == numberOfShards;
|
assert primaryTerms.length == numberOfShards;
|
||||||
this.state = state;
|
this.state = state;
|
||||||
|
@ -383,6 +404,10 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
return settingsVersion;
|
return settingsVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getAliasesVersion() {
|
||||||
|
return aliasesVersion;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The term of the current selected primary. This is a non-negative number incremented when
|
* The term of the current selected primary. This is a non-negative number incremented when
|
||||||
* a primary shard is assigned after a full cluster restart or a replica shard is promoted to a primary.
|
* a primary shard is assigned after a full cluster restart or a replica shard is promoted to a primary.
|
||||||
|
@ -652,6 +677,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
private final long version;
|
private final long version;
|
||||||
private final long mappingVersion;
|
private final long mappingVersion;
|
||||||
private final long settingsVersion;
|
private final long settingsVersion;
|
||||||
|
private final long aliasesVersion;
|
||||||
private final long[] primaryTerms;
|
private final long[] primaryTerms;
|
||||||
private final State state;
|
private final State state;
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
|
@ -666,6 +692,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
version = after.version;
|
version = after.version;
|
||||||
mappingVersion = after.mappingVersion;
|
mappingVersion = after.mappingVersion;
|
||||||
settingsVersion = after.settingsVersion;
|
settingsVersion = after.settingsVersion;
|
||||||
|
aliasesVersion = after.aliasesVersion;
|
||||||
routingNumShards = after.routingNumShards;
|
routingNumShards = after.routingNumShards;
|
||||||
state = after.state;
|
state = after.state;
|
||||||
settings = after.settings;
|
settings = after.settings;
|
||||||
|
@ -692,6 +719,11 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
} else {
|
} else {
|
||||||
settingsVersion = 1;
|
settingsVersion = 1;
|
||||||
}
|
}
|
||||||
|
if (in.getVersion().onOrAfter(Version.V_7_1_0)) {
|
||||||
|
aliasesVersion = in.readVLong();
|
||||||
|
} else {
|
||||||
|
aliasesVersion = 1;
|
||||||
|
}
|
||||||
state = State.fromId(in.readByte());
|
state = State.fromId(in.readByte());
|
||||||
settings = Settings.readSettingsFromStream(in);
|
settings = Settings.readSettingsFromStream(in);
|
||||||
primaryTerms = in.readVLongArray();
|
primaryTerms = in.readVLongArray();
|
||||||
|
@ -723,6 +755,9 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
if (out.getVersion().onOrAfter(Version.V_6_5_0)) {
|
if (out.getVersion().onOrAfter(Version.V_6_5_0)) {
|
||||||
out.writeVLong(settingsVersion);
|
out.writeVLong(settingsVersion);
|
||||||
}
|
}
|
||||||
|
if (out.getVersion().onOrAfter(Version.V_7_1_0)) {
|
||||||
|
out.writeVLong(aliasesVersion);
|
||||||
|
}
|
||||||
out.writeByte(state.id);
|
out.writeByte(state.id);
|
||||||
Settings.writeSettingsToStream(settings, out);
|
Settings.writeSettingsToStream(settings, out);
|
||||||
out.writeVLongArray(primaryTerms);
|
out.writeVLongArray(primaryTerms);
|
||||||
|
@ -741,6 +776,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
builder.version(version);
|
builder.version(version);
|
||||||
builder.mappingVersion(mappingVersion);
|
builder.mappingVersion(mappingVersion);
|
||||||
builder.settingsVersion(settingsVersion);
|
builder.settingsVersion(settingsVersion);
|
||||||
|
builder.aliasesVersion(aliasesVersion);
|
||||||
builder.setRoutingNumShards(routingNumShards);
|
builder.setRoutingNumShards(routingNumShards);
|
||||||
builder.state(state);
|
builder.state(state);
|
||||||
builder.settings(settings);
|
builder.settings(settings);
|
||||||
|
@ -767,6 +803,11 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
} else {
|
} else {
|
||||||
builder.settingsVersion(1);
|
builder.settingsVersion(1);
|
||||||
}
|
}
|
||||||
|
if (in.getVersion().onOrAfter(Version.V_7_1_0)) {
|
||||||
|
builder.aliasesVersion(in.readVLong());
|
||||||
|
} else {
|
||||||
|
builder.aliasesVersion(1);
|
||||||
|
}
|
||||||
builder.setRoutingNumShards(in.readInt());
|
builder.setRoutingNumShards(in.readInt());
|
||||||
builder.state(State.fromId(in.readByte()));
|
builder.state(State.fromId(in.readByte()));
|
||||||
builder.settings(readSettingsFromStream(in));
|
builder.settings(readSettingsFromStream(in));
|
||||||
|
@ -819,6 +860,9 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
if (out.getVersion().onOrAfter(Version.V_6_5_0)) {
|
if (out.getVersion().onOrAfter(Version.V_6_5_0)) {
|
||||||
out.writeVLong(settingsVersion);
|
out.writeVLong(settingsVersion);
|
||||||
}
|
}
|
||||||
|
if (out.getVersion().onOrAfter(Version.V_7_1_0)) {
|
||||||
|
out.writeVLong(aliasesVersion);
|
||||||
|
}
|
||||||
out.writeInt(routingNumShards);
|
out.writeInt(routingNumShards);
|
||||||
out.writeByte(state.id());
|
out.writeByte(state.id());
|
||||||
writeSettingsToStream(settings, out);
|
writeSettingsToStream(settings, out);
|
||||||
|
@ -868,6 +912,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
private long version = 1;
|
private long version = 1;
|
||||||
private long mappingVersion = 1;
|
private long mappingVersion = 1;
|
||||||
private long settingsVersion = 1;
|
private long settingsVersion = 1;
|
||||||
|
private long aliasesVersion = 1;
|
||||||
private long[] primaryTerms = null;
|
private long[] primaryTerms = null;
|
||||||
private Settings settings = Settings.Builder.EMPTY_SETTINGS;
|
private Settings settings = Settings.Builder.EMPTY_SETTINGS;
|
||||||
private final ImmutableOpenMap.Builder<String, MappingMetaData> mappings;
|
private final ImmutableOpenMap.Builder<String, MappingMetaData> mappings;
|
||||||
|
@ -892,6 +937,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
this.version = indexMetaData.version;
|
this.version = indexMetaData.version;
|
||||||
this.mappingVersion = indexMetaData.mappingVersion;
|
this.mappingVersion = indexMetaData.mappingVersion;
|
||||||
this.settingsVersion = indexMetaData.settingsVersion;
|
this.settingsVersion = indexMetaData.settingsVersion;
|
||||||
|
this.aliasesVersion = indexMetaData.aliasesVersion;
|
||||||
this.settings = indexMetaData.getSettings();
|
this.settings = indexMetaData.getSettings();
|
||||||
this.primaryTerms = indexMetaData.primaryTerms.clone();
|
this.primaryTerms = indexMetaData.primaryTerms.clone();
|
||||||
this.mappings = ImmutableOpenMap.builder(indexMetaData.mappings);
|
this.mappings = ImmutableOpenMap.builder(indexMetaData.mappings);
|
||||||
|
@ -1040,20 +1086,29 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
return mappingVersion;
|
return mappingVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long settingsVersion() {
|
|
||||||
return settingsVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder mappingVersion(final long mappingVersion) {
|
public Builder mappingVersion(final long mappingVersion) {
|
||||||
this.mappingVersion = mappingVersion;
|
this.mappingVersion = mappingVersion;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long settingsVersion() {
|
||||||
|
return settingsVersion;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder settingsVersion(final long settingsVersion) {
|
public Builder settingsVersion(final long settingsVersion) {
|
||||||
this.settingsVersion = settingsVersion;
|
this.settingsVersion = settingsVersion;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long aliasesVersion() {
|
||||||
|
return aliasesVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder aliasesVersion(final long aliasesVersion) {
|
||||||
|
this.aliasesVersion = aliasesVersion;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the primary term for the given shard.
|
* returns the primary term for the given shard.
|
||||||
* See {@link IndexMetaData#primaryTerm(int)} for more information.
|
* See {@link IndexMetaData#primaryTerm(int)} for more information.
|
||||||
|
@ -1182,11 +1237,31 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
|
|
||||||
final String uuid = settings.get(SETTING_INDEX_UUID, INDEX_UUID_NA_VALUE);
|
final String uuid = settings.get(SETTING_INDEX_UUID, INDEX_UUID_NA_VALUE);
|
||||||
|
|
||||||
return new IndexMetaData(new Index(index, uuid), version, mappingVersion, settingsVersion, primaryTerms, state,
|
return new IndexMetaData(
|
||||||
numberOfShards, numberOfReplicas, tmpSettings, mappings.build(), tmpAliases.build(), customMetaData.build(),
|
new Index(index, uuid),
|
||||||
filledInSyncAllocationIds.build(), requireFilters, initialRecoveryFilters, includeFilters, excludeFilters,
|
version,
|
||||||
indexCreatedVersion, indexUpgradedVersion, getRoutingNumShards(), routingPartitionSize, waitForActiveShards,
|
mappingVersion,
|
||||||
rolloverInfos.build());
|
settingsVersion,
|
||||||
|
aliasesVersion,
|
||||||
|
primaryTerms,
|
||||||
|
state,
|
||||||
|
numberOfShards,
|
||||||
|
numberOfReplicas,
|
||||||
|
tmpSettings,
|
||||||
|
mappings.build(),
|
||||||
|
tmpAliases.build(),
|
||||||
|
customMetaData.build(),
|
||||||
|
filledInSyncAllocationIds.build(),
|
||||||
|
requireFilters,
|
||||||
|
initialRecoveryFilters,
|
||||||
|
includeFilters,
|
||||||
|
excludeFilters,
|
||||||
|
indexCreatedVersion,
|
||||||
|
indexUpgradedVersion,
|
||||||
|
getRoutingNumShards(),
|
||||||
|
routingPartitionSize,
|
||||||
|
waitForActiveShards,
|
||||||
|
rolloverInfos.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toXContent(IndexMetaData indexMetaData, XContentBuilder builder, ToXContent.Params params) throws IOException {
|
public static void toXContent(IndexMetaData indexMetaData, XContentBuilder builder, ToXContent.Params params) throws IOException {
|
||||||
|
@ -1195,6 +1270,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
builder.field(KEY_VERSION, indexMetaData.getVersion());
|
builder.field(KEY_VERSION, indexMetaData.getVersion());
|
||||||
builder.field(KEY_MAPPING_VERSION, indexMetaData.getMappingVersion());
|
builder.field(KEY_MAPPING_VERSION, indexMetaData.getMappingVersion());
|
||||||
builder.field(KEY_SETTINGS_VERSION, indexMetaData.getSettingsVersion());
|
builder.field(KEY_SETTINGS_VERSION, indexMetaData.getSettingsVersion());
|
||||||
|
builder.field(KEY_ALIASES_VERSION, indexMetaData.getAliasesVersion());
|
||||||
builder.field(KEY_ROUTING_NUM_SHARDS, indexMetaData.getRoutingNumShards());
|
builder.field(KEY_ROUTING_NUM_SHARDS, indexMetaData.getRoutingNumShards());
|
||||||
builder.field(KEY_STATE, indexMetaData.getState().toString().toLowerCase(Locale.ENGLISH));
|
builder.field(KEY_STATE, indexMetaData.getState().toString().toLowerCase(Locale.ENGLISH));
|
||||||
|
|
||||||
|
@ -1269,6 +1345,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
}
|
}
|
||||||
boolean mappingVersion = false;
|
boolean mappingVersion = false;
|
||||||
boolean settingsVersion = false;
|
boolean settingsVersion = false;
|
||||||
|
boolean aliasesVersion = false;
|
||||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
|
||||||
if (token == XContentParser.Token.FIELD_NAME) {
|
if (token == XContentParser.Token.FIELD_NAME) {
|
||||||
currentFieldName = parser.currentName();
|
currentFieldName = parser.currentName();
|
||||||
|
@ -1367,6 +1444,9 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
} else if (KEY_SETTINGS_VERSION.equals(currentFieldName)) {
|
} else if (KEY_SETTINGS_VERSION.equals(currentFieldName)) {
|
||||||
settingsVersion = true;
|
settingsVersion = true;
|
||||||
builder.settingsVersion(parser.longValue());
|
builder.settingsVersion(parser.longValue());
|
||||||
|
} else if (KEY_ALIASES_VERSION.equals(currentFieldName)) {
|
||||||
|
aliasesVersion = true;
|
||||||
|
builder.aliasesVersion(parser.longValue());
|
||||||
} else if (KEY_ROUTING_NUM_SHARDS.equals(currentFieldName)) {
|
} else if (KEY_ROUTING_NUM_SHARDS.equals(currentFieldName)) {
|
||||||
builder.setRoutingNumShards(parser.intValue());
|
builder.setRoutingNumShards(parser.intValue());
|
||||||
} else {
|
} else {
|
||||||
|
@ -1382,6 +1462,9 @@ public class IndexMetaData implements Diffable<IndexMetaData>, ToXContentFragmen
|
||||||
if (Assertions.ENABLED && Version.indexCreated(builder.settings).onOrAfter(Version.V_6_5_0)) {
|
if (Assertions.ENABLED && Version.indexCreated(builder.settings).onOrAfter(Version.V_6_5_0)) {
|
||||||
assert settingsVersion : "settings version should be present for indices created on or after 6.5.0";
|
assert settingsVersion : "settings version should be present for indices created on or after 6.5.0";
|
||||||
}
|
}
|
||||||
|
if (Assertions.ENABLED && Version.indexCreated(builder.settings).onOrAfter(Version.V_7_1_0)) {
|
||||||
|
assert aliasesVersion : "aliases version should be present for indices created on or after 7.1.0";
|
||||||
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,7 @@ public class MetaDataIndexAliasesService {
|
||||||
}
|
}
|
||||||
MetaData.Builder metadata = MetaData.builder(currentState.metaData());
|
MetaData.Builder metadata = MetaData.builder(currentState.metaData());
|
||||||
// Run the remaining alias actions
|
// Run the remaining alias actions
|
||||||
|
final Set<String> maybeModifiedIndices = new HashSet<>();
|
||||||
for (AliasAction action : actions) {
|
for (AliasAction action : actions) {
|
||||||
if (action.removeIndex()) {
|
if (action.removeIndex()) {
|
||||||
// Handled above
|
// Handled above
|
||||||
|
@ -151,7 +152,20 @@ public class MetaDataIndexAliasesService {
|
||||||
xContentRegistry);
|
xContentRegistry);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
changed |= action.apply(newAliasValidator, metadata, index);
|
if (action.apply(newAliasValidator, metadata, index)) {
|
||||||
|
changed = true;
|
||||||
|
maybeModifiedIndices.add(index.getIndex().getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final String maybeModifiedIndex : maybeModifiedIndices) {
|
||||||
|
final IndexMetaData currentIndexMetaData = currentState.metaData().index(maybeModifiedIndex);
|
||||||
|
final IndexMetaData newIndexMetaData = metadata.get(maybeModifiedIndex);
|
||||||
|
// only increment the aliases version if the aliases actually changed for this index
|
||||||
|
if (currentIndexMetaData.getAliases().equals(newIndexMetaData.getAliases()) == false) {
|
||||||
|
assert currentIndexMetaData.getAliasesVersion() == newIndexMetaData.getAliasesVersion();
|
||||||
|
metadata.put(new IndexMetaData.Builder(newIndexMetaData).aliasesVersion(1 + currentIndexMetaData.getAliasesVersion()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
|
|
|
@ -308,13 +308,18 @@ public class RestoreService implements ClusterStateApplier {
|
||||||
} else {
|
} else {
|
||||||
validateExistingIndex(currentIndexMetaData, snapshotIndexMetaData, renamedIndexName, partial);
|
validateExistingIndex(currentIndexMetaData, snapshotIndexMetaData, renamedIndexName, partial);
|
||||||
// Index exists and it's closed - open it in metadata and start recovery
|
// Index exists and it's closed - open it in metadata and start recovery
|
||||||
IndexMetaData.Builder indexMdBuilder = IndexMetaData.builder(snapshotIndexMetaData)
|
IndexMetaData.Builder indexMdBuilder =
|
||||||
.state(IndexMetaData.State.OPEN);
|
IndexMetaData.builder(snapshotIndexMetaData).state(IndexMetaData.State.OPEN);
|
||||||
indexMdBuilder.version(Math.max(snapshotIndexMetaData.getVersion(), currentIndexMetaData.getVersion() + 1));
|
indexMdBuilder.version(
|
||||||
indexMdBuilder.mappingVersion(Math.max(snapshotIndexMetaData.getMappingVersion(),
|
Math.max(snapshotIndexMetaData.getVersion(), 1 + currentIndexMetaData.getVersion()));
|
||||||
currentIndexMetaData.getMappingVersion() + 1));
|
indexMdBuilder.mappingVersion(
|
||||||
indexMdBuilder.settingsVersion(Math.max(snapshotIndexMetaData.getSettingsVersion(),
|
Math.max(snapshotIndexMetaData.getMappingVersion(), 1 + currentIndexMetaData.getMappingVersion()));
|
||||||
currentIndexMetaData.getSettingsVersion() + 1));
|
indexMdBuilder.settingsVersion(
|
||||||
|
Math.max(
|
||||||
|
snapshotIndexMetaData.getSettingsVersion(),
|
||||||
|
1 + currentIndexMetaData.getSettingsVersion()));
|
||||||
|
indexMdBuilder.aliasesVersion(
|
||||||
|
Math.max(snapshotIndexMetaData.getAliasesVersion(), 1 + currentIndexMetaData.getAliasesVersion()));
|
||||||
|
|
||||||
for (int shard = 0; shard < snapshotIndexMetaData.getNumberOfShards(); shard++) {
|
for (int shard = 0; shard < snapshotIndexMetaData.getNumberOfShards(); shard++) {
|
||||||
indexMdBuilder.primaryTerm(shard,
|
indexMdBuilder.primaryTerm(shard,
|
||||||
|
|
|
@ -33,12 +33,14 @@ import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.cluster.metadata.AliasMetaData;
|
import org.elasticsearch.cluster.metadata.AliasMetaData;
|
||||||
import org.elasticsearch.cluster.metadata.AliasOrIndex;
|
import org.elasticsearch.cluster.metadata.AliasOrIndex;
|
||||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||||
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.common.StopWatch;
|
import org.elasticsearch.common.StopWatch;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.xcontent.XContentType;
|
import org.elasticsearch.common.xcontent.XContentType;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
import org.elasticsearch.index.query.QueryBuilders;
|
import org.elasticsearch.index.query.QueryBuilders;
|
||||||
|
import org.elasticsearch.index.query.TermQueryBuilder;
|
||||||
import org.elasticsearch.rest.action.admin.indices.AliasesNotFoundException;
|
import org.elasticsearch.rest.action.admin.indices.AliasesNotFoundException;
|
||||||
import org.elasticsearch.search.SearchHit;
|
import org.elasticsearch.search.SearchHit;
|
||||||
import org.elasticsearch.search.SearchHits;
|
import org.elasticsearch.search.SearchHits;
|
||||||
|
@ -49,8 +51,10 @@ import org.elasticsearch.search.sort.SortOrder;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
@ -81,14 +85,18 @@ import static org.hamcrest.Matchers.notNullValue;
|
||||||
import static org.hamcrest.Matchers.nullValue;
|
import static org.hamcrest.Matchers.nullValue;
|
||||||
|
|
||||||
public class IndexAliasesIT extends ESIntegTestCase {
|
public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
|
|
||||||
public void testAliases() throws Exception {
|
public void testAliases() throws Exception {
|
||||||
logger.info("--> creating index [test]");
|
logger.info("--> creating index [test]");
|
||||||
createIndex("test");
|
createIndex("test");
|
||||||
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
logger.info("--> aliasing index [test] with [alias1]");
|
assertAliasesVersionIncreases(
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1", false));
|
"test", () -> {
|
||||||
|
logger.info("--> aliasing index [test] with [alias1]");
|
||||||
|
assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1", false));
|
||||||
|
});
|
||||||
|
|
||||||
logger.info("--> indexing against [alias1], should fail now");
|
logger.info("--> indexing against [alias1], should fail now");
|
||||||
IllegalArgumentException exception = expectThrows(IllegalArgumentException.class,
|
IllegalArgumentException exception = expectThrows(IllegalArgumentException.class,
|
||||||
|
@ -98,8 +106,13 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
" The write index may be explicitly disabled using is_write_index=false or the alias points to multiple" +
|
" The write index may be explicitly disabled using is_write_index=false or the alias points to multiple" +
|
||||||
" indices without one being designated as a write index"));
|
" indices without one being designated as a write index"));
|
||||||
|
|
||||||
logger.info("--> aliasing index [test] with [alias1]");
|
assertAliasesVersionIncreases(
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1"));
|
"test",
|
||||||
|
() -> {
|
||||||
|
logger.info("--> aliasing index [test] with [alias1]");
|
||||||
|
assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1"));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
logger.info("--> indexing against [alias1], should work now");
|
logger.info("--> indexing against [alias1], should work now");
|
||||||
IndexResponse indexResponse = client().index(indexRequest("alias1").type("type1").id("1")
|
IndexResponse indexResponse = client().index(indexRequest("alias1").type("type1").id("1")
|
||||||
|
@ -111,8 +124,10 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
|
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
logger.info("--> add index [test_x] with [alias1]");
|
assertAliasesVersionIncreases("test_x", () -> {
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test_x", "alias1"));
|
logger.info("--> add index [test_x] with [alias1]");
|
||||||
|
assertAcked(admin().indices().prepareAliases().addAlias("test_x", "alias1"));
|
||||||
|
});
|
||||||
|
|
||||||
logger.info("--> indexing against [alias1], should fail now");
|
logger.info("--> indexing against [alias1], should fail now");
|
||||||
exception = expectThrows(IllegalArgumentException.class,
|
exception = expectThrows(IllegalArgumentException.class,
|
||||||
|
@ -129,16 +144,20 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
" The write index may be explicitly disabled using is_write_index=false or the alias points to multiple" +
|
" The write index may be explicitly disabled using is_write_index=false or the alias points to multiple" +
|
||||||
" indices without one being designated as a write index"));
|
" indices without one being designated as a write index"));
|
||||||
|
|
||||||
logger.info("--> remove aliasing index [test_x] with [alias1]");
|
assertAliasesVersionIncreases("test_x", () -> {
|
||||||
assertAcked(admin().indices().prepareAliases().removeAlias("test_x", "alias1"));
|
logger.info("--> remove aliasing index [test_x] with [alias1]");
|
||||||
|
assertAcked(admin().indices().prepareAliases().removeAlias("test_x", "alias1"));
|
||||||
|
});
|
||||||
|
|
||||||
logger.info("--> indexing against [alias1], should work now");
|
logger.info("--> indexing against [alias1], should work now");
|
||||||
indexResponse = client().index(indexRequest("alias1").type("type1").id("1")
|
indexResponse = client().index(indexRequest("alias1").type("type1").id("1")
|
||||||
.source(source("1", "test"), XContentType.JSON)).actionGet();
|
.source(source("1", "test"), XContentType.JSON)).actionGet();
|
||||||
assertThat(indexResponse.getIndex(), equalTo("test"));
|
assertThat(indexResponse.getIndex(), equalTo("test"));
|
||||||
|
|
||||||
logger.info("--> add index [test_x] with [alias1] as write-index");
|
assertAliasesVersionIncreases("test_x", () -> {
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test_x", "alias1", true));
|
logger.info("--> add index [test_x] with [alias1] as write-index");
|
||||||
|
assertAcked(admin().indices().prepareAliases().addAlias("test_x", "alias1", true));
|
||||||
|
});
|
||||||
|
|
||||||
logger.info("--> indexing against [alias1], should work now");
|
logger.info("--> indexing against [alias1], should work now");
|
||||||
indexResponse = client().index(indexRequest("alias1").type("type1").id("1")
|
indexResponse = client().index(indexRequest("alias1").type("type1").id("1")
|
||||||
|
@ -149,8 +168,10 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
DeleteResponse deleteResponse = client().delete(deleteRequest("alias1").type("type1").id("1")).actionGet();
|
DeleteResponse deleteResponse = client().delete(deleteRequest("alias1").type("type1").id("1")).actionGet();
|
||||||
assertThat(deleteResponse.getIndex(), equalTo("test_x"));
|
assertThat(deleteResponse.getIndex(), equalTo("test_x"));
|
||||||
|
|
||||||
logger.info("--> remove [alias1], Aliasing index [test_x] with [alias1]");
|
assertAliasesVersionIncreases("test_x", () -> {
|
||||||
assertAcked(admin().indices().prepareAliases().removeAlias("test", "alias1").addAlias("test_x", "alias1"));
|
logger.info("--> remove [alias1], Aliasing index [test_x] with [alias1]");
|
||||||
|
assertAcked(admin().indices().prepareAliases().removeAlias("test", "alias1").addAlias("test_x", "alias1"));
|
||||||
|
});
|
||||||
|
|
||||||
logger.info("--> indexing against [alias1], should work against [test_x]");
|
logger.info("--> indexing against [alias1], should work against [test_x]");
|
||||||
indexResponse = client().index(indexRequest("alias1").type("type1").id("1")
|
indexResponse = client().index(indexRequest("alias1").type("type1").id("1")
|
||||||
|
@ -181,7 +202,7 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
|
|
||||||
logger.info("--> aliasing index [test] with [alias1] and filter [user:kimchy]");
|
logger.info("--> aliasing index [test] with [alias1] and filter [user:kimchy]");
|
||||||
QueryBuilder filter = termQuery("user", "kimchy");
|
QueryBuilder filter = termQuery("user", "kimchy");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1", filter));
|
assertAliasesVersionIncreases("test", () -> assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1", filter)));
|
||||||
|
|
||||||
// For now just making sure that filter was stored with the alias
|
// For now just making sure that filter was stored with the alias
|
||||||
logger.info("--> making sure that filter was stored with alias [alias1] and filter [user:kimchy]");
|
logger.info("--> making sure that filter was stored with alias [alias1] and filter [user:kimchy]");
|
||||||
|
@ -210,11 +231,18 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
logger.info("--> adding filtering aliases to index [test]");
|
logger.info("--> adding filtering aliases to index [test]");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1"));
|
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "alias2"));
|
assertAliasesVersionIncreases("test", () -> assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "foos", termQuery("name", "foo")));
|
assertAliasesVersionIncreases("test", () -> assertAcked(admin().indices().prepareAliases().addAlias("test", "alias2")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "bars", termQuery("name", "bar")));
|
assertAliasesVersionIncreases(
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "tests", termQuery("name", "test")));
|
"test",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test", "foos", termQuery("name", "foo"))));
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test", "bars", termQuery("name", "bar"))));
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test", "tests", termQuery("name", "test"))));
|
||||||
|
|
||||||
logger.info("--> indexing against [test]");
|
logger.info("--> indexing against [test]");
|
||||||
client().index(indexRequest("test").type("type1").id("1").source(source("1", "foo test"), XContentType.JSON)
|
client().index(indexRequest("test").type("type1").id("1").source(source("1", "foo test"), XContentType.JSON)
|
||||||
|
@ -295,15 +323,21 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
logger.info("--> adding filtering aliases to index [test1]");
|
logger.info("--> adding filtering aliases to index [test1]");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "aliasToTest1"));
|
assertAliasesVersionIncreases("test1", () -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "aliasToTest1")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "aliasToTests"));
|
assertAliasesVersionIncreases("test1", () -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "aliasToTests")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "foos", termQuery("name", "foo")));
|
assertAliasesVersionIncreases(
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "bars", termQuery("name", "bar")));
|
"test1",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "foos", termQuery("name", "foo"))));
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test1",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "bars", termQuery("name", "bar"))));
|
||||||
|
|
||||||
logger.info("--> adding filtering aliases to index [test2]");
|
logger.info("--> adding filtering aliases to index [test2]");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test2", "aliasToTest2"));
|
assertAliasesVersionIncreases("test2", () -> assertAcked(admin().indices().prepareAliases().addAlias("test2", "aliasToTest2")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test2", "aliasToTests"));
|
assertAliasesVersionIncreases("test2", () -> assertAcked(admin().indices().prepareAliases().addAlias("test2", "aliasToTests")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test2", "foos", termQuery("name", "foo")));
|
assertAliasesVersionIncreases(
|
||||||
|
"test2",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test2", "foos", termQuery("name", "foo"))));
|
||||||
|
|
||||||
logger.info("--> indexing against [test1]");
|
logger.info("--> indexing against [test1]");
|
||||||
client().index(indexRequest("test1").type("type1").id("1").source(source("1", "foo test"), XContentType.JSON)).get();
|
client().index(indexRequest("test1").type("type1").id("1").source(source("1", "foo test"), XContentType.JSON)).get();
|
||||||
|
@ -367,17 +401,27 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
logger.info("--> adding aliases to indices");
|
logger.info("--> adding aliases to indices");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "alias12"));
|
assertAliasesVersionIncreases("test1", () -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "alias12")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test2", "alias12"));
|
assertAliasesVersionIncreases("test2", () -> assertAcked(admin().indices().prepareAliases().addAlias("test2", "alias12")));
|
||||||
|
|
||||||
logger.info("--> adding filtering aliases to indices");
|
logger.info("--> adding filtering aliases to indices");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "filter1", termQuery("name", "test1")));
|
assertAliasesVersionIncreases(
|
||||||
|
"test1",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "filter1", termQuery("name", "test1"))));
|
||||||
|
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test2", "filter23", termQuery("name", "foo")));
|
assertAliasesVersionIncreases(
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test3", "filter23", termQuery("name", "foo")));
|
"test2",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test2", "filter23", termQuery("name", "foo"))));
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test3",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test3", "filter23", termQuery("name", "foo"))));
|
||||||
|
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "filter13", termQuery("name", "baz")));
|
assertAliasesVersionIncreases(
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test3", "filter13", termQuery("name", "baz")));
|
"test1",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "filter13", termQuery("name", "baz"))));
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test3",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test3", "filter13", termQuery("name", "baz"))));
|
||||||
|
|
||||||
logger.info("--> indexing against [test1]");
|
logger.info("--> indexing against [test1]");
|
||||||
client().index(indexRequest("test1").type("type1").id("11").source(source("11", "foo test1"), XContentType.JSON)).get();
|
client().index(indexRequest("test1").type("type1").id("11").source(source("11", "foo test1"), XContentType.JSON)).get();
|
||||||
|
@ -433,17 +477,27 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
logger.info("--> adding filtering aliases to index [test1]");
|
logger.info("--> adding filtering aliases to index [test1]");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "aliasToTest1"));
|
assertAliasesVersionIncreases("test1", () -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "aliasToTest1")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "aliasToTests"));
|
assertAliasesVersionIncreases("test1", () -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "aliasToTests")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "foos", termQuery("name", "foo")));
|
assertAliasesVersionIncreases(
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "bars", termQuery("name", "bar")));
|
"test1",
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "tests", termQuery("name", "test")));
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "foos", termQuery("name", "foo"))));
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test1",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "bars", termQuery("name", "bar"))));
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test1",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test1", "tests", termQuery("name", "test"))));
|
||||||
|
|
||||||
logger.info("--> adding filtering aliases to index [test2]");
|
logger.info("--> adding filtering aliases to index [test2]");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test2", "aliasToTest2"));
|
assertAliasesVersionIncreases("test2", () -> assertAcked(admin().indices().prepareAliases().addAlias("test2", "aliasToTest2")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test2", "aliasToTests"));
|
assertAliasesVersionIncreases("test2", () -> assertAcked(admin().indices().prepareAliases().addAlias("test2", "aliasToTests")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test2", "foos", termQuery("name", "foo")));
|
assertAliasesVersionIncreases(
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test2", "tests", termQuery("name", "test")));
|
"test2",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test2", "foos", termQuery("name", "foo"))));
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test2",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test2", "tests", termQuery("name", "test"))));
|
||||||
|
|
||||||
logger.info("--> indexing against [test1]");
|
logger.info("--> indexing against [test1]");
|
||||||
client().index(indexRequest("test1").type("type1").id("1").source(source("1", "foo test"), XContentType.JSON)).get();
|
client().index(indexRequest("test1").type("type1").id("1").source(source("1", "foo test"), XContentType.JSON)).get();
|
||||||
|
@ -471,22 +525,30 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
logger.info("--> adding filtering aliases to index [test1]");
|
logger.info("--> adding filtering aliases to index [test1]");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test1", "aliasToTest1")
|
assertAliasesVersionIncreases(
|
||||||
.addAlias("test1", "aliasToTests")
|
"test1",
|
||||||
.addAlias("test1", "foos", termQuery("name", "foo"))
|
() -> assertAcked(admin().indices()
|
||||||
.addAlias("test1", "bars", termQuery("name", "bar"))
|
.prepareAliases()
|
||||||
.addAlias("test1", "tests", termQuery("name", "test")));
|
.addAlias("test1", "aliasToTest1")
|
||||||
|
.addAlias("test1", "aliasToTests")
|
||||||
|
.addAlias("test1", "foos", termQuery("name", "foo"))
|
||||||
|
.addAlias("test1", "bars", termQuery("name", "bar"))
|
||||||
|
.addAlias("test1", "tests", termQuery("name", "test"))));
|
||||||
|
|
||||||
logger.info("--> adding filtering aliases to index [test2]");
|
logger.info("--> adding filtering aliases to index [test2]");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test2", "aliasToTest2")
|
assertAliasesVersionIncreases(
|
||||||
.addAlias("test2", "aliasToTests")
|
"test2",
|
||||||
.addAlias("test2", "foos", termQuery("name", "foo"))
|
() -> assertAcked(admin().indices()
|
||||||
.addAlias("test2", "tests", termQuery("name", "test")));
|
.prepareAliases()
|
||||||
|
.addAlias("test2", "aliasToTest2")
|
||||||
|
.addAlias("test2", "aliasToTests")
|
||||||
|
.addAlias("test2", "foos", termQuery("name", "foo"))
|
||||||
|
.addAlias("test2", "tests", termQuery("name", "test"))));
|
||||||
|
|
||||||
String[] indices = {"test1", "test2"};
|
String[] indices = {"test1", "test2"};
|
||||||
String[] aliases = {"aliasToTest1", "foos", "bars", "tests", "aliasToTest2", "aliasToTests"};
|
String[] aliases = {"aliasToTest1", "foos", "bars", "tests", "aliasToTest2", "aliasToTests"};
|
||||||
|
|
||||||
admin().indices().prepareAliases().removeAlias(indices, aliases).get();
|
assertAliasesVersionIncreases(indices, () -> admin().indices().prepareAliases().removeAlias(indices, aliases).get());
|
||||||
|
|
||||||
AliasesExistResponse response = admin().indices().prepareAliasesExist(aliases).get();
|
AliasesExistResponse response = admin().indices().prepareAliasesExist(aliases).get();
|
||||||
assertThat(response.exists(), equalTo(false));
|
assertThat(response.exists(), equalTo(false));
|
||||||
|
@ -497,10 +559,12 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
logger.info("--> adding [foo] alias to [foo_foo] and [bar_bar]");
|
logger.info("--> adding [foo] alias to [foo_foo] and [bar_bar]");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("foo_foo", "foo"));
|
assertAliasesVersionIncreases("foo_foo", () -> assertAcked(admin().indices().prepareAliases().addAlias("foo_foo", "foo")));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("bar_bar", "foo"));
|
assertAliasesVersionIncreases("bar_bar", () -> assertAcked(admin().indices().prepareAliases().addAlias("bar_bar", "foo")));
|
||||||
|
|
||||||
assertAcked(admin().indices().prepareAliases().addAliasAction(AliasActions.remove().index("foo*").alias("foo")).execute().get());
|
assertAliasesVersionIncreases(
|
||||||
|
"foo_foo",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAliasAction(AliasActions.remove().index("foo*").alias("foo"))));
|
||||||
|
|
||||||
assertTrue(admin().indices().prepareAliasesExist("foo").get().exists());
|
assertTrue(admin().indices().prepareAliasesExist("foo").get().exists());
|
||||||
assertFalse(admin().indices().prepareAliasesExist("foo").setIndices("foo_foo").get().exists());
|
assertFalse(admin().indices().prepareAliasesExist("foo").setIndices("foo_foo").get().exists());
|
||||||
|
@ -518,8 +582,9 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "alias" + i));
|
final String aliasName = "alias" + i;
|
||||||
client().index(indexRequest("alias" + i).type("type1").id("1").source(source("1", "test"), XContentType.JSON)).get();
|
assertAliasesVersionIncreases("test", () -> assertAcked(admin().indices().prepareAliases().addAlias("test", aliasName)));
|
||||||
|
client().index(indexRequest(aliasName).type("type1").id("1").source(source("1", "test"), XContentType.JSON)).get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,8 +598,9 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "alias" + i));
|
final String aliasName = "alias" + i;
|
||||||
client().index(indexRequest("alias" + i).type("type1").id("1").source(source("1", "test"),
|
assertAliasesVersionIncreases("test", () -> assertAcked(admin().indices().prepareAliases().addAlias("test", aliasName)));
|
||||||
|
client().index(indexRequest(aliasName).type("type1").id("1").source(source("1", "test"),
|
||||||
XContentType.JSON)).get();
|
XContentType.JSON)).get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -553,7 +619,9 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
executor.submit(new Runnable() {
|
executor.submit(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", aliasName));
|
assertAliasesVersionIncreases(
|
||||||
|
"test",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test", aliasName)));
|
||||||
client().index(indexRequest(aliasName).type("type1").id("1").source(source("1", "test"), XContentType.JSON))
|
client().index(indexRequest(aliasName).type("type1").id("1").source(source("1", "test"), XContentType.JSON))
|
||||||
.actionGet();
|
.actionGet();
|
||||||
}
|
}
|
||||||
|
@ -573,27 +641,37 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
logger.info("--> creating alias1 ");
|
logger.info("--> creating alias1 ");
|
||||||
assertAcked((admin().indices().prepareAliases().addAlias("test", "alias1")));
|
assertAliasesVersionIncreases("test", () -> assertAcked((admin().indices().prepareAliases().addAlias("test", "alias1"))));
|
||||||
TimeValue timeout = TimeValue.timeValueSeconds(2);
|
TimeValue timeout = TimeValue.timeValueSeconds(2);
|
||||||
logger.info("--> recreating alias1 ");
|
logger.info("--> recreating alias1 ");
|
||||||
StopWatch stopWatch = new StopWatch();
|
StopWatch stopWatch = new StopWatch();
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
assertAcked((admin().indices().prepareAliases().addAlias("test", "alias1").setTimeout(timeout)));
|
assertAliasesVersionUnchanged(
|
||||||
|
"test",
|
||||||
|
() -> assertAcked((admin().indices().prepareAliases().addAlias("test", "alias1").setTimeout(timeout))));
|
||||||
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
|
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
|
||||||
|
|
||||||
logger.info("--> modifying alias1 to have a filter");
|
logger.info("--> modifying alias1 to have a filter");
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
assertAcked((admin().indices().prepareAliases().addAlias("test", "alias1", termQuery("name", "foo")).setTimeout(timeout)));
|
final TermQueryBuilder fooFilter = termQuery("name", "foo");
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1", fooFilter).setTimeout(timeout)));
|
||||||
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
|
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
|
||||||
|
|
||||||
logger.info("--> recreating alias1 with the same filter");
|
logger.info("--> recreating alias1 with the same filter");
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
assertAcked((admin().indices().prepareAliases().addAlias("test", "alias1", termQuery("name", "foo")).setTimeout(timeout)));
|
assertAliasesVersionUnchanged(
|
||||||
|
"test",
|
||||||
|
() -> assertAcked((admin().indices().prepareAliases().addAlias("test", "alias1", fooFilter).setTimeout(timeout))));
|
||||||
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
|
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
|
||||||
|
|
||||||
logger.info("--> recreating alias1 with a different filter");
|
logger.info("--> recreating alias1 with a different filter");
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
assertAcked((admin().indices().prepareAliases().addAlias("test", "alias1", termQuery("name", "bar")).setTimeout(timeout)));
|
final TermQueryBuilder barFilter = termQuery("name", "bar");
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test",
|
||||||
|
() -> assertAcked((admin().indices().prepareAliases().addAlias("test", "alias1", barFilter).setTimeout(timeout))));
|
||||||
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
|
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
|
||||||
|
|
||||||
logger.info("--> verify that filter was updated");
|
logger.info("--> verify that filter was updated");
|
||||||
|
@ -603,10 +681,10 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
|
|
||||||
logger.info("--> deleting alias1");
|
logger.info("--> deleting alias1");
|
||||||
stopWatch.start();
|
stopWatch.start();
|
||||||
assertAcked((admin().indices().prepareAliases().removeAlias("test", "alias1").setTimeout(timeout)));
|
assertAliasesVersionIncreases(
|
||||||
|
"test",
|
||||||
|
() -> assertAcked((admin().indices().prepareAliases().removeAlias("test", "alias1").setTimeout(timeout))));
|
||||||
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
|
assertThat(stopWatch.stop().lastTaskTime().millis(), lessThan(timeout.millis()));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIndicesRemoveNonExistingAliasResponds404() throws Exception {
|
public void testIndicesRemoveNonExistingAliasResponds404() throws Exception {
|
||||||
|
@ -635,7 +713,9 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
|
|
||||||
logger.info("--> creating aliases [alias1, alias2]");
|
logger.info("--> creating aliases [alias1, alias2]");
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("foobar", "alias1").addAlias("foobar", "alias2"));
|
assertAliasesVersionIncreases(
|
||||||
|
"foobar",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("foobar", "alias1").addAlias("foobar", "alias2")));
|
||||||
|
|
||||||
logger.info("--> getting alias1");
|
logger.info("--> getting alias1");
|
||||||
GetAliasesResponse getResponse = admin().indices().prepareGetAliases("alias1").get();
|
GetAliasesResponse getResponse = admin().indices().prepareGetAliases("alias1").get();
|
||||||
|
@ -670,13 +750,19 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
|
|
||||||
|
|
||||||
logger.info("--> creating aliases [bar, baz, foo]");
|
logger.info("--> creating aliases [bar, baz, foo]");
|
||||||
assertAcked(admin().indices().prepareAliases()
|
assertAliasesVersionIncreases(
|
||||||
.addAlias("bazbar", "bar")
|
new String[]{"bazbar", "foobar"},
|
||||||
.addAlias("bazbar", "bac", termQuery("field", "value"))
|
() -> assertAcked(admin().indices()
|
||||||
.addAlias("foobar", "foo"));
|
.prepareAliases()
|
||||||
|
.addAlias("bazbar", "bar")
|
||||||
|
.addAlias("bazbar", "bac", termQuery("field", "value"))
|
||||||
|
.addAlias("foobar", "foo")));
|
||||||
|
|
||||||
assertAcked(admin().indices().prepareAliases()
|
assertAliasesVersionIncreases(
|
||||||
.addAliasAction(AliasActions.add().index("foobar").alias("bac").routing("bla")));
|
"foobar",
|
||||||
|
() -> assertAcked(admin().indices()
|
||||||
|
.prepareAliases()
|
||||||
|
.addAliasAction(AliasActions.add().index("foobar").alias("bac").routing("bla"))));
|
||||||
|
|
||||||
logger.info("--> getting bar and baz for index bazbar");
|
logger.info("--> getting bar and baz for index bazbar");
|
||||||
getResponse = admin().indices().prepareGetAliases("bar", "bac").addIndices("bazbar").get();
|
getResponse = admin().indices().prepareGetAliases("bar", "bac").addIndices("bazbar").get();
|
||||||
|
@ -826,7 +912,9 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
createIndex("index1");
|
createIndex("index1");
|
||||||
createIndex("index2");
|
createIndex("index2");
|
||||||
|
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("index1", "alias1").addAlias("index2", "alias2"));
|
assertAliasesVersionIncreases(
|
||||||
|
new String[]{"index1", "index2"},
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("index1", "alias1").addAlias("index2", "alias2")));
|
||||||
|
|
||||||
GetAliasesResponse response = admin().indices().prepareGetAliases().get();
|
GetAliasesResponse response = admin().indices().prepareGetAliases().get();
|
||||||
assertThat(response.getAliases(), hasKey("index1"));
|
assertThat(response.getAliases(), hasKey("index1"));
|
||||||
|
@ -911,23 +999,41 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
// fields mentioned in filters don't need to exist in the mapping.
|
// fields mentioned in filters don't need to exist in the mapping.
|
||||||
public void testAddAliasWithFilterNoMapping() throws Exception {
|
public void testAddAliasWithFilterNoMapping() throws Exception {
|
||||||
assertAcked(prepareCreate("test"));
|
assertAcked(prepareCreate("test"));
|
||||||
client().admin().indices().prepareAliases()
|
assertAliasesVersionIncreases(
|
||||||
.addAlias("test", "a", QueryBuilders.termQuery("field1", "term"))
|
"test",
|
||||||
.get();
|
() -> client().admin()
|
||||||
client().admin().indices().prepareAliases()
|
.indices()
|
||||||
.addAlias("test", "a", QueryBuilders.rangeQuery("field2").from(0).to(1))
|
.prepareAliases()
|
||||||
.get();
|
.addAlias("test", "a", QueryBuilders.termQuery("field1", "term"))
|
||||||
client().admin().indices().prepareAliases()
|
.get());
|
||||||
.addAlias("test", "a", QueryBuilders.matchAllQuery())
|
assertAliasesVersionIncreases(
|
||||||
.get();
|
"test",
|
||||||
|
() -> client().admin()
|
||||||
|
.indices()
|
||||||
|
.prepareAliases()
|
||||||
|
.addAlias("test", "a", QueryBuilders.rangeQuery("field2").from(0).to(1))
|
||||||
|
.get());
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"test",
|
||||||
|
() -> client().admin()
|
||||||
|
.indices()
|
||||||
|
.prepareAliases()
|
||||||
|
.addAlias("test", "a", QueryBuilders.matchAllQuery())
|
||||||
|
.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAliasFilterWithNowInRangeFilterAndQuery() throws Exception {
|
public void testAliasFilterWithNowInRangeFilterAndQuery() throws Exception {
|
||||||
assertAcked(prepareCreate("my-index").addMapping("my-type", "timestamp", "type=date"));
|
assertAcked(prepareCreate("my-index").addMapping("my-type", "timestamp", "type=date"));
|
||||||
assertAcked(admin().indices().prepareAliases()
|
assertAliasesVersionIncreases(
|
||||||
.addAlias("my-index", "filter1", rangeQuery("timestamp").from("2016-12-01").to("2016-12-31")));
|
"my-index",
|
||||||
assertAcked(admin().indices().prepareAliases()
|
() -> assertAcked(admin().indices()
|
||||||
.addAlias("my-index", "filter2", rangeQuery("timestamp").from("2016-01-01").to("2016-12-31")));
|
.prepareAliases()
|
||||||
|
.addAlias("my-index", "filter1", rangeQuery("timestamp").from("2016-12-01").to("2016-12-31"))));
|
||||||
|
assertAliasesVersionIncreases(
|
||||||
|
"my-index",
|
||||||
|
() -> assertAcked(admin().indices()
|
||||||
|
.prepareAliases()
|
||||||
|
.addAlias("my-index", "filter2", rangeQuery("timestamp").from("2016-01-01").to("2016-12-31"))));
|
||||||
|
|
||||||
final int numDocs = scaledRandomIntBetween(5, 52);
|
final int numDocs = scaledRandomIntBetween(5, 52);
|
||||||
for (int i = 1; i <= numDocs; i++) {
|
for (int i = 1; i <= numDocs; i++) {
|
||||||
|
@ -951,8 +1057,10 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
try {
|
try {
|
||||||
enableIndexBlock("test", block);
|
enableIndexBlock("test", block);
|
||||||
|
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1").addAlias("test", "alias2"));
|
assertAliasesVersionIncreases(
|
||||||
assertAcked(admin().indices().prepareAliases().removeAlias("test", "alias1"));
|
"test",
|
||||||
|
() -> assertAcked(admin().indices().prepareAliases().addAlias("test", "alias1").addAlias("test", "alias2")));
|
||||||
|
assertAliasesVersionIncreases("test", () -> assertAcked(admin().indices().prepareAliases().removeAlias("test", "alias1")));
|
||||||
assertThat(admin().indices().prepareGetAliases("alias2").execute().actionGet().getAliases().get("test").size(), equalTo(1));
|
assertThat(admin().indices().prepareGetAliases("alias2").execute().actionGet().getAliases().get("test").size(), equalTo(1));
|
||||||
assertThat(admin().indices().prepareAliasesExist("alias2").get().exists(), equalTo(true));
|
assertThat(admin().indices().prepareAliasesExist("alias2").get().exists(), equalTo(true));
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -963,8 +1071,12 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
try {
|
try {
|
||||||
enableIndexBlock("test", SETTING_READ_ONLY);
|
enableIndexBlock("test", SETTING_READ_ONLY);
|
||||||
|
|
||||||
assertBlocked(admin().indices().prepareAliases().addAlias("test", "alias3"), INDEX_READ_ONLY_BLOCK);
|
assertAliasesVersionUnchanged(
|
||||||
assertBlocked(admin().indices().prepareAliases().removeAlias("test", "alias2"), INDEX_READ_ONLY_BLOCK);
|
"test",
|
||||||
|
() -> assertBlocked(admin().indices().prepareAliases().addAlias("test", "alias3"), INDEX_READ_ONLY_BLOCK));
|
||||||
|
assertAliasesVersionUnchanged(
|
||||||
|
"test",
|
||||||
|
() -> assertBlocked(admin().indices().prepareAliases().removeAlias("test", "alias2"), INDEX_READ_ONLY_BLOCK));
|
||||||
assertThat(admin().indices().prepareGetAliases("alias2").execute().actionGet().getAliases().get("test").size(), equalTo(1));
|
assertThat(admin().indices().prepareGetAliases("alias2").execute().actionGet().getAliases().get("test").size(), equalTo(1));
|
||||||
assertThat(admin().indices().prepareAliasesExist("alias2").get().exists(), equalTo(true));
|
assertThat(admin().indices().prepareAliasesExist("alias2").get().exists(), equalTo(true));
|
||||||
|
|
||||||
|
@ -975,8 +1087,12 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
try {
|
try {
|
||||||
enableIndexBlock("test", SETTING_BLOCKS_METADATA);
|
enableIndexBlock("test", SETTING_BLOCKS_METADATA);
|
||||||
|
|
||||||
assertBlocked(admin().indices().prepareAliases().addAlias("test", "alias3"), INDEX_METADATA_BLOCK);
|
assertAliasesVersionUnchanged(
|
||||||
assertBlocked(admin().indices().prepareAliases().removeAlias("test", "alias2"), INDEX_METADATA_BLOCK);
|
"test",
|
||||||
|
() -> assertBlocked(admin().indices().prepareAliases().addAlias("test", "alias3"), INDEX_METADATA_BLOCK));
|
||||||
|
assertAliasesVersionUnchanged(
|
||||||
|
"test",
|
||||||
|
() -> assertBlocked(admin().indices().prepareAliases().removeAlias("test", "alias2"), INDEX_METADATA_BLOCK));
|
||||||
assertBlocked(admin().indices().prepareGetAliases("alias2"), INDEX_METADATA_BLOCK);
|
assertBlocked(admin().indices().prepareGetAliases("alias2"), INDEX_METADATA_BLOCK);
|
||||||
assertBlocked(admin().indices().prepareAliasesExist("alias2"), INDEX_METADATA_BLOCK);
|
assertBlocked(admin().indices().prepareAliasesExist("alias2"), INDEX_METADATA_BLOCK);
|
||||||
|
|
||||||
|
@ -988,15 +1104,19 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
public void testAliasActionRemoveIndex() throws InterruptedException, ExecutionException {
|
public void testAliasActionRemoveIndex() throws InterruptedException, ExecutionException {
|
||||||
assertAcked(prepareCreate("foo_foo"));
|
assertAcked(prepareCreate("foo_foo"));
|
||||||
assertAcked(prepareCreate("bar_bar"));
|
assertAcked(prepareCreate("bar_bar"));
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("foo_foo", "foo"));
|
assertAliasesVersionIncreases(
|
||||||
assertAcked(admin().indices().prepareAliases().addAlias("bar_bar", "foo"));
|
new String[]{"foo_foo", "bar_bar"},
|
||||||
|
() -> {
|
||||||
|
assertAcked(admin().indices().prepareAliases().addAlias("foo_foo", "foo"));
|
||||||
|
assertAcked(admin().indices().prepareAliases().addAlias("bar_bar", "foo"));
|
||||||
|
});
|
||||||
|
|
||||||
IllegalArgumentException iae = expectThrows(IllegalArgumentException.class,
|
IllegalArgumentException iae = expectThrows(IllegalArgumentException.class,
|
||||||
() -> client().admin().indices().prepareAliases().removeIndex("foo").execute().actionGet());
|
() -> client().admin().indices().prepareAliases().removeIndex("foo").execute().actionGet());
|
||||||
assertEquals("The provided expression [foo] matches an alias, specify the corresponding concrete indices instead.",
|
assertEquals("The provided expression [foo] matches an alias, specify the corresponding concrete indices instead.",
|
||||||
iae.getMessage());
|
iae.getMessage());
|
||||||
|
|
||||||
assertAcked(client().admin().indices().prepareAliases().removeIndex("foo*").execute().get());
|
assertAcked(client().admin().indices().prepareAliases().removeIndex("foo*"));
|
||||||
assertFalse(client().admin().indices().prepareExists("foo_foo").execute().actionGet().isExists());
|
assertFalse(client().admin().indices().prepareExists("foo_foo").execute().actionGet().isExists());
|
||||||
assertTrue(admin().indices().prepareAliasesExist("foo").get().exists());
|
assertTrue(admin().indices().prepareAliasesExist("foo").get().exists());
|
||||||
assertTrue(client().admin().indices().prepareExists("bar_bar").execute().actionGet().isExists());
|
assertTrue(client().admin().indices().prepareExists("bar_bar").execute().actionGet().isExists());
|
||||||
|
@ -1010,7 +1130,9 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
public void testRemoveIndexAndReplaceWithAlias() throws InterruptedException, ExecutionException {
|
public void testRemoveIndexAndReplaceWithAlias() throws InterruptedException, ExecutionException {
|
||||||
assertAcked(client().admin().indices().prepareCreate("test"));
|
assertAcked(client().admin().indices().prepareCreate("test"));
|
||||||
indexRandom(true, client().prepareIndex("test_2", "test", "test").setSource("test", "test"));
|
indexRandom(true, client().prepareIndex("test_2", "test", "test").setSource("test", "test"));
|
||||||
assertAcked(client().admin().indices().prepareAliases().addAlias("test_2", "test").removeIndex("test"));
|
assertAliasesVersionIncreases(
|
||||||
|
"test_2",
|
||||||
|
() -> assertAcked(client().admin().indices().prepareAliases().addAlias("test_2", "test").removeIndex("test")));
|
||||||
assertHitCount(client().prepareSearch("test").get(), 1);
|
assertHitCount(client().prepareSearch("test").get(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1052,4 +1174,31 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
private String source(String id, String nameValue) {
|
private String source(String id, String nameValue) {
|
||||||
return "{ \"id\" : \"" + id + "\", \"name\" : \"" + nameValue + "\" }";
|
return "{ \"id\" : \"" + id + "\", \"name\" : \"" + nameValue + "\" }";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void assertAliasesVersionIncreases(final String index, final Runnable runnable) {
|
||||||
|
assertAliasesVersionIncreases(new String[]{index}, runnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertAliasesVersionIncreases(final String[] indices, final Runnable runnable) {
|
||||||
|
final Map<String, Long> beforeAliasesVersions = new HashMap<>(indices.length);
|
||||||
|
final MetaData beforeMetaData = admin().cluster().prepareState().get().getState().metaData();
|
||||||
|
for (final String index : indices) {
|
||||||
|
beforeAliasesVersions.put(index, beforeMetaData.index(index).getAliasesVersion());
|
||||||
|
}
|
||||||
|
runnable.run();
|
||||||
|
final MetaData afterMetaData = admin().cluster().prepareState().get().getState().metaData();
|
||||||
|
for (final String index : indices) {
|
||||||
|
assertThat(afterMetaData.index(index).getAliasesVersion(), equalTo(1 + beforeAliasesVersions.get(index)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertAliasesVersionUnchanged(final String index, final Runnable runnable) {
|
||||||
|
final long beforeAliasesVersion =
|
||||||
|
admin().cluster().prepareState().get().getState().metaData().index(index).getAliasesVersion();
|
||||||
|
runnable.run();
|
||||||
|
final long afterAliasesVersion =
|
||||||
|
admin().cluster().prepareState().get().getState().metaData().index(index).getAliasesVersion();
|
||||||
|
assertThat(afterAliasesVersion, equalTo(beforeAliasesVersion));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,19 @@ import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.cluster.ClusterName;
|
import org.elasticsearch.cluster.ClusterName;
|
||||||
import org.elasticsearch.cluster.ClusterState;
|
import org.elasticsearch.cluster.ClusterState;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
import org.elasticsearch.common.util.set.Sets;
|
||||||
import org.elasticsearch.index.Index;
|
import org.elasticsearch.index.Index;
|
||||||
import org.elasticsearch.index.IndexNotFoundException;
|
import org.elasticsearch.index.IndexNotFoundException;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.test.VersionUtils;
|
import org.elasticsearch.test.VersionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
import static org.hamcrest.Matchers.contains;
|
import static org.hamcrest.Matchers.contains;
|
||||||
|
@ -74,6 +78,7 @@ public class MetaDataIndexAliasesServiceTests extends ESTestCase {
|
||||||
assertNotNull(alias);
|
assertNotNull(alias);
|
||||||
assertTrue(alias.isAlias());
|
assertTrue(alias.isAlias());
|
||||||
assertThat(alias.getIndices(), contains(after.metaData().index(index)));
|
assertThat(alias.getIndices(), contains(after.metaData().index(index)));
|
||||||
|
assertAliasesVersionIncreased(index, before, after);
|
||||||
|
|
||||||
// Remove the alias from it while adding another one
|
// Remove the alias from it while adding another one
|
||||||
before = after;
|
before = after;
|
||||||
|
@ -85,12 +90,102 @@ public class MetaDataIndexAliasesServiceTests extends ESTestCase {
|
||||||
assertNotNull(alias);
|
assertNotNull(alias);
|
||||||
assertTrue(alias.isAlias());
|
assertTrue(alias.isAlias());
|
||||||
assertThat(alias.getIndices(), contains(after.metaData().index(index)));
|
assertThat(alias.getIndices(), contains(after.metaData().index(index)));
|
||||||
|
assertAliasesVersionIncreased(index, before, after);
|
||||||
|
|
||||||
// Now just remove on its own
|
// Now just remove on its own
|
||||||
before = after;
|
before = after;
|
||||||
after = service.innerExecute(before, singletonList(new AliasAction.Remove(index, "test_2")));
|
after = service.innerExecute(before, singletonList(new AliasAction.Remove(index, "test_2")));
|
||||||
assertNull(after.metaData().getAliasAndIndexLookup().get("test"));
|
assertNull(after.metaData().getAliasAndIndexLookup().get("test"));
|
||||||
assertNull(after.metaData().getAliasAndIndexLookup().get("test_2"));
|
assertNull(after.metaData().getAliasAndIndexLookup().get("test_2"));
|
||||||
|
assertAliasesVersionIncreased(index, before, after);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMultipleIndices() {
|
||||||
|
final int length = randomIntBetween(2, 8);
|
||||||
|
final Set<String> indices = new HashSet<>(length);
|
||||||
|
ClusterState before = ClusterState.builder(ClusterName.DEFAULT).build();
|
||||||
|
final List<AliasAction> addActions = new ArrayList<>(length);
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
final String index = randomValueOtherThanMany(v -> indices.add(v) == false, () -> randomAlphaOfLength(8));
|
||||||
|
before = createIndex(before, index);
|
||||||
|
addActions.add(new AliasAction.Add(index, "alias-" + index, null, null, null, null));
|
||||||
|
}
|
||||||
|
final ClusterState afterAddingAliasesToAll = service.innerExecute(before, addActions);
|
||||||
|
assertAliasesVersionIncreased(indices.toArray(new String[0]), before, afterAddingAliasesToAll);
|
||||||
|
|
||||||
|
// now add some aliases randomly
|
||||||
|
final Set<String> randomIndices = new HashSet<>(length);
|
||||||
|
final List<AliasAction> randomAddActions = new ArrayList<>(length);
|
||||||
|
for (String index : indices) {
|
||||||
|
if (randomBoolean()) {
|
||||||
|
randomAddActions.add(new AliasAction.Add(index, "random-alias-" + index, null, null, null, null));
|
||||||
|
randomIndices.add(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final ClusterState afterAddingRandomAliases = service.innerExecute(afterAddingAliasesToAll, randomAddActions);
|
||||||
|
assertAliasesVersionIncreased(randomIndices.toArray(new String[0]), afterAddingAliasesToAll, afterAddingRandomAliases);
|
||||||
|
assertAliasesVersionUnchanged(
|
||||||
|
Sets.difference(indices, randomIndices).toArray(new String[0]),
|
||||||
|
afterAddingAliasesToAll,
|
||||||
|
afterAddingRandomAliases);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testChangingWriteAliasStateIncreasesAliasesVersion() {
|
||||||
|
final String index = randomAlphaOfLength(8);
|
||||||
|
final ClusterState before = createIndex(ClusterState.builder(ClusterName.DEFAULT).build(), index);
|
||||||
|
|
||||||
|
final ClusterState afterAddWriteAlias =
|
||||||
|
service.innerExecute(before, singletonList(new AliasAction.Add(index, "test", null, null, null, true)));
|
||||||
|
assertAliasesVersionIncreased(index, before, afterAddWriteAlias);
|
||||||
|
|
||||||
|
final ClusterState afterChangeWriteAliasToNonWriteAlias =
|
||||||
|
service.innerExecute(afterAddWriteAlias, singletonList(new AliasAction.Add(index, "test", null, null, null, false)));
|
||||||
|
assertAliasesVersionIncreased(index, afterAddWriteAlias, afterChangeWriteAliasToNonWriteAlias);
|
||||||
|
|
||||||
|
final ClusterState afterChangeNonWriteAliasToWriteAlias =
|
||||||
|
service.innerExecute(
|
||||||
|
afterChangeWriteAliasToNonWriteAlias,
|
||||||
|
singletonList(new AliasAction.Add(index, "test", null, null, null, true)));
|
||||||
|
assertAliasesVersionIncreased(index, afterChangeWriteAliasToNonWriteAlias, afterChangeNonWriteAliasToWriteAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAddingAliasMoreThanOnceShouldOnlyIncreaseAliasesVersionByOne() {
|
||||||
|
final String index = randomAlphaOfLength(8);
|
||||||
|
final ClusterState before = createIndex(ClusterState.builder(ClusterName.DEFAULT).build(), index);
|
||||||
|
|
||||||
|
// add an alias to the index multiple times
|
||||||
|
final int length = randomIntBetween(2, 8);
|
||||||
|
final List<AliasAction> addActions = new ArrayList<>(length);
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
addActions.add(new AliasAction.Add(index, "test", null, null, null, null));
|
||||||
|
}
|
||||||
|
final ClusterState afterAddingAliases = service.innerExecute(before, addActions);
|
||||||
|
|
||||||
|
assertAliasesVersionIncreased(index, before, afterAddingAliases);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAliasesVersionUnchangedWhenActionsAreIdempotent() {
|
||||||
|
final String index = randomAlphaOfLength(8);
|
||||||
|
final ClusterState before = createIndex(ClusterState.builder(ClusterName.DEFAULT).build(), index);
|
||||||
|
|
||||||
|
// add some aliases to the index
|
||||||
|
final int length = randomIntBetween(1, 8);
|
||||||
|
final Set<String> aliasNames = new HashSet<>();
|
||||||
|
final List<AliasAction> addActions = new ArrayList<>(length);
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
final String aliasName = randomValueOtherThanMany(v -> aliasNames.add(v) == false, () -> randomAlphaOfLength(8));
|
||||||
|
addActions.add(new AliasAction.Add(index, aliasName, null, null, null, null));
|
||||||
|
}
|
||||||
|
final ClusterState afterAddingAlias = service.innerExecute(before, addActions);
|
||||||
|
|
||||||
|
// now perform a remove and add for each alias which is idempotent, the resulting aliases are unchanged
|
||||||
|
final List<AliasAction> removeAndAddActions = new ArrayList<>(2 * length);
|
||||||
|
for (final String aliasName : aliasNames) {
|
||||||
|
removeAndAddActions.add(new AliasAction.Remove(index, aliasName));
|
||||||
|
removeAndAddActions.add(new AliasAction.Add(index, aliasName, null, null, null, null));
|
||||||
|
}
|
||||||
|
final ClusterState afterRemoveAndAddAlias = service.innerExecute(afterAddingAlias, removeAndAddActions);
|
||||||
|
assertAliasesVersionUnchanged(index, afterAddingAlias, afterRemoveAndAddAlias);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSwapIndexWithAlias() {
|
public void testSwapIndexWithAlias() {
|
||||||
|
@ -106,6 +201,7 @@ public class MetaDataIndexAliasesServiceTests extends ESTestCase {
|
||||||
assertNotNull(alias);
|
assertNotNull(alias);
|
||||||
assertTrue(alias.isAlias());
|
assertTrue(alias.isAlias());
|
||||||
assertThat(alias.getIndices(), contains(after.metaData().index("test_2")));
|
assertThat(alias.getIndices(), contains(after.metaData().index("test_2")));
|
||||||
|
assertAliasesVersionIncreased("test_2", before, after);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAddAliasToRemovedIndex() {
|
public void testAddAliasToRemovedIndex() {
|
||||||
|
@ -137,18 +233,21 @@ public class MetaDataIndexAliasesServiceTests extends ESTestCase {
|
||||||
new AliasAction.Add("test", "alias", null, null, null, false)));
|
new AliasAction.Add("test", "alias", null, null, null, false)));
|
||||||
assertFalse(after.metaData().index("test").getAliases().get("alias").writeIndex());
|
assertFalse(after.metaData().index("test").getAliases().get("alias").writeIndex());
|
||||||
assertNull(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex());
|
assertNull(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex());
|
||||||
|
assertAliasesVersionIncreased("test", before, after);
|
||||||
|
|
||||||
after = service.innerExecute(before, Arrays.asList(
|
after = service.innerExecute(before, Arrays.asList(
|
||||||
new AliasAction.Add("test", "alias", null, null, null, null)));
|
new AliasAction.Add("test", "alias", null, null, null, null)));
|
||||||
assertNull(after.metaData().index("test").getAliases().get("alias").writeIndex());
|
assertNull(after.metaData().index("test").getAliases().get("alias").writeIndex());
|
||||||
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
||||||
equalTo(after.metaData().index("test")));
|
equalTo(after.metaData().index("test")));
|
||||||
|
assertAliasesVersionIncreased("test", before, after);
|
||||||
|
|
||||||
after = service.innerExecute(before, Arrays.asList(
|
after = service.innerExecute(before, Arrays.asList(
|
||||||
new AliasAction.Add("test", "alias", null, null, null, true)));
|
new AliasAction.Add("test", "alias", null, null, null, true)));
|
||||||
assertTrue(after.metaData().index("test").getAliases().get("alias").writeIndex());
|
assertTrue(after.metaData().index("test").getAliases().get("alias").writeIndex());
|
||||||
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
||||||
equalTo(after.metaData().index("test")));
|
equalTo(after.metaData().index("test")));
|
||||||
|
assertAliasesVersionIncreased("test", before, after);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAddWriteOnlyWithExistingWriteIndex() {
|
public void testAddWriteOnlyWithExistingWriteIndex() {
|
||||||
|
@ -165,6 +264,8 @@ public class MetaDataIndexAliasesServiceTests extends ESTestCase {
|
||||||
assertNull(after.metaData().index("test").getAliases().get("alias").writeIndex());
|
assertNull(after.metaData().index("test").getAliases().get("alias").writeIndex());
|
||||||
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
||||||
equalTo(after.metaData().index("test2")));
|
equalTo(after.metaData().index("test2")));
|
||||||
|
assertAliasesVersionIncreased("test", before, after);
|
||||||
|
assertAliasesVersionUnchanged("test2", before, after);
|
||||||
|
|
||||||
Exception exception = expectThrows(IllegalStateException.class, () -> service.innerExecute(before, Arrays.asList(
|
Exception exception = expectThrows(IllegalStateException.class, () -> service.innerExecute(before, Arrays.asList(
|
||||||
new AliasAction.Add("test", "alias", null, null, null, true))));
|
new AliasAction.Add("test", "alias", null, null, null, true))));
|
||||||
|
@ -191,6 +292,8 @@ public class MetaDataIndexAliasesServiceTests extends ESTestCase {
|
||||||
assertTrue(after.metaData().index("test2").getAliases().get("alias").writeIndex());
|
assertTrue(after.metaData().index("test2").getAliases().get("alias").writeIndex());
|
||||||
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
||||||
equalTo(after.metaData().index("test2")));
|
equalTo(after.metaData().index("test2")));
|
||||||
|
assertAliasesVersionIncreased("test", before, after);
|
||||||
|
assertAliasesVersionIncreased("test2", before, after);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAddWriteOnlyWithExistingNonWriteIndices() {
|
public void testAddWriteOnlyWithExistingNonWriteIndices() {
|
||||||
|
@ -212,7 +315,9 @@ public class MetaDataIndexAliasesServiceTests extends ESTestCase {
|
||||||
assertTrue(after.metaData().index("test3").getAliases().get("alias").writeIndex());
|
assertTrue(after.metaData().index("test3").getAliases().get("alias").writeIndex());
|
||||||
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
||||||
equalTo(after.metaData().index("test3")));
|
equalTo(after.metaData().index("test3")));
|
||||||
|
assertAliasesVersionUnchanged("test", before, after);
|
||||||
|
assertAliasesVersionUnchanged("test2", before, after);
|
||||||
|
assertAliasesVersionIncreased("test3", before, after);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAddWriteOnlyWithIndexRemoved() {
|
public void testAddWriteOnlyWithIndexRemoved() {
|
||||||
|
@ -233,6 +338,7 @@ public class MetaDataIndexAliasesServiceTests extends ESTestCase {
|
||||||
assertNull(after.metaData().index("test2").getAliases().get("alias").writeIndex());
|
assertNull(after.metaData().index("test2").getAliases().get("alias").writeIndex());
|
||||||
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
assertThat(((AliasOrIndex.Alias) after.metaData().getAliasAndIndexLookup().get("alias")).getWriteIndex(),
|
||||||
equalTo(after.metaData().index("test2")));
|
equalTo(after.metaData().index("test2")));
|
||||||
|
assertAliasesVersionUnchanged("test2", before, after);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAddWriteOnlyValidatesAgainstMetaDataBuilder() {
|
public void testAddWriteOnlyValidatesAgainstMetaDataBuilder() {
|
||||||
|
@ -260,4 +366,29 @@ public class MetaDataIndexAliasesServiceTests extends ESTestCase {
|
||||||
.metaData(MetaData.builder(state.metaData()).put(indexMetaData, false))
|
.metaData(MetaData.builder(state.metaData()).put(indexMetaData, false))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void assertAliasesVersionUnchanged(final String index, final ClusterState before, final ClusterState after) {
|
||||||
|
assertAliasesVersionUnchanged(new String[]{index}, before, after);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertAliasesVersionUnchanged(final String[] indices, final ClusterState before, final ClusterState after) {
|
||||||
|
for (final String index : indices) {
|
||||||
|
final long expected = before.metaData().index(index).getAliasesVersion();
|
||||||
|
final long actual = after.metaData().index(index).getAliasesVersion();
|
||||||
|
assertThat("index metadata aliases version mismatch", actual, equalTo(expected));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertAliasesVersionIncreased(final String index, final ClusterState before, final ClusterState after) {
|
||||||
|
assertAliasesVersionIncreased(new String[]{index}, before, after);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertAliasesVersionIncreased(final String[] indices, final ClusterState before, final ClusterState after) {
|
||||||
|
for (final String index : indices) {
|
||||||
|
final long expected = 1 + before.metaData().index(index).getAliasesVersion();
|
||||||
|
final long actual = after.metaData().index(index).getAliasesVersion();
|
||||||
|
assertThat("index metadata aliases version mismatch", actual, equalTo(expected));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue