Skip to content

Commit

Permalink
Allow dynamic updates for index.hidden setting (elastic#52772)
Browse files Browse the repository at this point in the history
This commit changes the `index.hidden` setting from being final to a
dynamic setting. While the setting being final allows for easier
reasoning about an index, making this setting update-able has more
benefits in that we can upgrade existing indices to be hidden and it
will enable future features that would dynamically make indices hidden.
  • Loading branch information
jaymode committed Feb 26, 2020
1 parent 2d01c00 commit b3b5e51
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public Iterator<Setting<?>> settings() {
* normal wildcard searches unless explicitly allowed
*/
public static final Setting<Boolean> INDEX_HIDDEN_SETTING =
Setting.boolSetting(SETTING_INDEX_HIDDEN, false, Property.IndexScope, Property.Final);
Setting.boolSetting(SETTING_INDEX_HIDDEN, false, Property.Dynamic, Property.IndexScope);

/**
* an internal index format description, allowing us to find out if this index is upgraded or needs upgrading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ public void testHiddenIndexSearch() {
.get();
matchedHidden = Arrays.stream(searchResponse.getHits().getHits()).anyMatch(hit -> ".hidden-index".equals(hit.getIndex()));
assertTrue(matchedHidden);

// make index not hidden
assertAcked(client().admin().indices().prepareUpdateSettings("hidden-index")
.setSettings(Settings.builder().put("index.hidden", false).build())
.get());
searchResponse =
client().prepareSearch(randomFrom("*", "_all", "h*", "*index")).setSize(1000).setQuery(QueryBuilders.matchAllQuery()).get();
matchedHidden = Arrays.stream(searchResponse.getHits().getHits()).anyMatch(hit -> "hidden-index".equals(hit.getIndex()));
assertTrue(matchedHidden);
}

public void testGlobalTemplatesDoNotApply() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ static String[] extractLeaderShardHistoryUUIDs(Map<String, String> ccrIndexMetaD
nonReplicatedSettings.add(IndexMetaData.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING);
nonReplicatedSettings.add(IndexMetaData.INDEX_PRIORITY_SETTING);
nonReplicatedSettings.add(IndexMetaData.SETTING_WAIT_FOR_ACTIVE_SHARDS);
nonReplicatedSettings.add(IndexMetaData.INDEX_HIDDEN_SETTING);

nonReplicatedSettings.add(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING);
nonReplicatedSettings.add(EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE_SETTING);
Expand Down

0 comments on commit b3b5e51

Please sign in to comment.