diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index 760620af538..56bcdcf9c8d 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -296,7 +296,7 @@ public class Node implements Closeable { final SettingsModule settingsModule = new SettingsModule(this.settings, additionalSettings, additionalSettingsFilter); resourcesToClose.add(resourceWatcherService); final NetworkService networkService = new NetworkService(settings, - generateCustomNameResolvers(pluginsService.filterPlugins(DiscoveryPlugin.class))); + getCustomNameResolvers(pluginsService.filterPlugins(DiscoveryPlugin.class))); final ClusterService clusterService = new ClusterService(settings, settingsModule.getClusterSettings(), threadPool); clusterService.add(scriptModule.getScriptService()); resourcesToClose.add(clusterService); @@ -725,10 +725,10 @@ public class Node implements Closeable { } /** - * Generate Custom Name Resolvers list based on a Discovery Plugins list + * Get Custom Name Resolvers list based on a Discovery Plugins list * @param discoveryPlugins Discovery plugins list */ - private List generateCustomNameResolvers(List discoveryPlugins) { + private List getCustomNameResolvers(List discoveryPlugins) { List customNameResolvers = new ArrayList<>(); for (DiscoveryPlugin discoveryPlugin : discoveryPlugins) { NetworkService.CustomNameResolver customNameResolver = discoveryPlugin.getCustomNameResolver(settings); diff --git a/core/src/main/java/org/elasticsearch/plugins/DiscoveryPlugin.java b/core/src/main/java/org/elasticsearch/plugins/DiscoveryPlugin.java index eb9e434e249..f6174c08d12 100644 --- a/core/src/main/java/org/elasticsearch/plugins/DiscoveryPlugin.java +++ b/core/src/main/java/org/elasticsearch/plugins/DiscoveryPlugin.java @@ -38,6 +38,16 @@ import org.elasticsearch.common.settings.Settings; public interface DiscoveryPlugin { /** * Override to add additional {@link NetworkService.CustomNameResolver}s. + * This can be handy if you want to provide your own Network interface name like _mycard_ + * and implement by yourself the logic to get an actual IP address/hostname based on this + * name. + * + * For example: you could call a third party service (an API) to resolve _mycard_. + * Then you could define in elasticsearch.yml settings like: + * + *
{@code
+     * network.host: _mycard_
+     * }
*/ default NetworkService.CustomNameResolver getCustomNameResolver(Settings settings) { return null;