Skip to content

Commit bd65664

Browse files
committed
Merge remote-tracking branch 'elastic/master' into packaging-script-one-liners
* elastic/master: [TEST] Enable DEBUG logging on testAutoQueueSizingWithMax [ML] Don't install empty ML metadata on startup (elastic#30751) Add assertion on removing copy_settings (elastic#30748) bump lucene version for 6_3_0 [DOCS] Mark painless execute api as experimental (elastic#30710) disable annotation processor for docs (elastic#30610) Add more script contexts (elastic#30721) Fix default shards count in create index docs (elastic#30747)
2 parents 0bb5cfc + 42b0b45 commit bd65664

File tree

47 files changed

+132
-265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+132
-265
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneTestPlugin.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import org.elasticsearch.gradle.BuildPlugin
2424
import org.gradle.api.Plugin
2525
import org.gradle.api.Project
2626
import org.gradle.api.plugins.JavaBasePlugin
27+
import org.gradle.api.tasks.compile.JavaCompile
2728

2829
/**
2930
* Configures the build to compile against Elasticsearch's test framework and
@@ -49,5 +50,12 @@ public class StandaloneTestPlugin implements Plugin<Project> {
4950
test.testClassesDir project.sourceSets.test.output.classesDir
5051
test.mustRunAfter(project.precommit)
5152
project.check.dependsOn(test)
53+
54+
project.tasks.withType(JavaCompile) {
55+
// This will be the default in Gradle 5.0
56+
if (options.compilerArgs.contains("-processor") == false) {
57+
options.compilerArgs << '-proc:none'
58+
}
59+
}
5260
}
5361
}

docs/painless/painless-execute-script.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[[painless-execute-api]]
22
=== Painless execute API
33

4+
experimental[The painless execute api is new and the request / response format may change in a breaking way in the future]
5+
46
The Painless execute API allows an arbitrary script to be executed and a result to be returned.
57

68
[[painless-execute-api-parameters]]

docs/reference/indices/create-index.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PUT twitter
2525
}
2626
--------------------------------------------------
2727
// CONSOLE
28-
<1> Default for `number_of_shards` is 5
28+
<1> Default for `number_of_shards` is 1
2929
<2> Default for `number_of_replicas` is 1 (ie one replica for each primary shard)
3030

3131
The above second curl example shows how an index called `twitter` can be

plugins/examples/script-expert-scoring/src/main/java/org/elasticsearch/example/expertscript/ExpertScriptPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public String getType() {
5454

5555
@Override
5656
public <T> T compile(String scriptName, String scriptSource, ScriptContext<T> context, Map<String, String> params) {
57-
if (context.equals(SearchScript.CONTEXT) == false) {
57+
if (context.equals(SearchScript.SCRIPT_SCORE_CONTEXT) == false) {
5858
throw new IllegalArgumentException(getType() + " scripts cannot be used for context [" + context.name + "]");
5959
}
6060
// we use the script "source" as the script identifier

server/src/main/java/org/elasticsearch/Version.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public class Version implements Comparable<Version>, ToXContentFragment {
169169
public static final int V_6_2_5_ID = 6020599;
170170
public static final Version V_6_2_5 = new Version(V_6_2_5_ID, LUCENE_7_2_1);
171171
public static final int V_6_3_0_ID = 6030099;
172-
public static final Version V_6_3_0 = new Version(V_6_3_0_ID, org.apache.lucene.util.Version.LUCENE_7_3_0);
172+
public static final Version V_6_3_0 = new Version(V_6_3_0_ID, org.apache.lucene.util.Version.LUCENE_7_3_1);
173173
public static final int V_6_4_0_ID = 6040099;
174174
public static final Version V_6_4_0 = new Version(V_6_4_0_ID, org.apache.lucene.util.Version.LUCENE_7_4_0);
175175
public static final int V_7_0_0_alpha1_ID = 7000001;

server/src/main/java/org/elasticsearch/index/query/TermsSetQueryBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ protected Query doToQuery(QueryShardContext context) throws IOException {
249249
IndexNumericFieldData fieldData = context.getForField(msmFieldType);
250250
longValuesSource = new FieldValuesSource(fieldData);
251251
} else if (minimumShouldMatchScript != null) {
252-
SearchScript.Factory factory = context.getScriptService().compile(minimumShouldMatchScript, SearchScript.CONTEXT);
252+
SearchScript.Factory factory = context.getScriptService().compile(minimumShouldMatchScript,
253+
SearchScript.TERMS_SET_QUERY_CONTEXT);
253254
Map<String, Object> params = new HashMap<>();
254255
params.putAll(minimumShouldMatchScript.getParams());
255256
params.put("num_terms", queries.size());

server/src/main/java/org/elasticsearch/index/query/functionscore/ScriptScoreFunctionBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected int doHashCode() {
9292
@Override
9393
protected ScoreFunction doToFunction(QueryShardContext context) {
9494
try {
95-
SearchScript.Factory factory = context.getScriptService().compile(script, SearchScript.CONTEXT);
95+
SearchScript.Factory factory = context.getScriptService().compile(script, SearchScript.SCRIPT_SCORE_CONTEXT);
9696
SearchScript.LeafFactory searchScript = factory.newFactory(script.getParams(), context.lookup());
9797
return new ScriptScoreFunction(script, searchScript);
9898
} catch (Exception e) {

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.elasticsearch.rest.action.admin.indices;
2121

22+
import org.elasticsearch.Version;
2223
import org.elasticsearch.action.admin.indices.shrink.ResizeRequest;
2324
import org.elasticsearch.action.admin.indices.shrink.ResizeType;
2425
import org.elasticsearch.action.support.ActiveShardCount;
@@ -47,6 +48,8 @@ public abstract class RestResizeHandler extends BaseRestHandler {
4748
public final RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
4849
final ResizeRequest resizeRequest = new ResizeRequest(request.param("target"), request.param("index"));
4950
resizeRequest.setResizeType(getResizeType());
51+
// copy_settings should be removed in Elasticsearch 8.0.0; cf. https://github.com/elastic/elasticsearch/issues/28347
52+
assert Version.CURRENT.major < 8;
5053
final String rawCopySettings = request.param("copy_settings");
5154
final Boolean copySettings;
5255
if (rawCopySettings == null) {

server/src/main/java/org/elasticsearch/script/ScriptModule.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public class ScriptModule {
4242
CORE_CONTEXTS = Stream.of(
4343
SearchScript.CONTEXT,
4444
SearchScript.AGGS_CONTEXT,
45+
SearchScript.SCRIPT_SCORE_CONTEXT,
46+
SearchScript.SCRIPT_SORT_CONTEXT,
47+
SearchScript.TERMS_SET_QUERY_CONTEXT,
4548
ExecutableScript.CONTEXT,
4649
ExecutableScript.AGGS_CONTEXT,
4750
ExecutableScript.UPDATE_CONTEXT,

server/src/main/java/org/elasticsearch/script/SearchScript.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ public interface Factory {
158158

159159
/** The context used to compile {@link SearchScript} factories. */
160160
public static final ScriptContext<Factory> CONTEXT = new ScriptContext<>("search", Factory.class);
161-
// TODO: remove aggs context when it has its own interface
161+
// TODO: remove these contexts when it has its own interface
162162
public static final ScriptContext<Factory> AGGS_CONTEXT = new ScriptContext<>("aggs", Factory.class);
163-
}
163+
// Can return a double. (For ScriptSortType#NUMBER only, for ScriptSortType#STRING normal CONTEXT should be used)
164+
public static final ScriptContext<Factory> SCRIPT_SORT_CONTEXT = new ScriptContext<>("sort", Factory.class);
165+
// Can return a float
166+
public static final ScriptContext<Factory> SCRIPT_SCORE_CONTEXT = new ScriptContext<>("score", Factory.class);
167+
// Can return a long
168+
public static final ScriptContext<Factory> TERMS_SET_QUERY_CONTEXT = new ScriptContext<>("terms_set", Factory.class);
169+
}

