When Elasticsearch starts up, plugins are loaded based on their inter-dependencies. The specific order used is sometimes useful to see. Currently though the actual order cannot be seen. Instead the modules and plugins are logged in name sorted order after all loading has occurred.

We should be more clear about what order the plugins are actually loaded in, though we do need to be careful as to not add too much noise. I suggest moving the "loaded xxx module" message to the actual loading method in PluginsService (it will require passing through whether the code being loaded is a module or plugin).


server/src/main/java/org/elasticsearch/plugins/PluginsService.java
.collect(Collectors.groupingBy(Tuple::v1, Collectors.mapping(Tuple::v2, Collectors.toList())));
        for (LoadedPlugin pluginTuple : plugins) {
            if (pluginTuple.instance() instanceof ExtensiblePlugin) {
                loadExtensionsForPlugin(
                    (ExtensiblePlugin) pluginTuple.instance(),
                    extendingPluginsByName.getOrDefault(pluginTuple.descriptor().getName(), List.of())
                );
            }
        }
    }
    /**
     * SPI convenience method that uses the {@link ServiceLoader} JDK class to load various SPI providers
     * from plugins/modules.
     * <p>
     * For example:
     *
     * <pre>
     * var pluginHandlers = pluginsService.loadServiceProviders(OperatorHandlerProvider.class);
     * </pre>
     * @param service A templated service class to look for providers in plugins
     * @return an immutable {@link List} of discovered providers in the plugins/modules
     */
    public <T> List<? extends T> loadServiceProviders(Class<T> service) {
        List<T> result = new ArrayList<>();
        for (LoadedPlugin pluginTuple : plugins()) {
            result.addAll(createExtensions(service, pluginTuple.instance));
        }
        return Collections.unmodifiableList(result);
    }
    private static void loadExtensionsForPlugin(ExtensiblePlugin extensiblePlugin, List<Plugin> extendingPlugins) {