Skip to content

Commit 0e1b775

Browse files
committed
Add enable checks to missing enrich plugin methods (#47187)
Some of the server side objects that do not need to be created unless enrich is enabled were still being created. This commit fixes that.
1 parent fe937ea commit 0e1b775

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichPlugin.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import java.util.function.Supplier;
6464

6565
import static java.util.Collections.emptyList;
66+
import static java.util.Collections.emptyMap;
6667
import static org.elasticsearch.xpack.core.XPackSettings.ENRICH_ENABLED_SETTING;
6768

6869
public class EnrichPlugin extends Plugin implements ActionPlugin, IngestPlugin {
@@ -104,6 +105,10 @@ public EnrichPlugin(final Settings settings) {
104105

105106
@Override
106107
public Map<String, Processor.Factory> getProcessors(Processor.Parameters parameters) {
108+
if (enabled == false) {
109+
return emptyMap();
110+
}
111+
107112
EnrichProcessorFactory factory = new EnrichProcessorFactory(parameters.client);
108113
parameters.ingestService.addIngestClusterStateListener(factory);
109114
return Collections.singletonMap(EnrichProcessorFactory.TYPE, factory);
@@ -153,6 +158,7 @@ public Collection<Object> createComponents(Client client, ClusterService cluster
153158
if (enabled == false || transportClientMode) {
154159
return emptyList();
155160
}
161+
156162
EnrichPolicyLocks enrichPolicyLocks = new EnrichPolicyLocks();
157163
EnrichPolicyExecutor enrichPolicyExecutor = new EnrichPolicyExecutor(settings, clusterService, client, threadPool,
158164
new IndexNameExpressionResolver(), enrichPolicyLocks, System::currentTimeMillis);

0 commit comments

Comments
 (0)