ClusterState contains Enrich Policy metadata information, that can be useful to other plugins.
As of now, ClusterState metadata contains [EnrichMetadata](https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichMetadata.java) objects, that contain [EnrichPolicy](https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/enrich/EnrichPolicy.java) objects.
While `EnrichPolicy` class is in `core`, `EnrichMetadata` is in `enrich` plugin, so it's practically impossible to access EnrichPolicy information without creating a dependency from `enrich` plugin.
It would be good to have an interface in core to avoid this dependency.
x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichStore.java
) {
        submitUnbatchedTask(clusterService, "update-enrich-metadata", new ClusterStateUpdateTask() {
            @Override
            public ClusterState execute(ClusterState currentState) throws Exception {
                Map<String, EnrichPolicy> policies = function.apply(currentState);
                Metadata metadata = Metadata.builder(currentState.metadata())
                    .putCustom(EnrichMetadata.TYPE, new EnrichMetadata(policies))
                    .build();
                return ClusterState.builder(currentState).metadata(metadata).build();
            }
            @Override
            public void clusterStateProcessed(ClusterState oldState, ClusterState newState) {
                handler.accept(null);
            }
            @Override
            public void onFailure(Exception e) {
                handler.accept(e);
            }
        });
    }
    @SuppressForbidden(reason = "legacy usage of unbatched task") 
    private static void submitUnbatchedTask(
        ClusterService clusterService,
        @SuppressWarnings("SameParameterValue") String source,
        ClusterStateUpdateTask task
    ) {
        clusterService.submitUnbatchedStateUpdateTask(source, task);
    }
}