Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog/141539.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
area: Infra/Core
issues: []
pr: 141539
summary: Reindexing older indices with percolator fields clears migration assistant
errors
type: bug
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ private ClusterState applyCreateIndexWithTemporaryService(
temporaryIndexMeta.getRoutingNumShards(),
sourceMetadata,
temporaryIndexMeta.isSystem(),
temporaryIndexMeta.getCustomData()
temporaryIndexMeta.getCustomData(),
currentState.getMinTransportVersion()
);
} catch (Exception e) {
logger.info("failed to build index metadata [{}]", request.index());
Expand Down Expand Up @@ -658,7 +659,6 @@ private IndexMetadata buildAndValidateTemporaryIndexMetadata(
final IndexMetadata.Builder tmpImdBuilder = IndexMetadata.builder(request.index());
tmpImdBuilder.setRoutingNumShards(routingNumShards);
tmpImdBuilder.settings(indexSettings);
tmpImdBuilder.transportVersion(TransportVersion.current());
tmpImdBuilder.system(isSystem);

// Set up everything, now locally create the index to see that things are ok, and apply
Expand Down Expand Up @@ -1524,10 +1524,12 @@ static IndexMetadata buildIndexMetadata(
int routingNumShards,
@Nullable IndexMetadata sourceMetadata,
boolean isSystem,
Map<String, DiffableStringMap> customData
Map<String, DiffableStringMap> customData,
TransportVersion minClusterTransportVersion
) {
IndexMetadata.Builder indexMetadataBuilder = createIndexMetadataBuilder(indexName, sourceMetadata, indexSettings, routingNumShards);
indexMetadataBuilder.system(isSystem);
indexMetadataBuilder.transportVersion(minClusterTransportVersion);
// now, update the mappings with the actual source
Map<String, MappingMetadata> mappingsMetadata = new HashMap<>();
DocumentMapper docMapper = documentMapperSupplier.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.apache.lucene.util.automaton.RegExp;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.ResourceAlreadyExistsException;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.Alias;
import org.elasticsearch.action.admin.indices.create.CreateIndexClusterStateUpdateRequest;
Expand Down Expand Up @@ -1404,14 +1405,16 @@ public void testBuildIndexMetadata() {
4,
sourceIndexMetadata,
false,
Map.of()
Map.of(),
TransportVersion.current()
);

assertThat(indexMetadata.getAliases().size(), is(1));
assertThat(indexMetadata.getAliases().keySet().iterator().next(), is("alias1"));
assertThat("The source index primary term must be used", indexMetadata.primaryTerm(0), is(3L));
assertThat(indexMetadata.getTimestampRange(), equalTo(IndexLongFieldRange.NO_SHARDS));
assertThat(indexMetadata.getEventIngestedRange(), equalTo(IndexLongFieldRange.NO_SHARDS));
assertThat(indexMetadata.getTransportVersion(), equalTo(TransportVersion.current()));
}

public void testGetIndexNumberOfRoutingShardsWithNullSourceIndex() {
Expand Down