server/src/main/java/org/elasticsearch/search/sort/ScriptSortBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public static ScriptSortBuilder fromXContent(XContentParser parser, String eleme
305305

306306
@Override
307307
public SortFieldAndFormat build(QueryShardContext context) throws IOException {
308-
final SearchScript.Factory factory = context.getScriptService().compile(script, SearchScript.CONTEXT);
308+
final SearchScript.Factory factory = context.getScriptService().compile(script, SearchScript.SCRIPT_SORT_CONTEXT);
309309
final SearchScript.LeafFactory searchScript = factory.newFactory(script.getParams(), context.lookup());
310310

311311
MultiValueMode valueMode = null;

server/src/test/java/org/elasticsearch/common/util/concurrent/QueueResizingEsThreadPoolExecutorTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public void testAutoQueueSizingWithMin() throws Exception {
154154
context.close();
155155
}
156156

157+
@TestLogging("org.elasticsearch.common.util.concurrent:DEBUG")
157158
public void testAutoQueueSizingWithMax() throws Exception {
158159
ThreadContext context = new ThreadContext(Settings.EMPTY);
159160
ResizableBlockingQueue<Runnable> queue =

server/src/test/java/org/elasticsearch/search/functionscore/ExplainableScriptIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public String getType() {
7676
@Override
7777
public <T> T compile(String scriptName, String scriptSource, ScriptContext<T> context, Map<String, String> params) {
7878
assert scriptSource.equals("explainable_script");
79-
assert context == SearchScript.CONTEXT;
79+
assert context == SearchScript.SCRIPT_SCORE_CONTEXT;
8080
SearchScript.Factory factory = (p, lookup) -> new SearchScript.LeafFactory() {
8181
@Override
8282
public SearchScript newInstance(LeafReaderContext context) throws IOException {

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/MlMetadata.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.elasticsearch.ResourceNotFoundException;
1010
import org.elasticsearch.Version;
1111
import org.elasticsearch.cluster.AbstractDiffable;
12+
import org.elasticsearch.cluster.ClusterState;
1213
import org.elasticsearch.cluster.Diff;
1314
import org.elasticsearch.cluster.DiffableUtils;
1415
import org.elasticsearch.cluster.NamedDiff;
@@ -467,6 +468,14 @@ public static DatafeedState getDatafeedState(String datafeedId, @Nullable Persis
467468
}
468469
}
469470

471+
public static MlMetadata getMlMetadata(ClusterState state) {
472+
MlMetadata mlMetadata = (state == null) ? null : state.getMetaData().custom(MLMetadataField.TYPE);
473+
if (mlMetadata == null) {
474+
return EMPTY_METADATA;
475+
}
476+
return mlMetadata;
477+
}
478+
470479
public static class JobAlreadyMarkedAsDeletedException extends RuntimeException {
471480
}
472481
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/persistence/AnomalyDetectorsIndex.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
package org.elasticsearch.xpack.core.ml.job.persistence;
77

88
import org.elasticsearch.cluster.ClusterState;
9-
import org.elasticsearch.xpack.core.ml.MLMetadataField;
109
import org.elasticsearch.xpack.core.ml.MlMetadata;
1110

1211
/**
@@ -47,8 +46,7 @@ public static String resultsWriteAlias(String jobId) {
4746
* @return The index name
4847
*/
4948
public static String getPhysicalIndexFromState(ClusterState state, String jobId) {
50-
MlMetadata meta = state.getMetaData().custom(MLMetadataField.TYPE);
51-
return meta.getJobs().get(jobId).getResultsIndexName();
49+
return MlMetadata.getMlMetadata(state).getJobs().get(jobId).getResultsIndexName();
5250
}
5351

5452
/**

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearningFeatureSet.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.elasticsearch.xpack.core.XPackPlugin;
2424
import org.elasticsearch.xpack.core.XPackSettings;
2525
import org.elasticsearch.xpack.core.XPackField;
26-
import org.elasticsearch.xpack.core.ml.MLMetadataField;
2726
import org.elasticsearch.xpack.core.ml.MachineLearningFeatureSetUsage;
2827
import org.elasticsearch.xpack.core.ml.MlMetadata;
2928
import org.elasticsearch.xpack.core.ml.action.GetDatafeedsStatsAction;
@@ -132,15 +131,7 @@ public Map<String, Object> nativeCodeInfo() {
132131
@Override
133132
public void usage(ActionListener<XPackFeatureSet.Usage> listener) {
134133
ClusterState state = clusterService.state();
135-
MlMetadata mlMetadata = state.getMetaData().custom(MLMetadataField.TYPE);
136-
137-
// Handle case when usage is called but MlMetadata has not been installed yet
138-
if (mlMetadata == null) {
139-
listener.onResponse(new MachineLearningFeatureSetUsage(available(), enabled,
140-
Collections.emptyMap(), Collections.emptyMap()));
141-
} else {
142-
new Retriever(client, mlMetadata, available(), enabled()).execute(listener);
143-
}
134+
new Retriever(client, MlMetadata.getMlMetadata(state), available(), enabled()).execute(listener);
144135
}
145136

146137
public static class Retriever {

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlAssignmentNotifier.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import org.elasticsearch.common.component.AbstractComponent;
1414
import org.elasticsearch.common.settings.Settings;
1515
import org.elasticsearch.threadpool.ThreadPool;
16-
import org.elasticsearch.xpack.core.ml.MLMetadataField;
1716
import org.elasticsearch.xpack.core.ml.MlMetadata;
1817
import org.elasticsearch.xpack.core.ml.action.OpenJobAction;
1918
import org.elasticsearch.xpack.core.ml.action.StartDatafeedAction;
@@ -90,8 +89,7 @@ public void clusterChanged(ClusterChangedEvent event) {
9089
}
9190
} else if (StartDatafeedAction.TASK_NAME.equals(currentTask.getTaskName())) {
9291
String datafeedId = ((StartDatafeedAction.DatafeedParams) currentTask.getParams()).getDatafeedId();
93-
MlMetadata mlMetadata = event.state().getMetaData().custom(MLMetadataField.TYPE);
94-
DatafeedConfig datafeedConfig = mlMetadata.getDatafeed(datafeedId);
92+
DatafeedConfig datafeedConfig = MlMetadata.getMlMetadata(event.state()).getDatafeed(datafeedId);
9593
if (currentAssignment.getExecutorNode() == null) {
9694
String msg = "No node found to start datafeed [" + datafeedId +"]. Reasons [" +
9795
currentAssignment.getExplanation() + "]";

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlInitializationService.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,20 @@
77

88
import org.elasticsearch.client.Client;
99
import org.elasticsearch.cluster.ClusterChangedEvent;
10-
import org.elasticsearch.cluster.ClusterState;
1110
import org.elasticsearch.cluster.ClusterStateListener;
12-
import org.elasticsearch.cluster.ClusterStateUpdateTask;
13-
import org.elasticsearch.cluster.metadata.MetaData;
1411
import org.elasticsearch.cluster.service.ClusterService;
1512
import org.elasticsearch.common.component.AbstractComponent;
1613
import org.elasticsearch.common.component.LifecycleListener;
1714
import org.elasticsearch.common.settings.Settings;
1815
import org.elasticsearch.gateway.GatewayService;
1916
import org.elasticsearch.threadpool.ThreadPool;
20-
import org.elasticsearch.xpack.core.ml.MLMetadataField;
21-
import org.elasticsearch.xpack.core.ml.MlMetadata;
22-
23-
import java.util.concurrent.atomic.AtomicBoolean;
2417

2518
class MlInitializationService extends AbstractComponent implements ClusterStateListener {
2619

2720
private final ThreadPool threadPool;
2821
private final ClusterService clusterService;
2922
private final Client client;
3023

31-
private final AtomicBoolean installMlMetadataCheck = new AtomicBoolean(false);
32-
3324
private volatile MlDailyMaintenanceService mlDailyMaintenanceService;
3425

3526
MlInitializationService(Settings settings, ThreadPool threadPool, ClusterService clusterService, Client client) {
@@ -48,45 +39,12 @@ public void clusterChanged(ClusterChangedEvent event) {
4839
}
4940

5041
if (event.localNodeMaster()) {
51-
MetaData metaData = event.state().metaData();
52-
installMlMetadata(metaData);
5342
installDailyMaintenanceService();
5443
} else {
5544
uninstallDailyMaintenanceService();
5645
}
5746
}
5847

59-
private void installMlMetadata(MetaData metaData) {
60-
if (metaData.custom(MLMetadataField.TYPE) == null) {
61-
if (installMlMetadataCheck.compareAndSet(false, true)) {
62-
threadPool.executor(ThreadPool.Names.GENERIC).execute(() ->
63-
clusterService.submitStateUpdateTask("install-ml-metadata", new ClusterStateUpdateTask() {
64-
@Override
65-
public ClusterState execute(ClusterState currentState) throws Exception {
66-
// If the metadata has been added already don't try to update
67-
if (currentState.metaData().custom(MLMetadataField.TYPE) != null) {
68-
return currentState;
69-
}
70-
ClusterState.Builder builder = new ClusterState.Builder(currentState);
71-
MetaData.Builder metadataBuilder = MetaData.builder(currentState.metaData());
72-
metadataBuilder.putCustom(MLMetadataField.TYPE, MlMetadata.EMPTY_METADATA);
73-
builder.metaData(metadataBuilder.build());
74-
return builder.build();
75-
}
76-
77-
@Override
78-
public void onFailure(String source, Exception e) {
79-
installMlMetadataCheck.set(false);
80-
logger.error("unable to install ml metadata", e);
81-
}
82-
})
83-
);
84-
}
85-
} else {
86-
installMlMetadataCheck.set(false);
87-
}
88-
}
89-
9048
private void installDailyMaintenanceService() {
9149
if (mlDailyMaintenanceService == null) {
9250
mlDailyMaintenanceService = new MlDailyMaintenanceService(clusterService.getClusterName(), threadPool, client);

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportCloseJobAction.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.elasticsearch.tasks.Task;
2828
import org.elasticsearch.threadpool.ThreadPool;
2929
import org.elasticsearch.transport.TransportService;
30-
import org.elasticsearch.xpack.core.ml.MLMetadataField;
3130
import org.elasticsearch.xpack.core.ml.MlMetadata;
3231
import org.elasticsearch.xpack.core.ml.action.CloseJobAction;
3332
import org.elasticsearch.xpack.core.ml.action.FinalizeJobExecutionAction;
@@ -92,8 +91,7 @@ public TransportCloseJobAction(Settings settings, TransportService transportServ
9291
static void resolveAndValidateJobId(CloseJobAction.Request request, ClusterState state, List<String> openJobIds,
9392
List<String> closingJobIds) {
9493
PersistentTasksCustomMetaData tasksMetaData = state.getMetaData().custom(PersistentTasksCustomMetaData.TYPE);
95-
MlMetadata maybeNull = state.metaData().custom(MLMetadataField.TYPE);
96-
final MlMetadata mlMetadata = (maybeNull == null) ? MlMetadata.EMPTY_METADATA : maybeNull;
94+
final MlMetadata mlMetadata = MlMetadata.getMlMetadata(state);
9795

9896
List<String> failedJobs = new ArrayList<>();
9997

@@ -107,7 +105,7 @@ static void resolveAndValidateJobId(CloseJobAction.Request request, ClusterState
107105
};
108106

109107
Set<String> expandedJobIds = mlMetadata.expandJobIds(request.getJobId(), request.allowNoJobs());
110-
expandedJobIds.stream().forEach(jobIdProcessor::accept);
108+
expandedJobIds.forEach(jobIdProcessor::accept);
111109
if (request.isForce() == false && failedJobs.size() > 0) {
112110
if (expandedJobIds.size() == 1) {
113111
throw ExceptionsHelper.conflictStatusException("cannot close job [{}] because it failed, use force close",

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteDatafeedAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ protected DeleteDatafeedAction.Response newResponse(boolean acknowledged) {
119119
}
120120

121121
@Override
122-
public ClusterState execute(ClusterState currentState) throws Exception {
123-
MlMetadata currentMetadata = currentState.getMetaData().custom(MLMetadataField.TYPE);
122+
public ClusterState execute(ClusterState currentState) {
123+
MlMetadata currentMetadata = MlMetadata.getMlMetadata(currentState);
124124
PersistentTasksCustomMetaData persistentTasks =
125125
currentState.getMetaData().custom(PersistentTasksCustomMetaData.TYPE);
126126
MlMetadata newMetadata = new MlMetadata.Builder(currentMetadata)

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportDeleteFilterAction.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.elasticsearch.threadpool.ThreadPool;
2525
import org.elasticsearch.transport.TransportService;
2626
import org.elasticsearch.xpack.core.ml.action.DeleteFilterAction;
27-
import org.elasticsearch.xpack.core.ml.MLMetadataField;
2827
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
2928
import org.elasticsearch.xpack.core.ml.MlMetadata;
3029
import org.elasticsearch.xpack.core.ml.job.config.Detector;
@@ -60,8 +59,7 @@ protected void doExecute(DeleteFilterAction.Request request, ActionListener<Dele
6059

6160
final String filterId = request.getFilterId();
6261
ClusterState state = clusterService.state();
63-
MlMetadata currentMlMetadata = state.metaData().custom(MLMetadataField.TYPE);
64-
Map<String, Job> jobs = currentMlMetadata.getJobs();
62+
Map<String, Job> jobs = MlMetadata.getMlMetadata(state).getJobs();
6563
List<String> currentlyUsedBy = new ArrayList<>();
6664
for (Job job : jobs.values()) {
6765
List<Detector> detectors = job.getAnalysisConfig().getDetectors();

0 commit comments

Comments
 (0)