Skip to content

Propagate mapping.single_type setting on shrinked index #29202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,17 @@ public void testShrinkAfterUpgrade() throws IOException {
if (runningAgainstOldCluster) {
XContentBuilder mappingsAndSettings = jsonBuilder();
mappingsAndSettings.startObject();
if (oldClusterVersion.major == 5 && randomBoolean()) {
{
// test that mapping.single_type is correctly propagated on the shrinked index,
// if not, search will fail.
mappingsAndSettings.startObject("settings");
mappingsAndSettings.startObject("mapping");
mappingsAndSettings.field("single_type", true);
mappingsAndSettings.endObject();
mappingsAndSettings.endObject();
}
}
{
mappingsAndSettings.startObject("mappings");
mappingsAndSettings.startObject("doc");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,9 @@ static void prepareResizeIndexSettings(ClusterState currentState, Set<String> ma
}

final Predicate<String> sourceSettingsPredicate = (s) -> s.startsWith("index.similarity.")
|| s.startsWith("index.analysis.") || s.startsWith("index.sort.");
|| s.startsWith("index.analysis.") || s.startsWith("index.sort.") || s.equals("index.mapping.single_type");
indexSettingsBuilder
// now copy all similarity / analysis / sort settings - this overrides all settings from the user unless they
// now copy all similarity / analysis / sort / single_type settings - this overrides all settings from the user unless they
// wanna add extra settings
.put(IndexMetaData.SETTING_VERSION_CREATED, sourceMetaData.getCreationVersion())
.put(IndexMetaData.SETTING_VERSION_UPGRADED, sourceMetaData.getUpgradedVersion())
Expand Down