Skip to content

Commit

Permalink
Hide I/SLM history aliases (#53564)
Browse files Browse the repository at this point in the history
This commit adjusts the aliases used for the ILM and SLM history indices
to be hidden aliases.

Also tweaks the configuration of the `IndexTemplateRegistry`s used by
these history system to only upgrade the template from the master node,
as documents are indexed from the master node, so the template version
should only be upgraded from the master node.
  • Loading branch information
gwbrown authored Mar 16, 2020
1 parent f7482f7 commit 880cc3c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ static void ensureHistoryIndex(Client client, ClusterState state, ActionListener
client.admin().indices().prepareCreate(initialHistoryIndexName)
.setWaitForActiveShards(1)
.addAlias(new Alias(SLM_HISTORY_ALIAS)
.writeIndex(true))
.writeIndex(true)
.isHidden(true))
.execute(new ActionListener<CreateIndexResponse>() {
@Override
public void onResponse(CreateIndexResponse response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public class SnapshotLifecycleTemplateRegistry extends IndexTemplateRegistry {

public static final String SLM_POLICY_NAME = "slm-history-ilm-policy";

@Override
protected boolean requiresMasterNode() {
return true;
}

public static final IndexTemplateConfig TEMPLATE_SLM_HISTORY = new IndexTemplateConfig(
SLM_TEMPLATE_NAME,
"/slm-history.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static void ensureHistoryIndex(Client client, ClusterState state, ActionListener
.setSettings((Map<String, ?>) templateAsMap.get("settings"))
.addMapping("_doc", (Map<String, Object>) templateAsMap.get("mappings"))
.setWaitForActiveShards(1)
.addAlias(new Alias(ILM_HISTORY_ALIAS).writeIndex(true))
.addAlias(new Alias(ILM_HISTORY_ALIAS).writeIndex(true).isHidden(true))
.execute(new ActionListener<CreateIndexResponse>() {
@Override
public void onResponse(CreateIndexResponse response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public class ILMHistoryTemplateRegistry extends IndexTemplateRegistry {

public static final String ILM_POLICY_NAME = "ilm-history-ilm-policy";

@Override
protected boolean requiresMasterNode() {
return true;
}

public static final IndexTemplateConfig TEMPLATE_ILM_HISTORY = new IndexTemplateConfig(
ILM_TEMPLATE_NAME,
"/ilm-history.json",
Expand Down

0 comments on commit 880cc3c

Please sign in to comment.