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
2 changes: 1 addition & 1 deletion docs/reference/index-modules.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ preview:[]

The number of shards a custom <<mapping-routing-field,routing>> value can go to.
Defaults to 1 and can only be set at index creation time. This value must be less
than the `index.number_of_shards` unless the `index.number_of_shards` value is also 1.
than the `index.number_of_routing_shards` unless the `index.number_of_routing_shards` value is also 1.
See <<routing-index-partition>> for more details about how this setting is used.

[[ccr-index-soft-deletes]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ public void testPartitionedTemplate() throws Exception {
);
assertThat(
eBadSettings.getMessage(),
containsString("partition size [6] should be a positive number less than the number of shards [5]")
containsString("partition size [6] should be a positive number less than the number of routing shards [5]")
);

// provide an invalid mapping for a partitioned index
Expand Down Expand Up @@ -913,7 +913,7 @@ public void testPartitionedTemplate() throws Exception {

assertThat(
eBadIndex.getMessage(),
containsString("partition size [6] should be a positive number less than the number of shards [5]")
containsString("partition size [6] should be a positive number less than the number of routing shards [5]")
);

// finally, create a valid index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2268,7 +2268,7 @@ IndexMetadata build(boolean repair) {
"routing partition size ["
+ routingPartitionSize
+ "] should be a positive number"
+ " less than the number of shards ["
+ " less than the number of routing shards ["
+ getRoutingNumShards()
+ "] for ["
+ index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ boolean newIndexHasSyntheticSourceUsage(
return false;
}

var tmpIndexMetadata = buildIndexMetadataForMapperService(indexName, isTimeSeries, indexTemplateAndCreateRequestSettings);
try (var mapperService = mapperServiceFactory.apply(tmpIndexMetadata)) {
// combinedTemplateMappings can be null when creating system indices
// combinedTemplateMappings can be empty when creating a normal index that doesn't match any template and without mapping.
if (combinedTemplateMappings == null || combinedTemplateMappings.isEmpty()) {
combinedTemplateMappings = List.of(new CompressedXContent("{}"));
try {
var tmpIndexMetadata = buildIndexMetadataForMapperService(indexName, isTimeSeries, indexTemplateAndCreateRequestSettings);
try (var mapperService = mapperServiceFactory.apply(tmpIndexMetadata)) {
// combinedTemplateMappings can be null when creating system indices
// combinedTemplateMappings can be empty when creating a normal index that doesn't match any template and without mapping.
if (combinedTemplateMappings == null || combinedTemplateMappings.isEmpty()) {
combinedTemplateMappings = List.of(new CompressedXContent("{}"));
}
mapperService.merge(MapperService.SINGLE_MAPPING_NAME, combinedTemplateMappings, MapperService.MergeReason.INDEX_TEMPLATE);
return mapperService.documentMapper().sourceMapper().isSynthetic();
}
mapperService.merge(MapperService.SINGLE_MAPPING_NAME, combinedTemplateMappings, MapperService.MergeReason.INDEX_TEMPLATE);
return mapperService.documentMapper().sourceMapper().isSynthetic();
} catch (AssertionError | Exception e) {
// In case invalid mappings or setting are provided, then mapper service creation can fail.
// In that case it is ok to return false here. The index creation will fail anyway later, so need to fallback to stored source.
Expand Down
Loading