Remove ParseFieldMatcher (elastic/elasticsearch#718)
Original commit: elastic/x-pack-elasticsearch@070fb8146c
This commit is contained in:
parent
c1ee50f238
commit
3ce48bc7b9
|
@ -12,8 +12,6 @@ import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.component.LifecycleListener;
|
import org.elasticsearch.common.component.LifecycleListener;
|
||||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
import org.elasticsearch.common.settings.Setting;
|
||||||
|
@ -136,13 +134,9 @@ public class MlPlugin extends Plugin implements ActionPlugin {
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
private final Environment env;
|
private final Environment env;
|
||||||
|
|
||||||
private final ParseFieldMatcherSupplier parseFieldMatcherSupplier;
|
|
||||||
|
|
||||||
public MlPlugin(Settings settings) {
|
public MlPlugin(Settings settings) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.env = new Environment(settings);
|
this.env = new Environment(settings);
|
||||||
ParseFieldMatcher matcher = new ParseFieldMatcher(settings);
|
|
||||||
parseFieldMatcherSupplier = () -> matcher;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -167,7 +161,7 @@ public class MlPlugin extends Plugin implements ActionPlugin {
|
||||||
NamedXContentRegistry.Entry entry = new NamedXContentRegistry.Entry(
|
NamedXContentRegistry.Entry entry = new NamedXContentRegistry.Entry(
|
||||||
MetaData.Custom.class,
|
MetaData.Custom.class,
|
||||||
new ParseField("ml"),
|
new ParseField("ml"),
|
||||||
parser -> MlMetadata.ML_METADATA_PARSER.parse(parser, parseFieldMatcherSupplier).build()
|
parser -> MlMetadata.ML_METADATA_PARSER.parse(parser, null).build()
|
||||||
);
|
);
|
||||||
return Collections.singletonList(entry);
|
return Collections.singletonList(entry);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +171,7 @@ public class MlPlugin extends Plugin implements ActionPlugin {
|
||||||
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
ResourceWatcherService resourceWatcherService, ScriptService scriptService,
|
||||||
NamedXContentRegistry xContentRegistry) {
|
NamedXContentRegistry xContentRegistry) {
|
||||||
JobResultsPersister jobResultsPersister = new JobResultsPersister(settings, client);
|
JobResultsPersister jobResultsPersister = new JobResultsPersister(settings, client);
|
||||||
JobProvider jobProvider = new JobProvider(client, 0, parseFieldMatcherSupplier.getParseFieldMatcher());
|
JobProvider jobProvider = new JobProvider(client, 0);
|
||||||
JobRenormalizedResultsPersister jobRenormalizedResultsPersister = new JobRenormalizedResultsPersister(settings,
|
JobRenormalizedResultsPersister jobRenormalizedResultsPersister = new JobRenormalizedResultsPersister(settings,
|
||||||
jobResultsPersister);
|
jobResultsPersister);
|
||||||
JobDataCountsPersister jobDataCountsPersister = new JobDataCountsPersister(settings, client);
|
JobDataCountsPersister jobDataCountsPersister = new JobDataCountsPersister(settings, client);
|
||||||
|
@ -202,7 +196,7 @@ public class MlPlugin extends Plugin implements ActionPlugin {
|
||||||
}
|
}
|
||||||
NormalizerFactory normalizerFactory = new NormalizerFactory(normalizerProcessFactory,
|
NormalizerFactory normalizerFactory = new NormalizerFactory(normalizerProcessFactory,
|
||||||
threadPool.executor(MlPlugin.THREAD_POOL_NAME));
|
threadPool.executor(MlPlugin.THREAD_POOL_NAME));
|
||||||
AutodetectResultsParser autodetectResultsParser = new AutodetectResultsParser(settings, parseFieldMatcherSupplier);
|
AutodetectResultsParser autodetectResultsParser = new AutodetectResultsParser(settings);
|
||||||
DataProcessor dataProcessor = new AutodetectProcessManager(settings, client, threadPool, jobManager, jobProvider,
|
DataProcessor dataProcessor = new AutodetectProcessManager(settings, client, threadPool, jobManager, jobProvider,
|
||||||
jobResultsPersister, jobRenormalizedResultsPersister, jobDataCountsPersister, autodetectResultsParser,
|
jobResultsPersister, jobRenormalizedResultsPersister, jobDataCountsPersister, autodetectResultsParser,
|
||||||
autodetectProcessFactory, normalizerFactory);
|
autodetectProcessFactory, normalizerFactory);
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.action.support.master.MasterNodeRequest;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -64,7 +63,7 @@ public class FlushJobAction extends Action<FlushJobAction.Request, FlushJobActio
|
||||||
public static final ParseField END = new ParseField("end");
|
public static final ParseField END = new ParseField("end");
|
||||||
public static final ParseField ADVANCE_TIME = new ParseField("advance_time");
|
public static final ParseField ADVANCE_TIME = new ParseField("advance_time");
|
||||||
|
|
||||||
private static final ObjectParser<Request, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(NAME, Request::new);
|
private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
||||||
|
@ -74,8 +73,8 @@ public class FlushJobAction extends Action<FlushJobAction.Request, FlushJobActio
|
||||||
PARSER.declareString(Request::setAdvanceTime, ADVANCE_TIME);
|
PARSER.declareString(Request::setAdvanceTime, ADVANCE_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Request parseRequest(String jobId, XContentParser parser, ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
public static Request parseRequest(String jobId, XContentParser parser) {
|
||||||
Request request = PARSER.apply(parser, parseFieldMatcherSupplier);
|
Request request = PARSER.apply(parser, null);
|
||||||
if (jobId != null) {
|
if (jobId != null) {
|
||||||
request.jobId = jobId;
|
request.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -70,7 +69,7 @@ public class GetBucketsAction extends Action<GetBucketsAction.Request, GetBucket
|
||||||
public static final ParseField MAX_NORMALIZED_PROBABILITY = new ParseField("max_normalized_probability");
|
public static final ParseField MAX_NORMALIZED_PROBABILITY = new ParseField("max_normalized_probability");
|
||||||
public static final ParseField TIMESTAMP = new ParseField("timestamp");
|
public static final ParseField TIMESTAMP = new ParseField("timestamp");
|
||||||
|
|
||||||
private static final ObjectParser<Request, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(NAME, Request::new);
|
private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
||||||
|
@ -88,9 +87,8 @@ public class GetBucketsAction extends Action<GetBucketsAction.Request, GetBucket
|
||||||
PARSER.declareString(Request::setPartitionValue, PARTITION_VALUE);
|
PARSER.declareString(Request::setPartitionValue, PARTITION_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Request parseRequest(String jobId, XContentParser parser,
|
public static Request parseRequest(String jobId, XContentParser parser) {
|
||||||
ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
Request request = PARSER.apply(parser, null);
|
||||||
Request request = PARSER.apply(parser, parseFieldMatcherSupplier);
|
|
||||||
if (jobId != null) {
|
if (jobId != null) {
|
||||||
request.jobId = jobId;
|
request.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -66,7 +65,7 @@ Action<GetCategoriesDefinitionAction.Request, GetCategoriesDefinitionAction.Resp
|
||||||
public static final ParseField FROM = new ParseField("from");
|
public static final ParseField FROM = new ParseField("from");
|
||||||
public static final ParseField SIZE = new ParseField("size");
|
public static final ParseField SIZE = new ParseField("size");
|
||||||
|
|
||||||
private static final ObjectParser<Request, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(NAME, Request::new);
|
private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
||||||
|
@ -74,8 +73,8 @@ Action<GetCategoriesDefinitionAction.Request, GetCategoriesDefinitionAction.Resp
|
||||||
PARSER.declareObject(Request::setPageParams, PageParams.PARSER, PageParams.PAGE);
|
PARSER.declareObject(Request::setPageParams, PageParams.PARSER, PageParams.PAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Request parseRequest(String jobId, XContentParser parser, ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
public static Request parseRequest(String jobId, XContentParser parser) {
|
||||||
Request request = PARSER.apply(parser, parseFieldMatcherSupplier);
|
Request request = PARSER.apply(parser, null);
|
||||||
if (jobId != null) {
|
if (jobId != null) {
|
||||||
request.jobId = jobId;
|
request.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -69,7 +68,7 @@ extends Action<GetInfluencersAction.Request, GetInfluencersAction.Response, GetI
|
||||||
public static final ParseField SORT_FIELD = new ParseField("sort");
|
public static final ParseField SORT_FIELD = new ParseField("sort");
|
||||||
public static final ParseField DESCENDING_SORT = new ParseField("desc");
|
public static final ParseField DESCENDING_SORT = new ParseField("desc");
|
||||||
|
|
||||||
private static final ObjectParser<Request, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(NAME, Request::new);
|
private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
||||||
|
@ -82,9 +81,8 @@ extends Action<GetInfluencersAction.Request, GetInfluencersAction.Response, GetI
|
||||||
PARSER.declareBoolean(Request::setDecending, DESCENDING_SORT);
|
PARSER.declareBoolean(Request::setDecending, DESCENDING_SORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Request parseRequest(String jobId, XContentParser parser,
|
public static Request parseRequest(String jobId, XContentParser parser) {
|
||||||
ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
Request request = PARSER.apply(parser, null);
|
||||||
Request request = PARSER.apply(parser, parseFieldMatcherSupplier);
|
|
||||||
if (jobId != null) {
|
if (jobId != null) {
|
||||||
request.jobId = jobId;
|
request.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ public class GetListAction extends Action<GetListAction.Request, GetListAction.R
|
||||||
BytesReference docSource = getDocResponse.getSourceAsBytesRef();
|
BytesReference docSource = getDocResponse.getSourceAsBytesRef();
|
||||||
XContentParser parser =
|
XContentParser parser =
|
||||||
XContentFactory.xContent(docSource).createParser(NamedXContentRegistry.EMPTY, docSource);
|
XContentFactory.xContent(docSource).createParser(NamedXContentRegistry.EMPTY, docSource);
|
||||||
ListDocument listDocument = ListDocument.PARSER.apply(parser, () -> parseFieldMatcher);
|
ListDocument listDocument = ListDocument.PARSER.apply(parser, null);
|
||||||
responseBody = new QueryPage<>(Collections.singletonList(listDocument), 1, ListDocument.RESULTS_FIELD);
|
responseBody = new QueryPage<>(Collections.singletonList(listDocument), 1, ListDocument.RESULTS_FIELD);
|
||||||
|
|
||||||
Response listResponse = new Response(responseBody);
|
Response listResponse = new Response(responseBody);
|
||||||
|
@ -324,7 +324,7 @@ public class GetListAction extends Action<GetListAction.Request, GetListAction.R
|
||||||
BytesReference docSource = hit.sourceRef();
|
BytesReference docSource = hit.sourceRef();
|
||||||
XContentParser parser =
|
XContentParser parser =
|
||||||
XContentFactory.xContent(docSource).createParser(NamedXContentRegistry.EMPTY, docSource);
|
XContentFactory.xContent(docSource).createParser(NamedXContentRegistry.EMPTY, docSource);
|
||||||
docs.add(ListDocument.PARSER.apply(parser, () -> parseFieldMatcher));
|
docs.add(ListDocument.PARSER.apply(parser, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
Response listResponse = new Response(new QueryPage<>(docs, docs.size(), ListDocument.RESULTS_FIELD));
|
Response listResponse = new Response(new QueryPage<>(docs, docs.size(), ListDocument.RESULTS_FIELD));
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -69,7 +68,7 @@ extends Action<GetModelSnapshotsAction.Request, GetModelSnapshotsAction.Response
|
||||||
public static final ParseField END = new ParseField("end");
|
public static final ParseField END = new ParseField("end");
|
||||||
public static final ParseField DESC = new ParseField("desc");
|
public static final ParseField DESC = new ParseField("desc");
|
||||||
|
|
||||||
private static final ObjectParser<Request, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(NAME, Request::new);
|
private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
||||||
|
@ -81,8 +80,8 @@ extends Action<GetModelSnapshotsAction.Request, GetModelSnapshotsAction.Response
|
||||||
PARSER.declareObject(Request::setPageParams, PageParams.PARSER, PageParams.PAGE);
|
PARSER.declareObject(Request::setPageParams, PageParams.PARSER, PageParams.PAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Request parseRequest(String jobId, XContentParser parser, ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
public static Request parseRequest(String jobId, XContentParser parser) {
|
||||||
Request request = PARSER.apply(parser, parseFieldMatcherSupplier);
|
Request request = PARSER.apply(parser, null);
|
||||||
if (jobId != null) {
|
if (jobId != null) {
|
||||||
request.jobId = jobId;
|
request.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -71,7 +70,7 @@ public class GetRecordsAction extends Action<GetRecordsAction.Request, GetRecord
|
||||||
public static final ParseField MAX_NORMALIZED_PROBABILITY = new ParseField("normalized_probability");
|
public static final ParseField MAX_NORMALIZED_PROBABILITY = new ParseField("normalized_probability");
|
||||||
public static final ParseField PARTITION_VALUE = new ParseField("partition_value");
|
public static final ParseField PARTITION_VALUE = new ParseField("partition_value");
|
||||||
|
|
||||||
private static final ObjectParser<Request, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(NAME, Request::new);
|
private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
||||||
|
@ -86,8 +85,8 @@ public class GetRecordsAction extends Action<GetRecordsAction.Request, GetRecord
|
||||||
PARSER.declareDouble(Request::setMaxNormalizedProbability, MAX_NORMALIZED_PROBABILITY);
|
PARSER.declareDouble(Request::setMaxNormalizedProbability, MAX_NORMALIZED_PROBABILITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Request parseRequest(String jobId, XContentParser parser, ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
public static Request parseRequest(String jobId, XContentParser parser) {
|
||||||
Request request = PARSER.apply(parser, parseFieldMatcherSupplier);
|
Request request = PARSER.apply(parser, null);
|
||||||
if (jobId != null) {
|
if (jobId != null) {
|
||||||
request.jobId = jobId;
|
request.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||||
import org.elasticsearch.cluster.block.ClusterBlockLevel;
|
import org.elasticsearch.cluster.block.ClusterBlockLevel;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -58,8 +57,8 @@ public class PutJobAction extends Action<PutJobAction.Request, PutJobAction.Resp
|
||||||
|
|
||||||
public static class Request extends AcknowledgedRequest<Request> implements ToXContent {
|
public static class Request extends AcknowledgedRequest<Request> implements ToXContent {
|
||||||
|
|
||||||
public static Request parseRequest(String jobId, XContentParser parser, ParseFieldMatcherSupplier matcherSupplier) {
|
public static Request parseRequest(String jobId, XContentParser parser) {
|
||||||
Job job = Job.PARSER.apply(parser, matcherSupplier).build(true, jobId);
|
Job job = Job.PARSER.apply(parser, null).build(true, jobId);
|
||||||
return new Request(job);
|
return new Request(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||||
import org.elasticsearch.cluster.block.ClusterBlockLevel;
|
import org.elasticsearch.cluster.block.ClusterBlockLevel;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -62,8 +61,8 @@ public class PutListAction extends Action<PutListAction.Request, PutListAction.R
|
||||||
|
|
||||||
public static class Request extends MasterNodeReadRequest<Request> implements ToXContent {
|
public static class Request extends MasterNodeReadRequest<Request> implements ToXContent {
|
||||||
|
|
||||||
public static Request parseRequest(XContentParser parser, ParseFieldMatcherSupplier matcherSupplier) {
|
public static Request parseRequest(XContentParser parser) {
|
||||||
ListDocument listDocument = ListDocument.PARSER.apply(parser, matcherSupplier);
|
ListDocument listDocument = ListDocument.PARSER.apply(parser, null);
|
||||||
return new Request(listDocument);
|
return new Request(listDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.elasticsearch.cluster.block.ClusterBlockLevel;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -59,8 +58,8 @@ public class PutSchedulerAction extends Action<PutSchedulerAction.Request, PutSc
|
||||||
|
|
||||||
public static class Request extends AcknowledgedRequest<Request> implements ToXContent {
|
public static class Request extends AcknowledgedRequest<Request> implements ToXContent {
|
||||||
|
|
||||||
public static Request parseRequest(String schedulerId, XContentParser parser, ParseFieldMatcherSupplier matcherSupplier) {
|
public static Request parseRequest(String schedulerId, XContentParser parser) {
|
||||||
SchedulerConfig.Builder scheduler = SchedulerConfig.PARSER.apply(parser, matcherSupplier);
|
SchedulerConfig.Builder scheduler = SchedulerConfig.PARSER.apply(parser, null);
|
||||||
scheduler.setId(schedulerId);
|
scheduler.setId(schedulerId);
|
||||||
return new Request(scheduler.build());
|
return new Request(scheduler.build());
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import org.elasticsearch.cluster.block.ClusterBlockLevel;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -84,7 +83,7 @@ extends Action<RevertModelSnapshotAction.Request, RevertModelSnapshotAction.Resp
|
||||||
public static final ParseField DESCRIPTION = new ParseField("description");
|
public static final ParseField DESCRIPTION = new ParseField("description");
|
||||||
public static final ParseField DELETE_INTERVENING = new ParseField("delete_intervening_results");
|
public static final ParseField DELETE_INTERVENING = new ParseField("delete_intervening_results");
|
||||||
|
|
||||||
private static ObjectParser<Request, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(NAME, Request::new);
|
private static ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
||||||
|
@ -94,8 +93,8 @@ extends Action<RevertModelSnapshotAction.Request, RevertModelSnapshotAction.Resp
|
||||||
PARSER.declareBoolean(Request::setDeleteInterveningResults, DELETE_INTERVENING);
|
PARSER.declareBoolean(Request::setDeleteInterveningResults, DELETE_INTERVENING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Request parseRequest(String jobId, XContentParser parser, ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
public static Request parseRequest(String jobId, XContentParser parser) {
|
||||||
Request request = PARSER.apply(parser, parseFieldMatcherSupplier);
|
Request request = PARSER.apply(parser, null);
|
||||||
if (jobId != null) {
|
if (jobId != null) {
|
||||||
request.jobId = jobId;
|
request.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -30,8 +29,8 @@ import org.elasticsearch.tasks.Task;
|
||||||
import org.elasticsearch.tasks.TaskId;
|
import org.elasticsearch.tasks.TaskId;
|
||||||
import org.elasticsearch.threadpool.ThreadPool;
|
import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.transport.TransportService;
|
import org.elasticsearch.transport.TransportService;
|
||||||
import org.elasticsearch.xpack.ml.scheduler.SchedulerConfig;
|
|
||||||
import org.elasticsearch.xpack.ml.scheduler.ScheduledJobRunner;
|
import org.elasticsearch.xpack.ml.scheduler.ScheduledJobRunner;
|
||||||
|
import org.elasticsearch.xpack.ml.scheduler.SchedulerConfig;
|
||||||
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -62,7 +61,7 @@ public class StartSchedulerAction
|
||||||
|
|
||||||
public static class Request extends ActionRequest implements ToXContent {
|
public static class Request extends ActionRequest implements ToXContent {
|
||||||
|
|
||||||
public static ObjectParser<Request, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(NAME, Request::new);
|
public static ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString((request, schedulerId) -> request.schedulerId = schedulerId, SchedulerConfig.ID);
|
PARSER.declareString((request, schedulerId) -> request.schedulerId = schedulerId, SchedulerConfig.ID);
|
||||||
|
@ -70,8 +69,8 @@ public class StartSchedulerAction
|
||||||
PARSER.declareLong(Request::setEndTime, END_TIME);
|
PARSER.declareLong(Request::setEndTime, END_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Request parseRequest(String schedulerId, XContentParser parser, ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
public static Request parseRequest(String schedulerId, XContentParser parser) {
|
||||||
Request request = PARSER.apply(parser, parseFieldMatcherSupplier);
|
Request request = PARSER.apply(parser, null);
|
||||||
if (schedulerId != null) {
|
if (schedulerId != null) {
|
||||||
request.schedulerId = schedulerId;
|
request.schedulerId = schedulerId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -66,7 +65,7 @@ UpdateModelSnapshotAction.RequestBuilder> {
|
||||||
|
|
||||||
public static class Request extends ActionRequest implements ToXContent {
|
public static class Request extends ActionRequest implements ToXContent {
|
||||||
|
|
||||||
private static final ObjectParser<Request, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(NAME, Request::new);
|
private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
PARSER.declareString((request, jobId) -> request.jobId = jobId, Job.ID);
|
||||||
|
@ -74,9 +73,8 @@ UpdateModelSnapshotAction.RequestBuilder> {
|
||||||
PARSER.declareString((request, description) -> request.description = description, ModelSnapshot.DESCRIPTION);
|
PARSER.declareString((request, description) -> request.description = description, ModelSnapshot.DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Request parseRequest(String jobId, String snapshotId, XContentParser parser,
|
public static Request parseRequest(String jobId, String snapshotId, XContentParser parser) {
|
||||||
ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
Request request = PARSER.apply(parser, null);
|
||||||
Request request = PARSER.apply(parser, parseFieldMatcherSupplier);
|
|
||||||
if (jobId != null) {
|
if (jobId != null) {
|
||||||
request.jobId = jobId;
|
request.jobId = jobId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import org.elasticsearch.action.Action;
|
import org.elasticsearch.action.Action;
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.ActionRequest;
|
import org.elasticsearch.action.ActionRequest;
|
||||||
|
@ -19,7 +16,6 @@ import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -31,6 +27,9 @@ import org.elasticsearch.threadpool.ThreadPool;
|
||||||
import org.elasticsearch.transport.TransportService;
|
import org.elasticsearch.transport.TransportService;
|
||||||
import org.elasticsearch.xpack.ml.job.Detector;
|
import org.elasticsearch.xpack.ml.job.Detector;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ValidateDetectorAction
|
public class ValidateDetectorAction
|
||||||
extends Action<ValidateDetectorAction.Request, ValidateDetectorAction.Response, ValidateDetectorAction.RequestBuilder> {
|
extends Action<ValidateDetectorAction.Request, ValidateDetectorAction.Response, ValidateDetectorAction.RequestBuilder> {
|
||||||
|
|
||||||
|
@ -65,8 +64,8 @@ extends Action<ValidateDetectorAction.Request, ValidateDetectorAction.Response,
|
||||||
|
|
||||||
// NORELEASE this needs to change so the body is not directly the
|
// NORELEASE this needs to change so the body is not directly the
|
||||||
// detector but and object that contains a field for the detector
|
// detector but and object that contains a field for the detector
|
||||||
public static Request parseRequest(XContentParser parser, ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
public static Request parseRequest(XContentParser parser) {
|
||||||
Detector detector = Detector.PARSER.apply(parser, parseFieldMatcherSupplier).build();
|
Detector detector = Detector.PARSER.apply(parser, null).build();
|
||||||
return new Request(detector);
|
return new Request(detector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import org.elasticsearch.action.Action;
|
import org.elasticsearch.action.Action;
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.ActionRequest;
|
import org.elasticsearch.action.ActionRequest;
|
||||||
|
@ -19,7 +16,6 @@ import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||||
import org.elasticsearch.client.ElasticsearchClient;
|
import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -32,6 +28,9 @@ import org.elasticsearch.transport.TransportService;
|
||||||
import org.elasticsearch.xpack.ml.job.transform.TransformConfig;
|
import org.elasticsearch.xpack.ml.job.transform.TransformConfig;
|
||||||
import org.elasticsearch.xpack.ml.job.transform.verification.TransformConfigVerifier;
|
import org.elasticsearch.xpack.ml.job.transform.verification.TransformConfigVerifier;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ValidateTransformAction
|
public class ValidateTransformAction
|
||||||
extends Action<ValidateTransformAction.Request, ValidateTransformAction.Response, ValidateTransformAction.RequestBuilder> {
|
extends Action<ValidateTransformAction.Request, ValidateTransformAction.Response, ValidateTransformAction.RequestBuilder> {
|
||||||
|
|
||||||
|
@ -64,8 +63,8 @@ extends Action<ValidateTransformAction.Request, ValidateTransformAction.Response
|
||||||
|
|
||||||
private TransformConfig transform;
|
private TransformConfig transform;
|
||||||
|
|
||||||
public static Request parseRequest(XContentParser parser, ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
public static Request parseRequest(XContentParser parser) {
|
||||||
TransformConfig transform = TransformConfig.PARSER.apply(parser, parseFieldMatcherSupplier);
|
TransformConfig transform = TransformConfig.PARSER.apply(parser, null);
|
||||||
return new Request(transform);
|
return new Request(transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.elasticsearch.client.ElasticsearchClient;
|
||||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||||
import org.elasticsearch.cluster.service.ClusterService;
|
import org.elasticsearch.cluster.service.ClusterService;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -67,7 +66,7 @@ extends Action<ValidateTransformsAction.Request, ValidateTransformsAction.Respon
|
||||||
public static final ParseField TRANSFORMS = new ParseField("transforms");
|
public static final ParseField TRANSFORMS = new ParseField("transforms");
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static final ConstructingObjectParser<Request, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(NAME,
|
public static final ConstructingObjectParser<Request, Void> PARSER = new ConstructingObjectParser<>(NAME,
|
||||||
a -> new Request((List<TransformConfig>) a[0]));
|
a -> new Request((List<TransformConfig>) a[0]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.elasticsearch.xpack.ml.job;
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -70,7 +69,7 @@ public class AnalysisConfig extends ToXContentToBytes implements Writeable {
|
||||||
public static final long DEFAULT_RESULT_FINALIZATION_WINDOW = 2L;
|
public static final long DEFAULT_RESULT_FINALIZATION_WINDOW = 2L;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static final ConstructingObjectParser<AnalysisConfig.Builder, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<AnalysisConfig.Builder, Void> PARSER =
|
||||||
new ConstructingObjectParser<>(ANALYSIS_CONFIG.getPreferredName(), a -> new AnalysisConfig.Builder((List<Detector>) a[0]));
|
new ConstructingObjectParser<>(ANALYSIS_CONFIG.getPreferredName(), a -> new AnalysisConfig.Builder((List<Detector>) a[0]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.elasticsearch.xpack.ml.job;
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -31,7 +30,7 @@ public class AnalysisLimits extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField MODEL_MEMORY_LIMIT = new ParseField("model_memory_limit");
|
public static final ParseField MODEL_MEMORY_LIMIT = new ParseField("model_memory_limit");
|
||||||
public static final ParseField CATEGORIZATION_EXAMPLES_LIMIT = new ParseField("categorization_examples_limit");
|
public static final ParseField CATEGORIZATION_EXAMPLES_LIMIT = new ParseField("categorization_examples_limit");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<AnalysisLimits, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<AnalysisLimits, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
"analysis_limits", a -> new AnalysisLimits((Long) a[0], (Long) a[1]));
|
"analysis_limits", a -> new AnalysisLimits((Long) a[0], (Long) a[1]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,13 +7,12 @@ package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
||||||
import org.elasticsearch.xpack.ml.utils.time.TimeUtils;
|
import org.elasticsearch.xpack.ml.utils.time.TimeUtils;
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ public class DataCounts extends ToXContentToBytes implements Writeable {
|
||||||
|
|
||||||
public static final ParseField TYPE = new ParseField("data_counts");
|
public static final ParseField TYPE = new ParseField("data_counts");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<DataCounts, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<DataCounts, Void> PARSER =
|
||||||
new ConstructingObjectParser<>("data_counts", a -> new DataCounts((String) a[0], (long) a[1], (long) a[2], (long) a[3],
|
new ConstructingObjectParser<>("data_counts", a -> new DataCounts((String) a[0], (long) a[1], (long) a[2], (long) a[3],
|
||||||
(long) a[4], (long) a[5], (long) a[6], (long) a[7], (Date) a[8], (Date) a[9]));
|
(long) a[4], (long) a[5], (long) a[6], (long) a[7], (Date) a[8], (Date) a[9]));
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -133,7 +132,7 @@ public class DataDescription extends ToXContentToBytes implements Writeable {
|
||||||
private final char fieldDelimiter;
|
private final char fieldDelimiter;
|
||||||
private final char quoteCharacter;
|
private final char quoteCharacter;
|
||||||
|
|
||||||
public static final ObjectParser<Builder, ParseFieldMatcherSupplier> PARSER =
|
public static final ObjectParser<Builder, Void> PARSER =
|
||||||
new ObjectParser<>(DATA_DESCRIPTION_FIELD.getPreferredName(), Builder::new);
|
new ObjectParser<>(DATA_DESCRIPTION_FIELD.getPreferredName(), Builder::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.elasticsearch.xpack.ml.job;
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -92,7 +91,7 @@ public class Detector extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField EXCLUDE_FREQUENT_FIELD = new ParseField("exclude_frequent");
|
public static final ParseField EXCLUDE_FREQUENT_FIELD = new ParseField("exclude_frequent");
|
||||||
public static final ParseField DETECTOR_RULES_FIELD = new ParseField("detector_rules");
|
public static final ParseField DETECTOR_RULES_FIELD = new ParseField("detector_rules");
|
||||||
|
|
||||||
public static final ObjectParser<Builder, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>("detector", Builder::new);
|
public static final ObjectParser<Builder, Void> PARSER = new ObjectParser<>("detector", Builder::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString(Builder::setDetectorDescription, DETECTOR_DESCRIPTION_FIELD);
|
PARSER.declareString(Builder::setDetectorDescription, DETECTOR_DESCRIPTION_FIELD);
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.cluster.AbstractDiffable;
|
import org.elasticsearch.cluster.AbstractDiffable;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
|
@ -74,7 +73,7 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
|
||||||
|
|
||||||
public static final String ALL = "_all";
|
public static final String ALL = "_all";
|
||||||
|
|
||||||
public static final ObjectParser<Builder, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>("job_details", Builder::new);
|
public static final ObjectParser<Builder, Void> PARSER = new ObjectParser<>("job_details", Builder::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString(Builder::setId, ID);
|
PARSER.declareString(Builder::setId, ID);
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -72,7 +71,7 @@ public class ModelDebugConfig extends ToXContentToBytes implements Writeable {
|
||||||
private static final ParseField BOUNDS_PERCENTILE_FIELD = new ParseField("bounds_percentile");
|
private static final ParseField BOUNDS_PERCENTILE_FIELD = new ParseField("bounds_percentile");
|
||||||
private static final ParseField TERMS_FIELD = new ParseField("terms");
|
private static final ParseField TERMS_FIELD = new ParseField("terms");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<ModelDebugConfig, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<ModelDebugConfig, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
TYPE_FIELD.getPreferredName(), a -> {
|
TYPE_FIELD.getPreferredName(), a -> {
|
||||||
if (a[0] == null) {
|
if (a[0] == null) {
|
||||||
return new ModelDebugConfig((Double) a[1], (String) a[2]);
|
return new ModelDebugConfig((Double) a[1], (String) a[2]);
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -45,7 +44,7 @@ public class ModelSizeStats extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField LOG_TIME_FIELD = new ParseField("log_time");
|
public static final ParseField LOG_TIME_FIELD = new ParseField("log_time");
|
||||||
public static final ParseField TIMESTAMP_FIELD = new ParseField("timestamp");
|
public static final ParseField TIMESTAMP_FIELD = new ParseField("timestamp");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<Builder, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<Builder, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
RESULT_TYPE_FIELD.getPreferredName(), a -> new Builder((String) a[0]));
|
RESULT_TYPE_FIELD.getPreferredName(), a -> new Builder((String) a[0]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,14 +7,13 @@ package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
|
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
|
||||||
import org.elasticsearch.xpack.ml.job.quantiles.Quantiles;
|
import org.elasticsearch.xpack.ml.job.quantiles.Quantiles;
|
||||||
import org.elasticsearch.xpack.ml.utils.time.TimeUtils;
|
import org.elasticsearch.xpack.ml.utils.time.TimeUtils;
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ public class ModelSnapshot extends ToXContentToBytes implements Writeable {
|
||||||
*/
|
*/
|
||||||
public static final ParseField TYPE = new ParseField("model_snapshot");
|
public static final ParseField TYPE = new ParseField("model_snapshot");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<ModelSnapshot, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<ModelSnapshot, Void> PARSER =
|
||||||
new ConstructingObjectParser<>(TYPE.getPreferredName(), a -> new ModelSnapshot((String) a[0]));
|
new ConstructingObjectParser<>(TYPE.getPreferredName(), a -> new ModelSnapshot((String) a[0]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.audit;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -30,7 +29,7 @@ public class AuditActivity extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField RUNNING_DETECTORS = new ParseField("running_detectors");
|
public static final ParseField RUNNING_DETECTORS = new ParseField("running_detectors");
|
||||||
public static final ParseField TIMESTAMP = new ParseField("timestamp");
|
public static final ParseField TIMESTAMP = new ParseField("timestamp");
|
||||||
|
|
||||||
public static final ObjectParser<AuditActivity, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(TYPE.getPreferredName(),
|
public static final ObjectParser<AuditActivity, Void> PARSER = new ObjectParser<>(TYPE.getPreferredName(),
|
||||||
AuditActivity::new);
|
AuditActivity::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.audit;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -30,7 +29,7 @@ public class AuditMessage extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField LEVEL = new ParseField("level");
|
public static final ParseField LEVEL = new ParseField("level");
|
||||||
public static final ParseField TIMESTAMP = new ParseField("timestamp");
|
public static final ParseField TIMESTAMP = new ParseField("timestamp");
|
||||||
|
|
||||||
public static final ObjectParser<AuditMessage, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(TYPE.getPreferredName(),
|
public static final ObjectParser<AuditMessage, Void> PARSER = new ObjectParser<>(TYPE.getPreferredName(),
|
||||||
AuditMessage::new);
|
AuditMessage::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.condition;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -31,7 +30,7 @@ public class Condition extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField CONDITION_FIELD = new ParseField("condition");
|
public static final ParseField CONDITION_FIELD = new ParseField("condition");
|
||||||
public static final ParseField FILTER_VALUE_FIELD = new ParseField("value");
|
public static final ParseField FILTER_VALUE_FIELD = new ParseField("value");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<Condition, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<Condition, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
CONDITION_FIELD.getPreferredName(), a -> new Condition((Operator) a[0], (String) a[1]));
|
CONDITION_FIELD.getPreferredName(), a -> new Condition((Operator) a[0], (String) a[1]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.detectionrules;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -33,7 +32,7 @@ public class DetectionRule extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField CONDITIONS_CONNECTIVE_FIELD = new ParseField("conditions_connective");
|
public static final ParseField CONDITIONS_CONNECTIVE_FIELD = new ParseField("conditions_connective");
|
||||||
public static final ParseField RULE_CONDITIONS_FIELD = new ParseField("rule_conditions");
|
public static final ParseField RULE_CONDITIONS_FIELD = new ParseField("rule_conditions");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<DetectionRule, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<DetectionRule, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
DETECTION_RULE_FIELD.getPreferredName(),
|
DETECTION_RULE_FIELD.getPreferredName(),
|
||||||
arr -> {
|
arr -> {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.elasticsearch.xpack.ml.job.detectionrules;
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -31,7 +30,7 @@ public class RuleCondition extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField FIELD_VALUE_FIELD = new ParseField("field_value");
|
public static final ParseField FIELD_VALUE_FIELD = new ParseField("field_value");
|
||||||
public static final ParseField VALUE_LIST_FIELD = new ParseField("value_list");
|
public static final ParseField VALUE_LIST_FIELD = new ParseField("value_list");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<RuleCondition, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<RuleCondition, Void> PARSER =
|
||||||
new ConstructingObjectParser<>(RULE_CONDITION_FIELD.getPreferredName(),
|
new ConstructingObjectParser<>(RULE_CONDITION_FIELD.getPreferredName(),
|
||||||
a -> new RuleCondition((RuleConditionType) a[0], (String) a[1], (String) a[2], (Condition) a[3], (String) a[4]));
|
a -> new RuleCondition((RuleConditionType) a[0], (String) a[1], (String) a[2], (Condition) a[3], (String) a[4]));
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,12 @@ package org.elasticsearch.xpack.ml.job.logging;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser;
|
import org.elasticsearch.common.xcontent.ObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -37,7 +36,7 @@ public class CppLogMessage extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField FILE_FIELD = new ParseField("file");
|
public static final ParseField FILE_FIELD = new ParseField("file");
|
||||||
public static final ParseField LINE_FIELD = new ParseField("line");
|
public static final ParseField LINE_FIELD = new ParseField("line");
|
||||||
|
|
||||||
public static final ObjectParser<CppLogMessage, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(
|
public static final ObjectParser<CppLogMessage, Void> PARSER = new ObjectParser<>(
|
||||||
LOGGER_FIELD.getPreferredName(), CppLogMessage::new);
|
LOGGER_FIELD.getPreferredName(), CppLogMessage::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.elasticsearch.xpack.ml.job.logging;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.apache.logging.log4j.message.ParameterizedMessage;
|
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
|
@ -169,7 +168,7 @@ public class CppLogMessageHandler implements Closeable {
|
||||||
private void parseMessage(XContent xContent, BytesReference bytesRef) {
|
private void parseMessage(XContent xContent, BytesReference bytesRef) {
|
||||||
try {
|
try {
|
||||||
XContentParser parser = xContent.createParser(NamedXContentRegistry.EMPTY, bytesRef);
|
XContentParser parser = xContent.createParser(NamedXContentRegistry.EMPTY, bytesRef);
|
||||||
CppLogMessage msg = CppLogMessage.PARSER.apply(parser, () -> ParseFieldMatcher.STRICT);
|
CppLogMessage msg = CppLogMessage.PARSER.apply(parser, null);
|
||||||
Level level = Level.getLevel(msg.getLevel());
|
Level level = Level.getLevel(msg.getLevel());
|
||||||
if (level == null) {
|
if (level == null) {
|
||||||
// This isn't expected to ever happen
|
// This isn't expected to ever happen
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.metadata;
|
||||||
|
|
||||||
import org.elasticsearch.cluster.AbstractDiffable;
|
import org.elasticsearch.cluster.AbstractDiffable;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser;
|
import org.elasticsearch.common.xcontent.ObjectParser;
|
||||||
|
@ -28,7 +27,7 @@ public class Allocation extends AbstractDiffable<Allocation> implements ToXConte
|
||||||
public static final ParseField STATUS = new ParseField("status");
|
public static final ParseField STATUS = new ParseField("status");
|
||||||
public static final ParseField STATUS_REASON = new ParseField("status_reason");
|
public static final ParseField STATUS_REASON = new ParseField("status_reason");
|
||||||
|
|
||||||
static final ObjectParser<Builder, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>("allocation", Builder::new);
|
static final ObjectParser<Builder, Void> PARSER = new ObjectParser<>("allocation", Builder::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString(Builder::setNodeId, NODE_ID_FIELD);
|
PARSER.declareString(Builder::setNodeId, NODE_ID_FIELD);
|
||||||
|
|
|
@ -13,7 +13,6 @@ import org.elasticsearch.cluster.DiffableUtils;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -51,7 +50,7 @@ public class MlMetadata implements MetaData.Custom {
|
||||||
public static final MlMetadata EMPTY_METADATA = new MlMetadata(Collections.emptySortedMap(),
|
public static final MlMetadata EMPTY_METADATA = new MlMetadata(Collections.emptySortedMap(),
|
||||||
Collections.emptySortedMap(), Collections.emptySortedMap());
|
Collections.emptySortedMap(), Collections.emptySortedMap());
|
||||||
|
|
||||||
public static final ObjectParser<Builder, ParseFieldMatcherSupplier> ML_METADATA_PARSER = new ObjectParser<>("ml_metadata",
|
public static final ObjectParser<Builder, Void> ML_METADATA_PARSER = new ObjectParser<>("ml_metadata",
|
||||||
Builder::new);
|
Builder::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.persistence;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
|
@ -19,8 +18,8 @@ import java.io.IOException;
|
||||||
|
|
||||||
class ElasticsearchBatchedBucketsIterator extends ElasticsearchBatchedResultsIterator<Bucket> {
|
class ElasticsearchBatchedBucketsIterator extends ElasticsearchBatchedResultsIterator<Bucket> {
|
||||||
|
|
||||||
public ElasticsearchBatchedBucketsIterator(Client client, String jobId, ParseFieldMatcher parseFieldMatcher) {
|
public ElasticsearchBatchedBucketsIterator(Client client, String jobId) {
|
||||||
super(client, jobId, Bucket.RESULT_TYPE_VALUE, parseFieldMatcher);
|
super(client, jobId, Bucket.RESULT_TYPE_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,6 +31,6 @@ class ElasticsearchBatchedBucketsIterator extends ElasticsearchBatchedResultsIte
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("failed to parse bucket", e);
|
throw new ElasticsearchParseException("failed to parse bucket", e);
|
||||||
}
|
}
|
||||||
return Bucket.PARSER.apply(parser, () -> parseFieldMatcher);
|
return Bucket.PARSER.apply(parser, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import org.elasticsearch.action.search.SearchRequest;
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
import org.elasticsearch.action.search.SearchScrollRequest;
|
import org.elasticsearch.action.search.SearchScrollRequest;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.QueryBuilder;
|
||||||
import org.elasticsearch.search.SearchHit;
|
import org.elasticsearch.search.SearchHit;
|
||||||
|
@ -37,28 +36,21 @@ abstract class ElasticsearchBatchedDocumentsIterator<T> implements BatchedDocume
|
||||||
private volatile long totalHits;
|
private volatile long totalHits;
|
||||||
private volatile String scrollId;
|
private volatile String scrollId;
|
||||||
private volatile boolean isScrollInitialised;
|
private volatile boolean isScrollInitialised;
|
||||||
protected ParseFieldMatcher parseFieldMatcher;
|
|
||||||
|
|
||||||
public ElasticsearchBatchedDocumentsIterator(Client client, String index, ParseFieldMatcher parseFieldMatcher) {
|
public ElasticsearchBatchedDocumentsIterator(Client client, String index) {
|
||||||
this.parseFieldMatcher = parseFieldMatcher;
|
this(client, index, new ResultsFilterBuilder());
|
||||||
this.client = Objects.requireNonNull(client);
|
|
||||||
this.index = Objects.requireNonNull(index);
|
|
||||||
this.parseFieldMatcher = Objects.requireNonNull(parseFieldMatcher);
|
|
||||||
totalHits = 0;
|
|
||||||
count = 0;
|
|
||||||
filterBuilder = new ResultsFilterBuilder();
|
|
||||||
isScrollInitialised = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ElasticsearchBatchedDocumentsIterator(Client client, String index, ParseFieldMatcher parseFieldMatcher,
|
protected ElasticsearchBatchedDocumentsIterator(Client client, String index, QueryBuilder queryBuilder) {
|
||||||
QueryBuilder queryBuilder) {
|
this(client, index, new ResultsFilterBuilder(queryBuilder));
|
||||||
this.parseFieldMatcher = parseFieldMatcher;
|
}
|
||||||
|
|
||||||
|
private ElasticsearchBatchedDocumentsIterator(Client client, String index, ResultsFilterBuilder resultsFilterBuilder) {
|
||||||
this.client = Objects.requireNonNull(client);
|
this.client = Objects.requireNonNull(client);
|
||||||
this.index = Objects.requireNonNull(index);
|
this.index = Objects.requireNonNull(index);
|
||||||
this.parseFieldMatcher = Objects.requireNonNull(parseFieldMatcher);
|
|
||||||
totalHits = 0;
|
totalHits = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
filterBuilder = new ResultsFilterBuilder(queryBuilder);
|
filterBuilder = Objects.requireNonNull(resultsFilterBuilder);
|
||||||
isScrollInitialised = false;
|
isScrollInitialised = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.persistence;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||||
|
@ -18,9 +17,8 @@ import org.elasticsearch.xpack.ml.job.results.Influencer;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
class ElasticsearchBatchedInfluencersIterator extends ElasticsearchBatchedResultsIterator<Influencer> {
|
class ElasticsearchBatchedInfluencersIterator extends ElasticsearchBatchedResultsIterator<Influencer> {
|
||||||
public ElasticsearchBatchedInfluencersIterator(Client client, String jobId,
|
public ElasticsearchBatchedInfluencersIterator(Client client, String jobId) {
|
||||||
ParseFieldMatcher parserFieldMatcher) {
|
super(client, jobId, Influencer.RESULT_TYPE_VALUE);
|
||||||
super(client, jobId, Influencer.RESULT_TYPE_VALUE, parserFieldMatcher);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,6 +31,6 @@ class ElasticsearchBatchedInfluencersIterator extends ElasticsearchBatchedResult
|
||||||
throw new ElasticsearchParseException("failed to parser influencer", e);
|
throw new ElasticsearchParseException("failed to parser influencer", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Influencer.PARSER.apply(parser, () -> parseFieldMatcher);
|
return Influencer.PARSER.apply(parser, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,13 @@
|
||||||
package org.elasticsearch.xpack.ml.job.persistence;
|
package org.elasticsearch.xpack.ml.job.persistence;
|
||||||
|
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.index.query.TermsQueryBuilder;
|
import org.elasticsearch.index.query.TermsQueryBuilder;
|
||||||
import org.elasticsearch.xpack.ml.job.results.Result;
|
import org.elasticsearch.xpack.ml.job.results.Result;
|
||||||
|
|
||||||
abstract class ElasticsearchBatchedResultsIterator<T> extends ElasticsearchBatchedDocumentsIterator<T> {
|
abstract class ElasticsearchBatchedResultsIterator<T> extends ElasticsearchBatchedDocumentsIterator<T> {
|
||||||
|
|
||||||
public ElasticsearchBatchedResultsIterator(Client client, String jobId, String resultType, ParseFieldMatcher parseFieldMatcher) {
|
public ElasticsearchBatchedResultsIterator(Client client, String jobId, String resultType) {
|
||||||
super(client, AnomalyDetectorsIndex.jobResultsIndexName(jobId), parseFieldMatcher,
|
super(client, AnomalyDetectorsIndex.jobResultsIndexName(jobId),
|
||||||
new TermsQueryBuilder(Result.RESULT_TYPE.getPreferredName(), resultType));
|
new TermsQueryBuilder(Result.RESULT_TYPE.getPreferredName(), resultType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.support.PlainActionFuture;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||||
import org.elasticsearch.common.CheckedConsumer;
|
import org.elasticsearch.common.CheckedConsumer;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.logging.Loggers;
|
import org.elasticsearch.common.logging.Loggers;
|
||||||
|
@ -118,10 +117,8 @@ public class JobProvider {
|
||||||
|
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final int numberOfReplicas;
|
private final int numberOfReplicas;
|
||||||
private final ParseFieldMatcher parseFieldMatcher;
|
|
||||||
|
|
||||||
public JobProvider(Client client, int numberOfReplicas, ParseFieldMatcher parseFieldMatcher) {
|
public JobProvider(Client client, int numberOfReplicas) {
|
||||||
this.parseFieldMatcher = parseFieldMatcher;
|
|
||||||
this.client = Objects.requireNonNull(client);
|
this.client = Objects.requireNonNull(client);
|
||||||
this.numberOfReplicas = numberOfReplicas;
|
this.numberOfReplicas = numberOfReplicas;
|
||||||
}
|
}
|
||||||
|
@ -297,7 +294,7 @@ public class JobProvider {
|
||||||
} else {
|
} else {
|
||||||
BytesReference source = response.getSourceAsBytesRef();
|
BytesReference source = response.getSourceAsBytesRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
handler.accept(DataCounts.PARSER.apply(parser, () -> parseFieldMatcher));
|
handler.accept(DataCounts.PARSER.apply(parser, null));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("failed to parse bucket", e);
|
throw new ElasticsearchParseException("failed to parse bucket", e);
|
||||||
}
|
}
|
||||||
|
@ -376,7 +373,7 @@ public class JobProvider {
|
||||||
for (SearchHit hit : hits.getHits()) {
|
for (SearchHit hit : hits.getHits()) {
|
||||||
BytesReference source = hit.getSourceRef();
|
BytesReference source = hit.getSourceRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
Bucket bucket = Bucket.PARSER.apply(parser, () -> parseFieldMatcher);
|
Bucket bucket = Bucket.PARSER.apply(parser, null);
|
||||||
if (query.isIncludeInterim() || bucket.isInterim() == false) {
|
if (query.isIncludeInterim() || bucket.isInterim() == false) {
|
||||||
results.add(bucket);
|
results.add(bucket);
|
||||||
}
|
}
|
||||||
|
@ -477,7 +474,7 @@ public class JobProvider {
|
||||||
for (SearchHit hit : searchResponse.getHits().getHits()) {
|
for (SearchHit hit : searchResponse.getHits().getHits()) {
|
||||||
BytesReference source = hit.getSourceRef();
|
BytesReference source = hit.getSourceRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
results.add(PerPartitionMaxProbabilities.PARSER.apply(parser, () -> parseFieldMatcher));
|
results.add(PerPartitionMaxProbabilities.PARSER.apply(parser, null));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("failed to parse PerPartitionMaxProbabilities", e);
|
throw new ElasticsearchParseException("failed to parse PerPartitionMaxProbabilities", e);
|
||||||
}
|
}
|
||||||
|
@ -493,7 +490,7 @@ public class JobProvider {
|
||||||
* @return a bucket {@link BatchedDocumentsIterator}
|
* @return a bucket {@link BatchedDocumentsIterator}
|
||||||
*/
|
*/
|
||||||
public BatchedDocumentsIterator<Bucket> newBatchedBucketsIterator(String jobId) {
|
public BatchedDocumentsIterator<Bucket> newBatchedBucketsIterator(String jobId) {
|
||||||
return new ElasticsearchBatchedBucketsIterator(client, jobId, parseFieldMatcher);
|
return new ElasticsearchBatchedBucketsIterator(client, jobId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -611,7 +608,7 @@ public class JobProvider {
|
||||||
for (SearchHit hit : hits) {
|
for (SearchHit hit : hits) {
|
||||||
BytesReference source = hit.getSourceRef();
|
BytesReference source = hit.getSourceRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
CategoryDefinition categoryDefinition = CategoryDefinition.PARSER.apply(parser, () -> parseFieldMatcher);
|
CategoryDefinition categoryDefinition = CategoryDefinition.PARSER.apply(parser, null);
|
||||||
results.add(categoryDefinition);
|
results.add(categoryDefinition);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("failed to parse category definition", e);
|
throw new ElasticsearchParseException("failed to parse category definition", e);
|
||||||
|
@ -685,7 +682,7 @@ public class JobProvider {
|
||||||
for (SearchHit hit : searchResponse.getHits().getHits()) {
|
for (SearchHit hit : searchResponse.getHits().getHits()) {
|
||||||
BytesReference source = hit.getSourceRef();
|
BytesReference source = hit.getSourceRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
results.add(AnomalyRecord.PARSER.apply(parser, () -> parseFieldMatcher));
|
results.add(AnomalyRecord.PARSER.apply(parser, null));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("failed to parse records", e);
|
throw new ElasticsearchParseException("failed to parse records", e);
|
||||||
}
|
}
|
||||||
|
@ -739,7 +736,7 @@ public class JobProvider {
|
||||||
for (SearchHit hit : response.getHits().getHits()) {
|
for (SearchHit hit : response.getHits().getHits()) {
|
||||||
BytesReference source = hit.getSourceRef();
|
BytesReference source = hit.getSourceRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
influencers.add(Influencer.PARSER.apply(parser, () -> parseFieldMatcher));
|
influencers.add(Influencer.PARSER.apply(parser, null));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("failed to parse influencer", e);
|
throw new ElasticsearchParseException("failed to parse influencer", e);
|
||||||
}
|
}
|
||||||
|
@ -757,7 +754,7 @@ public class JobProvider {
|
||||||
* @return an influencer {@link BatchedDocumentsIterator}
|
* @return an influencer {@link BatchedDocumentsIterator}
|
||||||
*/
|
*/
|
||||||
public BatchedDocumentsIterator<Influencer> newBatchedInfluencersIterator(String jobId) {
|
public BatchedDocumentsIterator<Influencer> newBatchedInfluencersIterator(String jobId) {
|
||||||
return new ElasticsearchBatchedInfluencersIterator(client, jobId, parseFieldMatcher);
|
return new ElasticsearchBatchedInfluencersIterator(client, jobId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -778,7 +775,7 @@ public class JobProvider {
|
||||||
}
|
}
|
||||||
BytesReference source = response.getSourceAsBytesRef();
|
BytesReference source = response.getSourceAsBytesRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
Quantiles quantiles = Quantiles.PARSER.apply(parser, () -> parseFieldMatcher);
|
Quantiles quantiles = Quantiles.PARSER.apply(parser, null);
|
||||||
if (quantiles.getQuantileState() == null) {
|
if (quantiles.getQuantileState() == null) {
|
||||||
LOGGER.error("Inconsistency - no " + Quantiles.QUANTILE_STATE
|
LOGGER.error("Inconsistency - no " + Quantiles.QUANTILE_STATE
|
||||||
+ " field in quantiles for job " + jobId);
|
+ " field in quantiles for job " + jobId);
|
||||||
|
@ -883,7 +880,7 @@ public class JobProvider {
|
||||||
for (SearchHit hit : searchResponse.getHits().getHits()) {
|
for (SearchHit hit : searchResponse.getHits().getHits()) {
|
||||||
BytesReference source = hit.getSourceRef();
|
BytesReference source = hit.getSourceRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
ModelSnapshot modelSnapshot = ModelSnapshot.PARSER.apply(parser, () -> parseFieldMatcher);
|
ModelSnapshot modelSnapshot = ModelSnapshot.PARSER.apply(parser, null);
|
||||||
results.add(modelSnapshot);
|
results.add(modelSnapshot);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("failed to parse modelSnapshot", e);
|
throw new ElasticsearchParseException("failed to parse modelSnapshot", e);
|
||||||
|
@ -982,7 +979,7 @@ public class JobProvider {
|
||||||
for (SearchHit hit : searchResponse.getHits().getHits()) {
|
for (SearchHit hit : searchResponse.getHits().getHits()) {
|
||||||
BytesReference source = hit.getSourceRef();
|
BytesReference source = hit.getSourceRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
ModelDebugOutput modelDebugOutput = ModelDebugOutput.PARSER.apply(parser, () -> parseFieldMatcher);
|
ModelDebugOutput modelDebugOutput = ModelDebugOutput.PARSER.apply(parser, null);
|
||||||
results.add(modelDebugOutput);
|
results.add(modelDebugOutput);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("failed to parse modelDebugOutput", e);
|
throw new ElasticsearchParseException("failed to parse modelDebugOutput", e);
|
||||||
|
@ -1006,7 +1003,7 @@ public class JobProvider {
|
||||||
if (response.isExists()) {
|
if (response.isExists()) {
|
||||||
BytesReference source = response.getSourceAsBytesRef();
|
BytesReference source = response.getSourceAsBytesRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
ModelSizeStats modelSizeStats = ModelSizeStats.PARSER.apply(parser, () -> parseFieldMatcher).build();
|
ModelSizeStats modelSizeStats = ModelSizeStats.PARSER.apply(parser, null).build();
|
||||||
handler.accept(modelSizeStats);
|
handler.accept(modelSizeStats);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("failed to parse model size stats", e);
|
throw new ElasticsearchParseException("failed to parse model size stats", e);
|
||||||
|
@ -1040,7 +1037,7 @@ public class JobProvider {
|
||||||
}
|
}
|
||||||
BytesReference source = response.getSourceAsBytesRef();
|
BytesReference source = response.getSourceAsBytesRef();
|
||||||
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
try (XContentParser parser = XContentFactory.xContent(source).createParser(NamedXContentRegistry.EMPTY, source)) {
|
||||||
ListDocument listDocument = ListDocument.PARSER.apply(parser, () -> parseFieldMatcher);
|
ListDocument listDocument = ListDocument.PARSER.apply(parser, null);
|
||||||
return Optional.of(listDocument);
|
return Optional.of(listDocument);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ElasticsearchParseException("failed to parse list", e);
|
throw new ElasticsearchParseException("failed to parse list", e);
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
package org.elasticsearch.xpack.ml.job.process.autodetect.output;
|
package org.elasticsearch.xpack.ml.job.process.autodetect.output;
|
||||||
|
|
||||||
import org.elasticsearch.ElasticsearchParseException;
|
import org.elasticsearch.ElasticsearchParseException;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.component.AbstractComponent;
|
import org.elasticsearch.common.component.AbstractComponent;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
|
@ -32,11 +31,8 @@ import java.util.stream.StreamSupport;
|
||||||
*/
|
*/
|
||||||
public class AutodetectResultsParser extends AbstractComponent {
|
public class AutodetectResultsParser extends AbstractComponent {
|
||||||
|
|
||||||
private final ParseFieldMatcherSupplier parseFieldMatcherSupplier;
|
public AutodetectResultsParser(Settings settings) {
|
||||||
|
|
||||||
public AutodetectResultsParser(Settings settings, ParseFieldMatcherSupplier parseFieldMatcherSupplier) {
|
|
||||||
super(settings);
|
super(settings);
|
||||||
this.parseFieldMatcherSupplier = parseFieldMatcherSupplier;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream<AutodetectResult> parseResults(InputStream in) throws ElasticsearchParseException {
|
public Stream<AutodetectResult> parseResults(InputStream in) throws ElasticsearchParseException {
|
||||||
|
@ -100,10 +96,8 @@ public class AutodetectResultsParser extends AbstractComponent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AutodetectResult next() {
|
public AutodetectResult next() {
|
||||||
return AutodetectResult.PARSER.apply(parser, parseFieldMatcherSupplier);
|
return AutodetectResult.PARSER.apply(parser, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.process.autodetect.output;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -27,7 +26,7 @@ public class FlushAcknowledgement extends ToXContentToBytes implements Writeable
|
||||||
public static final ParseField TYPE = new ParseField("flush");
|
public static final ParseField TYPE = new ParseField("flush");
|
||||||
public static final ParseField ID = new ParseField("id");
|
public static final ParseField ID = new ParseField("id");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<FlushAcknowledgement, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<FlushAcknowledgement, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
TYPE.getPreferredName(), a -> new FlushAcknowledgement((String) a[0]));
|
TYPE.getPreferredName(), a -> new FlushAcknowledgement((String) a[0]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.process.normalizer;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -32,7 +31,7 @@ public class NormalizerResult extends ToXContentToBytes implements Writeable {
|
||||||
static final ParseField PROBABILITY_FIELD = new ParseField("probability");
|
static final ParseField PROBABILITY_FIELD = new ParseField("probability");
|
||||||
static final ParseField NORMALIZED_SCORE_FIELD = new ParseField("normalized_score");
|
static final ParseField NORMALIZED_SCORE_FIELD = new ParseField("normalized_score");
|
||||||
|
|
||||||
public static final ObjectParser<NormalizerResult, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(
|
public static final ObjectParser<NormalizerResult, Void> PARSER = new ObjectParser<>(
|
||||||
LEVEL_FIELD.getPreferredName(), NormalizerResult::new);
|
LEVEL_FIELD.getPreferredName(), NormalizerResult::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.job.process.normalizer.output;
|
package org.elasticsearch.xpack.ml.job.process.normalizer.output;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.bytes.BytesReference;
|
import org.elasticsearch.common.bytes.BytesReference;
|
||||||
import org.elasticsearch.common.bytes.CompositeBytesReference;
|
import org.elasticsearch.common.bytes.CompositeBytesReference;
|
||||||
|
@ -81,7 +80,7 @@ public class NormalizerResultHandler extends AbstractComponent {
|
||||||
|
|
||||||
private void parseResult(XContent xContent, BytesReference bytesRef) throws IOException {
|
private void parseResult(XContent xContent, BytesReference bytesRef) throws IOException {
|
||||||
XContentParser parser = xContent.createParser(NamedXContentRegistry.EMPTY, bytesRef);
|
XContentParser parser = xContent.createParser(NamedXContentRegistry.EMPTY, bytesRef);
|
||||||
NormalizerResult result = NormalizerResult.PARSER.apply(parser, () -> ParseFieldMatcher.STRICT);
|
NormalizerResult result = NormalizerResult.PARSER.apply(parser, null);
|
||||||
normalizedResults.add(result);
|
normalizedResults.add(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.quantiles;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -36,7 +35,7 @@ public class Quantiles extends ToXContentToBytes implements Writeable {
|
||||||
*/
|
*/
|
||||||
public static final ParseField TYPE = new ParseField("quantiles");
|
public static final ParseField TYPE = new ParseField("quantiles");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<Quantiles, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<Quantiles, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
TYPE.getPreferredName(), a -> new Quantiles((String) a[0], (Date) a[1], (String) a[2]));
|
TYPE.getPreferredName(), a -> new Quantiles((String) a[0], (Date) a[1], (String) a[2]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,12 +7,12 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser;
|
import org.elasticsearch.common.xcontent.ObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -45,7 +45,7 @@ public class AnomalyCause extends ToXContentToBytes implements Writeable {
|
||||||
*/
|
*/
|
||||||
public static final ParseField FIELD_NAME = new ParseField("field_name");
|
public static final ParseField FIELD_NAME = new ParseField("field_name");
|
||||||
|
|
||||||
public static final ObjectParser<AnomalyCause, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>(ANOMALY_CAUSE.getPreferredName(),
|
public static final ObjectParser<AnomalyCause, Void> PARSER = new ObjectParser<>(ANOMALY_CAUSE.getPreferredName(),
|
||||||
AnomalyCause::new);
|
AnomalyCause::new);
|
||||||
static {
|
static {
|
||||||
PARSER.declareDouble(AnomalyCause::setProbability, PROBABILITY);
|
PARSER.declareDouble(AnomalyCause::setProbability, PROBABILITY);
|
||||||
|
|
|
@ -7,13 +7,12 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
||||||
import org.elasticsearch.xpack.ml.job.Job;
|
import org.elasticsearch.xpack.ml.job.Job;
|
||||||
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
||||||
|
@ -78,7 +77,7 @@ public class AnomalyRecord extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField NORMALIZED_PROBABILITY = new ParseField("normalized_probability");
|
public static final ParseField NORMALIZED_PROBABILITY = new ParseField("normalized_probability");
|
||||||
public static final ParseField INITIAL_NORMALIZED_PROBABILITY = new ParseField("initial_normalized_probability");
|
public static final ParseField INITIAL_NORMALIZED_PROBABILITY = new ParseField("initial_normalized_probability");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<AnomalyRecord, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<AnomalyRecord, Void> PARSER =
|
||||||
new ConstructingObjectParser<>(RESULT_TYPE_VALUE, a -> new AnomalyRecord((String) a[0], (Date) a[1], (long) a[2], (int) a[3]));
|
new ConstructingObjectParser<>(RESULT_TYPE_VALUE, a -> new AnomalyRecord((String) a[0], (Date) a[1], (long) a[2], (int) a[3]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -28,7 +27,7 @@ public class AutodetectResult extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField TYPE = new ParseField("autodetect_result");
|
public static final ParseField TYPE = new ParseField("autodetect_result");
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static final ConstructingObjectParser<AutodetectResult, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<AutodetectResult, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
TYPE.getPreferredName(), a -> new AutodetectResult((Bucket) a[0], (List<AnomalyRecord>) a[1], (List<Influencer>) a[2],
|
TYPE.getPreferredName(), a -> new AutodetectResult((Bucket) a[0], (List<AnomalyRecord>) a[1], (List<Influencer>) a[2],
|
||||||
(Quantiles) a[3], (ModelSnapshot) a[4], a[5] == null ? null : ((ModelSizeStats.Builder) a[5]).build(),
|
(Quantiles) a[3], (ModelSnapshot) a[4], a[5] == null ? null : ((ModelSizeStats.Builder) a[5]).build(),
|
||||||
(ModelDebugOutput) a[6], (CategoryDefinition) a[7], (FlushAcknowledgement) a[8]));
|
(ModelDebugOutput) a[6], (CategoryDefinition) a[7], (FlushAcknowledgement) a[8]));
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -59,7 +58,7 @@ public class Bucket extends ToXContentToBytes implements Writeable {
|
||||||
public static final String RESULT_TYPE_VALUE = "bucket";
|
public static final String RESULT_TYPE_VALUE = "bucket";
|
||||||
public static final ParseField RESULT_TYPE_FIELD = new ParseField(RESULT_TYPE_VALUE);
|
public static final ParseField RESULT_TYPE_FIELD = new ParseField(RESULT_TYPE_VALUE);
|
||||||
|
|
||||||
public static final ConstructingObjectParser<Bucket, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<Bucket, Void> PARSER =
|
||||||
new ConstructingObjectParser<>(RESULT_TYPE_VALUE, a -> new Bucket((String) a[0], (Date) a[1], (long) a[2]));
|
new ConstructingObjectParser<>(RESULT_TYPE_VALUE, a -> new Bucket((String) a[0], (Date) a[1], (long) a[2]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,14 +7,13 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
||||||
import org.elasticsearch.xpack.ml.job.Job;
|
import org.elasticsearch.xpack.ml.job.Job;
|
||||||
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
||||||
import org.elasticsearch.xpack.ml.utils.time.TimeUtils;
|
import org.elasticsearch.xpack.ml.utils.time.TimeUtils;
|
||||||
|
@ -48,7 +47,7 @@ public class BucketInfluencer extends ToXContentToBytes implements Writeable {
|
||||||
*/
|
*/
|
||||||
public static final String BUCKET_TIME = "bucket_time";
|
public static final String BUCKET_TIME = "bucket_time";
|
||||||
|
|
||||||
public static final ConstructingObjectParser<BucketInfluencer, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<BucketInfluencer, Void> PARSER =
|
||||||
new ConstructingObjectParser<>(RESULT_TYPE_FIELD.getPreferredName(), a -> new BucketInfluencer((String) a[0],
|
new ConstructingObjectParser<>(RESULT_TYPE_FIELD.getPreferredName(), a -> new BucketInfluencer((String) a[0],
|
||||||
(Date) a[1], (long) a[2], (int) a[3]));
|
(Date) a[1], (long) a[2], (int) a[3]));
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -35,7 +34,7 @@ public class CategoryDefinition extends ToXContentToBytes implements Writeable {
|
||||||
// Used for QueryPage
|
// Used for QueryPage
|
||||||
public static final ParseField RESULTS_FIELD = new ParseField("categories");
|
public static final ParseField RESULTS_FIELD = new ParseField("categories");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<CategoryDefinition, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<CategoryDefinition, Void> PARSER =
|
||||||
new ConstructingObjectParser<>(TYPE.getPreferredName(), a -> new CategoryDefinition((String) a[0]));
|
new ConstructingObjectParser<>(TYPE.getPreferredName(), a -> new CategoryDefinition((String) a[0]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,12 +7,12 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -31,7 +31,7 @@ public class Influence extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField INFLUENCER_FIELD_VALUES = new ParseField("influencer_field_values");
|
public static final ParseField INFLUENCER_FIELD_VALUES = new ParseField("influencer_field_values");
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static final ConstructingObjectParser<Influence, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<Influence, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
INFLUENCER.getPreferredName(), a -> new Influence((String) a[0], (List<String>) a[1]));
|
INFLUENCER.getPreferredName(), a -> new Influence((String) a[0], (List<String>) a[1]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,17 +7,16 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
||||||
import org.elasticsearch.xpack.ml.job.Job;
|
import org.elasticsearch.xpack.ml.job.Job;
|
||||||
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
import org.elasticsearch.xpack.ml.utils.ExceptionsHelper;
|
||||||
import org.elasticsearch.xpack.ml.utils.time.TimeUtils;
|
import org.elasticsearch.xpack.ml.utils.time.TimeUtils;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -45,7 +44,7 @@ public class Influencer extends ToXContentToBytes implements Writeable {
|
||||||
// Used for QueryPage
|
// Used for QueryPage
|
||||||
public static final ParseField RESULTS_FIELD = new ParseField("influencers");
|
public static final ParseField RESULTS_FIELD = new ParseField("influencers");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<Influencer, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<Influencer, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
RESULT_TYPE_FIELD.getPreferredName(), a -> new Influencer((String) a[0], (String) a[1], (String) a[2],
|
RESULT_TYPE_FIELD.getPreferredName(), a -> new Influencer((String) a[0], (String) a[1], (String) a[2],
|
||||||
(Date) a[3], (long) a[4], (int) a[5]));
|
(Date) a[3], (long) a[4], (int) a[5]));
|
||||||
|
|
||||||
|
|
|
@ -7,16 +7,16 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
import org.elasticsearch.common.xcontent.ObjectParser.ValueType;
|
||||||
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
import org.elasticsearch.common.xcontent.XContentParser.Token;
|
||||||
import org.elasticsearch.xpack.ml.job.Job;
|
import org.elasticsearch.xpack.ml.job.Job;
|
||||||
import org.elasticsearch.xpack.ml.utils.time.TimeUtils;
|
import org.elasticsearch.xpack.ml.utils.time.TimeUtils;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -47,7 +47,7 @@ public class ModelDebugOutput extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField DEBUG_MEDIAN = new ParseField("debug_median");
|
public static final ParseField DEBUG_MEDIAN = new ParseField("debug_median");
|
||||||
public static final ParseField ACTUAL = new ParseField("actual");
|
public static final ParseField ACTUAL = new ParseField("actual");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<ModelDebugOutput, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<ModelDebugOutput, Void> PARSER =
|
||||||
new ConstructingObjectParser<>(RESULT_TYPE_VALUE, a -> new ModelDebugOutput((String) a[0]));
|
new ConstructingObjectParser<>(RESULT_TYPE_VALUE, a -> new ModelDebugOutput((String) a[0]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -27,7 +26,7 @@ public class PageParams extends ToXContentToBytes implements Writeable {
|
||||||
public static final int DEFAULT_SIZE = 100;
|
public static final int DEFAULT_SIZE = 100;
|
||||||
|
|
||||||
|
|
||||||
public static final ConstructingObjectParser<PageParams, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<PageParams, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
PAGE.getPreferredName(), a -> new PageParams((int) a[0], (int) a[1]));
|
PAGE.getPreferredName(), a -> new PageParams((int) a[0], (int) a[1]));
|
||||||
|
|
||||||
public static final int MAX_FROM_SIZE_SUM = 10000;
|
public static final int MAX_FROM_SIZE_SUM = 10000;
|
||||||
|
|
|
@ -7,12 +7,12 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class PartitionScore extends ToXContentToBytes implements Writeable {
|
||||||
private double probability;
|
private double probability;
|
||||||
private boolean hadBigNormalizedUpdate;
|
private boolean hadBigNormalizedUpdate;
|
||||||
|
|
||||||
public static final ConstructingObjectParser<PartitionScore, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<PartitionScore, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
PARTITION_SCORE.getPreferredName(), a -> new PartitionScore((String) a[0], (String) a[1], (Double) a[2], (Double) a[3],
|
PARTITION_SCORE.getPreferredName(), a -> new PartitionScore((String) a[0], (String) a[1], (Double) a[2], (Double) a[3],
|
||||||
(Double) a[4]));
|
(Double) a[4]));
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.results;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -46,7 +45,7 @@ public class PerPartitionMaxProbabilities extends ToXContentToBytes implements W
|
||||||
public static final ParseField PER_PARTITION_MAX_PROBABILITIES = new ParseField("per_partition_max_probabilities");
|
public static final ParseField PER_PARTITION_MAX_PROBABILITIES = new ParseField("per_partition_max_probabilities");
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static final ConstructingObjectParser<PerPartitionMaxProbabilities, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<PerPartitionMaxProbabilities, Void> PARSER =
|
||||||
new ConstructingObjectParser<>(RESULT_TYPE_VALUE, a ->
|
new ConstructingObjectParser<>(RESULT_TYPE_VALUE, a ->
|
||||||
new PerPartitionMaxProbabilities((String) a[0], (Date) a[1], (long) a[2], (List<PartitionProbability>) a[3]));
|
new PerPartitionMaxProbabilities((String) a[0], (Date) a[1], (long) a[2], (List<PartitionProbability>) a[3]));
|
||||||
|
|
||||||
|
@ -205,7 +204,7 @@ public class PerPartitionMaxProbabilities extends ToXContentToBytes implements W
|
||||||
*/
|
*/
|
||||||
public static class PartitionProbability extends ToXContentToBytes implements Writeable {
|
public static class PartitionProbability extends ToXContentToBytes implements Writeable {
|
||||||
|
|
||||||
public static final ConstructingObjectParser<PartitionProbability, ParseFieldMatcherSupplier> PARSER =
|
public static final ConstructingObjectParser<PartitionProbability, Void> PARSER =
|
||||||
new ConstructingObjectParser<>("partitionProbability",
|
new ConstructingObjectParser<>("partitionProbability",
|
||||||
a -> new PartitionProbability((String) a[0], (double) a[1]));
|
a -> new PartitionProbability((String) a[0], (double) a[1]));
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.transform;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -33,7 +32,7 @@ public class TransformConfig extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField INPUTS = new ParseField("inputs");
|
public static final ParseField INPUTS = new ParseField("inputs");
|
||||||
public static final ParseField OUTPUTS = new ParseField("outputs");
|
public static final ParseField OUTPUTS = new ParseField("outputs");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<TransformConfig, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<TransformConfig, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
TYPE.getPreferredName(), objects -> new TransformConfig((String) objects[0]));
|
TYPE.getPreferredName(), objects -> new TransformConfig((String) objects[0]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.job.transform;
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -28,7 +27,7 @@ public class TransformConfigs extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField TRANSFORMS = new ParseField("transforms");
|
public static final ParseField TRANSFORMS = new ParseField("transforms");
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static final ConstructingObjectParser<TransformConfigs, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<TransformConfigs, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
TRANSFORMS.getPreferredName(), a -> new TransformConfigs((List<TransformConfig>) a[0]));
|
TRANSFORMS.getPreferredName(), a -> new TransformConfigs((List<TransformConfig>) a[0]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -5,21 +5,20 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.lists;
|
package org.elasticsearch.xpack.ml.lists;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ListDocument extends ToXContentToBytes implements Writeable {
|
public class ListDocument extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField TYPE = new ParseField("list");
|
public static final ParseField TYPE = new ParseField("list");
|
||||||
public static final ParseField ID = new ParseField("id");
|
public static final ParseField ID = new ParseField("id");
|
||||||
|
@ -29,7 +28,7 @@ public class ListDocument extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField RESULTS_FIELD = new ParseField("lists");
|
public static final ParseField RESULTS_FIELD = new ParseField("lists");
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static final ConstructingObjectParser<ListDocument, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>(
|
public static final ConstructingObjectParser<ListDocument, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
TYPE.getPreferredName(), a -> new ListDocument((String) a[0], (List<String>) a[1]));
|
TYPE.getPreferredName(), a -> new ListDocument((String) a[0], (List<String>) a[1]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class RestFlushJobAction extends BaseRestHandler {
|
||||||
final FlushJobAction.Request request;
|
final FlushJobAction.Request request;
|
||||||
if (restRequest.hasContentOrSourceParam()) {
|
if (restRequest.hasContentOrSourceParam()) {
|
||||||
XContentParser parser = restRequest.contentOrSourceParamParser();
|
XContentParser parser = restRequest.contentOrSourceParamParser();
|
||||||
request = FlushJobAction.Request.parseRequest(jobId, parser, () -> parseFieldMatcher);
|
request = FlushJobAction.Request.parseRequest(jobId, parser);
|
||||||
} else {
|
} else {
|
||||||
request = new FlushJobAction.Request(restRequest.param(Job.ID.getPreferredName()));
|
request = new FlushJobAction.Request(restRequest.param(Job.ID.getPreferredName()));
|
||||||
request.setCalcInterim(restRequest.paramAsBoolean(FlushJobAction.Request.CALC_INTERIM.getPreferredName(),
|
request.setCalcInterim(restRequest.paramAsBoolean(FlushJobAction.Request.CALC_INTERIM.getPreferredName(),
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class RestPutJobAction extends BaseRestHandler {
|
||||||
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
||||||
String jobId = restRequest.param(Job.ID.getPreferredName());
|
String jobId = restRequest.param(Job.ID.getPreferredName());
|
||||||
XContentParser parser = restRequest.contentParser();
|
XContentParser parser = restRequest.contentParser();
|
||||||
PutJobAction.Request putJobRequest = PutJobAction.Request.parseRequest(jobId, parser, () -> parseFieldMatcher);
|
PutJobAction.Request putJobRequest = PutJobAction.Request.parseRequest(jobId, parser);
|
||||||
boolean overwrite = restRequest.paramAsBoolean("overwrite", false);
|
boolean overwrite = restRequest.paramAsBoolean("overwrite", false);
|
||||||
putJobRequest.setOverwrite(overwrite);
|
putJobRequest.setOverwrite(overwrite);
|
||||||
return channel -> transportPutJobAction.execute(putJobRequest, new RestToXContentListener<>(channel));
|
return channel -> transportPutJobAction.execute(putJobRequest, new RestToXContentListener<>(channel));
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class RestPutListAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
||||||
XContentParser parser = restRequest.contentOrSourceParamParser();
|
XContentParser parser = restRequest.contentOrSourceParamParser();
|
||||||
PutListAction.Request putListRequest = PutListAction.Request.parseRequest(parser, () -> parseFieldMatcher);
|
PutListAction.Request putListRequest = PutListAction.Request.parseRequest(parser);
|
||||||
return channel -> transportCreateListAction.execute(putListRequest, new AcknowledgedRestListener<>(channel));
|
return channel -> transportCreateListAction.execute(putListRequest, new AcknowledgedRestListener<>(channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class RestGetModelSnapshotsAction extends BaseRestHandler {
|
||||||
Request getModelSnapshots;
|
Request getModelSnapshots;
|
||||||
if (restRequest.hasContentOrSourceParam()) {
|
if (restRequest.hasContentOrSourceParam()) {
|
||||||
XContentParser parser = restRequest.contentOrSourceParamParser();
|
XContentParser parser = restRequest.contentOrSourceParamParser();
|
||||||
getModelSnapshots = Request.parseRequest(jobId, parser, () -> parseFieldMatcher);
|
getModelSnapshots = Request.parseRequest(jobId, parser);
|
||||||
} else {
|
} else {
|
||||||
getModelSnapshots = new Request(jobId);
|
getModelSnapshots = new Request(jobId);
|
||||||
getModelSnapshots.setSort(restRequest.param(Request.SORT.getPreferredName(), DEFAULT_SORT));
|
getModelSnapshots.setSort(restRequest.param(Request.SORT.getPreferredName(), DEFAULT_SORT));
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class RestRevertModelSnapshotAction extends BaseRestHandler {
|
||||||
RevertModelSnapshotAction.Request request;
|
RevertModelSnapshotAction.Request request;
|
||||||
if (restRequest.hasContentOrSourceParam()) {
|
if (restRequest.hasContentOrSourceParam()) {
|
||||||
XContentParser parser = restRequest.contentOrSourceParamParser();
|
XContentParser parser = restRequest.contentOrSourceParamParser();
|
||||||
request = RevertModelSnapshotAction.Request.parseRequest(jobId, parser, () -> parseFieldMatcher);
|
request = RevertModelSnapshotAction.Request.parseRequest(jobId, parser);
|
||||||
} else {
|
} else {
|
||||||
request = new RevertModelSnapshotAction.Request(jobId);
|
request = new RevertModelSnapshotAction.Request(jobId);
|
||||||
request.setTime(restRequest.param(RevertModelSnapshotAction.Request.TIME.getPreferredName(), TIME_DEFAULT));
|
request.setTime(restRequest.param(RevertModelSnapshotAction.Request.TIME.getPreferredName(), TIME_DEFAULT));
|
||||||
|
|
|
@ -41,8 +41,7 @@ public class RestUpdateModelSnapshotAction extends BaseRestHandler {
|
||||||
UpdateModelSnapshotAction.Request getModelSnapshots = UpdateModelSnapshotAction.Request.parseRequest(
|
UpdateModelSnapshotAction.Request getModelSnapshots = UpdateModelSnapshotAction.Request.parseRequest(
|
||||||
restRequest.param(Job.ID.getPreferredName()),
|
restRequest.param(Job.ID.getPreferredName()),
|
||||||
restRequest.param(ModelSnapshot.SNAPSHOT_ID.getPreferredName()),
|
restRequest.param(ModelSnapshot.SNAPSHOT_ID.getPreferredName()),
|
||||||
parser, () -> parseFieldMatcher
|
parser);
|
||||||
);
|
|
||||||
|
|
||||||
return channel -> transportAction.execute(getModelSnapshots, new RestStatusToXContentListener<>(channel));
|
return channel -> transportAction.execute(getModelSnapshots, new RestStatusToXContentListener<>(channel));
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class RestGetBucketsAction extends BaseRestHandler {
|
||||||
final GetBucketsAction.Request request;
|
final GetBucketsAction.Request request;
|
||||||
if (restRequest.hasContent()) {
|
if (restRequest.hasContent()) {
|
||||||
XContentParser parser = restRequest.contentParser();
|
XContentParser parser = restRequest.contentParser();
|
||||||
request = GetBucketsAction.Request.parseRequest(jobId, parser, () -> parseFieldMatcher);
|
request = GetBucketsAction.Request.parseRequest(jobId, parser);
|
||||||
} else {
|
} else {
|
||||||
request = new GetBucketsAction.Request(jobId);
|
request = new GetBucketsAction.Request(jobId);
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class RestGetCategoriesAction extends BaseRestHandler {
|
||||||
|
|
||||||
if (bodyBytes != null && bodyBytes.length() > 0) {
|
if (bodyBytes != null && bodyBytes.length() > 0) {
|
||||||
XContentParser parser = restRequest.contentParser();
|
XContentParser parser = restRequest.contentParser();
|
||||||
request = GetCategoriesDefinitionAction.Request.parseRequest(jobId, parser, () -> parseFieldMatcher);
|
request = GetCategoriesDefinitionAction.Request.parseRequest(jobId, parser);
|
||||||
request.setCategoryId(categoryId);
|
request.setCategoryId(categoryId);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class RestGetInfluencersAction extends BaseRestHandler {
|
||||||
final GetInfluencersAction.Request request;
|
final GetInfluencersAction.Request request;
|
||||||
if (restRequest.hasContent()) {
|
if (restRequest.hasContent()) {
|
||||||
XContentParser parser = restRequest.contentParser();
|
XContentParser parser = restRequest.contentParser();
|
||||||
request = GetInfluencersAction.Request.parseRequest(jobId, parser, () -> parseFieldMatcher);
|
request = GetInfluencersAction.Request.parseRequest(jobId, parser);
|
||||||
} else {
|
} else {
|
||||||
request = new GetInfluencersAction.Request(jobId);
|
request = new GetInfluencersAction.Request(jobId);
|
||||||
request.setStart(start);
|
request.setStart(start);
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class RestGetRecordsAction extends BaseRestHandler {
|
||||||
final GetRecordsAction.Request request;
|
final GetRecordsAction.Request request;
|
||||||
if (restRequest.hasContent()) {
|
if (restRequest.hasContent()) {
|
||||||
XContentParser parser = restRequest.contentParser();
|
XContentParser parser = restRequest.contentParser();
|
||||||
request = GetRecordsAction.Request.parseRequest(jobId, parser, () -> parseFieldMatcher);
|
request = GetRecordsAction.Request.parseRequest(jobId, parser);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
request = new GetRecordsAction.Request(jobId);
|
request = new GetRecordsAction.Request(jobId);
|
||||||
|
|
|
@ -36,8 +36,7 @@ public class RestPutSchedulerAction extends BaseRestHandler {
|
||||||
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
||||||
String schedulerId = restRequest.param(SchedulerConfig.ID.getPreferredName());
|
String schedulerId = restRequest.param(SchedulerConfig.ID.getPreferredName());
|
||||||
XContentParser parser = restRequest.contentParser();
|
XContentParser parser = restRequest.contentParser();
|
||||||
PutSchedulerAction.Request putSchedulerRequest = PutSchedulerAction.Request.parseRequest(schedulerId, parser,
|
PutSchedulerAction.Request putSchedulerRequest = PutSchedulerAction.Request.parseRequest(schedulerId, parser);
|
||||||
() -> parseFieldMatcher);
|
|
||||||
return channel -> transportPutSchedulerAction.execute(putSchedulerRequest, new RestToXContentListener<>(channel));
|
return channel -> transportPutSchedulerAction.execute(putSchedulerRequest, new RestToXContentListener<>(channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class RestStartSchedulerAction extends BaseRestHandler {
|
||||||
StartSchedulerAction.Request jobSchedulerRequest;
|
StartSchedulerAction.Request jobSchedulerRequest;
|
||||||
if (restRequest.hasContentOrSourceParam()) {
|
if (restRequest.hasContentOrSourceParam()) {
|
||||||
XContentParser parser = restRequest.contentOrSourceParamParser();
|
XContentParser parser = restRequest.contentOrSourceParamParser();
|
||||||
jobSchedulerRequest = StartSchedulerAction.Request.parseRequest(schedulerId, parser, () -> parseFieldMatcher);
|
jobSchedulerRequest = StartSchedulerAction.Request.parseRequest(schedulerId, parser);
|
||||||
} else {
|
} else {
|
||||||
long startTimeMillis = parseDateOrThrow(restRequest.param(StartSchedulerAction.START_TIME.getPreferredName(),
|
long startTimeMillis = parseDateOrThrow(restRequest.param(StartSchedulerAction.START_TIME.getPreferredName(),
|
||||||
DEFAULT_START), StartSchedulerAction.START_TIME.getPreferredName());
|
DEFAULT_START), StartSchedulerAction.START_TIME.getPreferredName());
|
||||||
|
|
|
@ -33,8 +33,7 @@ public class RestValidateDetectorAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
||||||
XContentParser parser = restRequest.contentOrSourceParamParser();
|
XContentParser parser = restRequest.contentOrSourceParamParser();
|
||||||
ValidateDetectorAction.Request validateDetectorRequest = ValidateDetectorAction.Request.parseRequest(parser,
|
ValidateDetectorAction.Request validateDetectorRequest = ValidateDetectorAction.Request.parseRequest(parser);
|
||||||
() -> parseFieldMatcher);
|
|
||||||
return channel -> transportValidateAction.execute(validateDetectorRequest,
|
return channel -> transportValidateAction.execute(validateDetectorRequest,
|
||||||
new AcknowledgedRestListener<ValidateDetectorAction.Response>(channel));
|
new AcknowledgedRestListener<ValidateDetectorAction.Response>(channel));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,7 @@ public class RestValidateTransformAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
||||||
XContentParser parser = restRequest.contentOrSourceParamParser();
|
XContentParser parser = restRequest.contentOrSourceParamParser();
|
||||||
ValidateTransformAction.Request validateDetectorRequest = ValidateTransformAction.Request.parseRequest(parser,
|
ValidateTransformAction.Request validateDetectorRequest = ValidateTransformAction.Request.parseRequest(parser);
|
||||||
() -> parseFieldMatcher);
|
|
||||||
return channel -> transportValidateAction.execute(validateDetectorRequest,
|
return channel -> transportValidateAction.execute(validateDetectorRequest,
|
||||||
new AcknowledgedRestListener<ValidateTransformAction.Response>(channel));
|
new AcknowledgedRestListener<ValidateTransformAction.Response>(channel));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,8 @@ public class RestValidateTransformsAction extends BaseRestHandler {
|
||||||
@Override
|
@Override
|
||||||
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
|
||||||
XContentParser parser = restRequest.contentOrSourceParamParser();
|
XContentParser parser = restRequest.contentOrSourceParamParser();
|
||||||
ValidateTransformsAction.Request validateDetectorRequest = ValidateTransformsAction.Request.PARSER.apply(parser,
|
ValidateTransformsAction.Request validateDetectorRequest = ValidateTransformsAction.Request.PARSER.apply(parser, null);
|
||||||
() -> parseFieldMatcher);
|
return channel -> transportValidateAction.execute(validateDetectorRequest, new AcknowledgedRestListener<>(channel));
|
||||||
return channel -> transportValidateAction.execute(validateDetectorRequest,
|
|
||||||
new AcknowledgedRestListener<ValidateTransformsAction.Response>(channel));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.xpack.ml.scheduler;
|
||||||
|
|
||||||
import org.elasticsearch.cluster.AbstractDiffable;
|
import org.elasticsearch.cluster.AbstractDiffable;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
|
||||||
|
@ -26,7 +25,7 @@ public class Scheduler extends AbstractDiffable<Scheduler> implements ToXContent
|
||||||
// Used for QueryPage
|
// Used for QueryPage
|
||||||
public static final ParseField RESULTS_FIELD = new ParseField("schedulers");
|
public static final ParseField RESULTS_FIELD = new ParseField("schedulers");
|
||||||
|
|
||||||
public static final ConstructingObjectParser<Scheduler, ParseFieldMatcherSupplier> PARSER = new ConstructingObjectParser<>("scheduler",
|
public static final ConstructingObjectParser<Scheduler, Void> PARSER = new ConstructingObjectParser<>("scheduler",
|
||||||
a -> new Scheduler(((SchedulerConfig.Builder) a[0]).build(), (SchedulerStatus) a[1]));
|
a -> new Scheduler(((SchedulerConfig.Builder) a[0]).build(), (SchedulerStatus) a[1]));
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.elasticsearch.xpack.ml.scheduler;
|
||||||
import org.elasticsearch.ElasticsearchException;
|
import org.elasticsearch.ElasticsearchException;
|
||||||
import org.elasticsearch.action.support.ToXContentToBytes;
|
import org.elasticsearch.action.support.ToXContentToBytes;
|
||||||
import org.elasticsearch.common.ParseField;
|
import org.elasticsearch.common.ParseField;
|
||||||
import org.elasticsearch.common.ParseFieldMatcherSupplier;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
|
@ -64,7 +63,7 @@ public class SchedulerConfig extends ToXContentToBytes implements Writeable {
|
||||||
public static final ParseField AGGS = new ParseField("aggs");
|
public static final ParseField AGGS = new ParseField("aggs");
|
||||||
public static final ParseField SCRIPT_FIELDS = new ParseField("script_fields");
|
public static final ParseField SCRIPT_FIELDS = new ParseField("script_fields");
|
||||||
|
|
||||||
public static final ObjectParser<Builder, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>("scheduler_config", Builder::new);
|
public static final ObjectParser<Builder, Void> PARSER = new ObjectParser<>("scheduler_config", Builder::new);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareString(Builder::setId, ID);
|
PARSER.declareString(Builder::setId, ID);
|
||||||
|
@ -74,15 +73,14 @@ public class SchedulerConfig extends ToXContentToBytes implements Writeable {
|
||||||
PARSER.declareLong(Builder::setQueryDelay, QUERY_DELAY);
|
PARSER.declareLong(Builder::setQueryDelay, QUERY_DELAY);
|
||||||
PARSER.declareLong(Builder::setFrequency, FREQUENCY);
|
PARSER.declareLong(Builder::setFrequency, FREQUENCY);
|
||||||
PARSER.declareObject(Builder::setQuery,
|
PARSER.declareObject(Builder::setQuery,
|
||||||
(p, c) -> new QueryParseContext(p, c.getParseFieldMatcher()).parseInnerQueryBuilder(), QUERY);
|
(p, c) -> new QueryParseContext(p).parseInnerQueryBuilder(), QUERY);
|
||||||
PARSER.declareObject(Builder::setAggregations, (p, c) -> AggregatorFactories.parseAggregators(
|
PARSER.declareObject(Builder::setAggregations, (p, c) -> AggregatorFactories.parseAggregators(new QueryParseContext(p)),
|
||||||
new QueryParseContext(p, c.getParseFieldMatcher())), AGGREGATIONS);
|
AGGREGATIONS);
|
||||||
PARSER.declareObject(Builder::setAggregations,(p, c) -> AggregatorFactories.parseAggregators(
|
PARSER.declareObject(Builder::setAggregations,(p, c) -> AggregatorFactories.parseAggregators(new QueryParseContext(p)), AGGS);
|
||||||
new QueryParseContext(p, c.getParseFieldMatcher())), AGGS);
|
|
||||||
PARSER.declareObject(Builder::setScriptFields, (p, c) -> {
|
PARSER.declareObject(Builder::setScriptFields, (p, c) -> {
|
||||||
List<SearchSourceBuilder.ScriptField> parsedScriptFields = new ArrayList<>();
|
List<SearchSourceBuilder.ScriptField> parsedScriptFields = new ArrayList<>();
|
||||||
while (p.nextToken() != XContentParser.Token.END_OBJECT) {
|
while (p.nextToken() != XContentParser.Token.END_OBJECT) {
|
||||||
parsedScriptFields.add(new SearchSourceBuilder.ScriptField(new QueryParseContext(p, c.getParseFieldMatcher())));
|
parsedScriptFields.add(new SearchSourceBuilder.ScriptField(new QueryParseContext(p)));
|
||||||
}
|
}
|
||||||
parsedScriptFields.sort(Comparator.comparing(SearchSourceBuilder.ScriptField::fieldName));
|
parsedScriptFields.sort(Comparator.comparing(SearchSourceBuilder.ScriptField::fieldName));
|
||||||
return parsedScriptFields;
|
return parsedScriptFields;
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.PutListAction.Request;
|
import org.elasticsearch.xpack.ml.action.PutListAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.lists.ListDocument;
|
import org.elasticsearch.xpack.ml.lists.ListDocument;
|
||||||
|
@ -33,8 +32,8 @@ public class CreateListActionRequestTests extends AbstractStreamableXContentTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return PutListAction.Request.parseRequest(parser, () -> matcher);
|
return PutListAction.Request.parseRequest(parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.GetBucketsAction.Request;
|
import org.elasticsearch.xpack.ml.action.GetBucketsAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.job.results.PageParams;
|
import org.elasticsearch.xpack.ml.job.results.PageParams;
|
||||||
|
@ -63,8 +62,8 @@ public class GetBucketActionRequestTests extends AbstractStreamableXContentTestC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return GetBucketsAction.Request.parseRequest(null, parser, () -> matcher);
|
return GetBucketsAction.Request.parseRequest(null, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.job.results.PageParams;
|
import org.elasticsearch.xpack.ml.job.results.PageParams;
|
||||||
import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
||||||
|
@ -33,7 +32,7 @@ public class GetCategoryDefinitionRequestTests extends AbstractStreamableXConten
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected GetCategoriesDefinitionAction.Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected GetCategoriesDefinitionAction.Request parseInstance(XContentParser parser) {
|
||||||
return GetCategoriesDefinitionAction.Request.parseRequest(null, parser, () -> matcher);
|
return GetCategoriesDefinitionAction.Request.parseRequest(null, parser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.GetInfluencersAction.Request;
|
import org.elasticsearch.xpack.ml.action.GetInfluencersAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.job.results.PageParams;
|
import org.elasticsearch.xpack.ml.job.results.PageParams;
|
||||||
|
@ -14,8 +13,8 @@ import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
||||||
public class GetInfluencersActionRequestTests extends AbstractStreamableXContentTestCase<GetInfluencersAction.Request> {
|
public class GetInfluencersActionRequestTests extends AbstractStreamableXContentTestCase<GetInfluencersAction.Request> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return GetInfluencersAction.Request.parseRequest(null, parser, () -> matcher);
|
return GetInfluencersAction.Request.parseRequest(null, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.GetModelSnapshotsAction.Request;
|
import org.elasticsearch.xpack.ml.action.GetModelSnapshotsAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.job.results.PageParams;
|
import org.elasticsearch.xpack.ml.job.results.PageParams;
|
||||||
|
@ -14,8 +13,8 @@ import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
||||||
public class GetModelSnapshotsActionRequestTests extends AbstractStreamableXContentTestCase<GetModelSnapshotsAction.Request> {
|
public class GetModelSnapshotsActionRequestTests extends AbstractStreamableXContentTestCase<GetModelSnapshotsAction.Request> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return GetModelSnapshotsAction.Request.parseRequest(null, parser, () -> matcher);
|
return GetModelSnapshotsAction.Request.parseRequest(null, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.GetRecordsAction.Request;
|
import org.elasticsearch.xpack.ml.action.GetRecordsAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.job.results.PageParams;
|
import org.elasticsearch.xpack.ml.job.results.PageParams;
|
||||||
|
@ -14,8 +13,8 @@ import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
||||||
public class GetRecordsActionRequestTests extends AbstractStreamableXContentTestCase<GetRecordsAction.Request> {
|
public class GetRecordsActionRequestTests extends AbstractStreamableXContentTestCase<GetRecordsAction.Request> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return GetRecordsAction.Request.parseRequest(null, parser, () -> matcher);
|
return GetRecordsAction.Request.parseRequest(null, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.PutJobAction.Request;
|
import org.elasticsearch.xpack.ml.action.PutJobAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.job.Job;
|
import org.elasticsearch.xpack.ml.job.Job;
|
||||||
|
@ -30,8 +29,8 @@ public class PutJobActionRequestTests extends AbstractStreamableXContentTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return Request.parseRequest(jobId, parser, () -> matcher);
|
return Request.parseRequest(jobId, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,17 +5,16 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.UpdateModelSnapshotAction.Request;
|
import org.elasticsearch.xpack.ml.action.UpdateModelSnapshotAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
||||||
|
|
||||||
public class PutModelSnapshotDescriptionActionRequestTests
|
public class PutModelSnapshotDescriptionActionRequestTests
|
||||||
extends AbstractStreamableXContentTestCase<UpdateModelSnapshotAction.Request> {
|
extends AbstractStreamableXContentTestCase<UpdateModelSnapshotAction.Request> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return UpdateModelSnapshotAction.Request.parseRequest(null, null, parser, () -> matcher);
|
return UpdateModelSnapshotAction.Request.parseRequest(null, null, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.PutSchedulerAction.Request;
|
import org.elasticsearch.xpack.ml.action.PutSchedulerAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.scheduler.SchedulerConfig;
|
import org.elasticsearch.xpack.ml.scheduler.SchedulerConfig;
|
||||||
|
@ -38,8 +37,8 @@ public class PutSchedulerActionRequestTests extends AbstractStreamableXContentTe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return Request.parseRequest(schedulerId, parser, () -> matcher);
|
return Request.parseRequest(schedulerId, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.RevertModelSnapshotAction.Request;
|
import org.elasticsearch.xpack.ml.action.RevertModelSnapshotAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
||||||
|
@ -36,8 +35,8 @@ public class RevertModelSnapshotActionRequestTests extends AbstractStreamableXCo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return RevertModelSnapshotAction.Request.parseRequest(null, parser, () -> matcher);
|
return RevertModelSnapshotAction.Request.parseRequest(null, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import org.elasticsearch.action.index.IndexRequest;
|
||||||
import org.elasticsearch.action.support.WriteRequest;
|
import org.elasticsearch.action.support.WriteRequest;
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||||
import org.elasticsearch.common.xcontent.XContentHelper;
|
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
|
@ -214,7 +213,7 @@ public class ScheduledJobsIT extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
try (XContentParser parser = XContentHelper.createParser(NamedXContentRegistry.EMPTY, getResponse.getSourceAsBytesRef())) {
|
try (XContentParser parser = XContentHelper.createParser(NamedXContentRegistry.EMPTY, getResponse.getSourceAsBytesRef())) {
|
||||||
return DataCounts.PARSER.apply(parser, () -> ParseFieldMatcher.EMPTY);
|
return DataCounts.PARSER.apply(parser, null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.StartSchedulerAction.Request;
|
import org.elasticsearch.xpack.ml.action.StartSchedulerAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
import org.elasticsearch.xpack.ml.support.AbstractStreamableXContentTestCase;
|
||||||
|
@ -27,8 +26,8 @@ public class StartSchedulerActionRequestTests extends AbstractStreamableXContent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return Request.parseRequest(null, parser, () -> matcher);
|
return Request.parseRequest(null, parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.ValidateDetectorAction.Request;
|
import org.elasticsearch.xpack.ml.action.ValidateDetectorAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.job.Detector;
|
import org.elasticsearch.xpack.ml.job.Detector;
|
||||||
|
@ -30,8 +29,8 @@ public class ValidateDetectorActionRequestTests extends AbstractStreamableXConte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return Request.parseRequest(parser, () -> matcher);
|
return Request.parseRequest(parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.ValidateTransformAction.Request;
|
import org.elasticsearch.xpack.ml.action.ValidateTransformAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.job.transform.TransformConfig;
|
import org.elasticsearch.xpack.ml.job.transform.TransformConfig;
|
||||||
|
@ -27,8 +26,8 @@ public class ValidateTransformActionRequestTests extends AbstractStreamableXCont
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return Request.parseRequest(parser, () -> matcher);
|
return Request.parseRequest(parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.action;
|
package org.elasticsearch.xpack.ml.action;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.action.ValidateTransformsAction.Request;
|
import org.elasticsearch.xpack.ml.action.ValidateTransformsAction.Request;
|
||||||
import org.elasticsearch.xpack.ml.job.transform.TransformConfig;
|
import org.elasticsearch.xpack.ml.job.transform.TransformConfig;
|
||||||
|
@ -35,8 +34,8 @@ public class ValidateTransformsActionRequestTests extends AbstractStreamableXCon
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Request parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Request parseInstance(XContentParser parser) {
|
||||||
return Request.PARSER.apply(parser, () -> matcher);
|
return Request.PARSER.apply(parser, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
package org.elasticsearch.xpack.ml.integration;
|
package org.elasticsearch.xpack.ml.integration;
|
||||||
|
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.ToXContent;
|
import org.elasticsearch.common.xcontent.ToXContent;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
|
@ -68,9 +67,8 @@ public class AutodetectResultProcessorIT extends ESSingleNodeTestCase {
|
||||||
private void createComponents() {
|
private void createComponents() {
|
||||||
renormalizer = new NoOpRenormalizer();
|
renormalizer = new NoOpRenormalizer();
|
||||||
jobResultsPersister = new JobResultsPersister(nodeSettings(), client());
|
jobResultsPersister = new JobResultsPersister(nodeSettings(), client());
|
||||||
ParseFieldMatcher matcher = new ParseFieldMatcher(nodeSettings());
|
autodetectResultsParser = new AutodetectResultsParser(nodeSettings());
|
||||||
autodetectResultsParser = new AutodetectResultsParser(nodeSettings(), () -> matcher);
|
jobProvider = new JobProvider(client(), 1);
|
||||||
jobProvider = new JobProvider(client(), 1, matcher);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testProcessResults() throws Exception {
|
public void testProcessResults() throws Exception {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.job;
|
package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
@ -82,8 +81,8 @@ public class AnalysisConfigTests extends AbstractSerializingTestCase<AnalysisCon
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AnalysisConfig parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected AnalysisConfig parseInstance(XContentParser parser) {
|
||||||
return AnalysisConfig.PARSER.apply(parser, () -> matcher).build();
|
return AnalysisConfig.PARSER.apply(parser, null).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testFieldConfiguration_singleDetector_notPreSummarised() {
|
public void testFieldConfiguration_singleDetector_notPreSummarised() {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.job;
|
package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.xpack.ml.job.messages.Messages;
|
import org.elasticsearch.xpack.ml.job.messages.Messages;
|
||||||
|
@ -24,8 +23,8 @@ public class AnalysisLimitsTests extends AbstractSerializingTestCase<AnalysisLim
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AnalysisLimits parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected AnalysisLimits parseInstance(XContentParser parser) {
|
||||||
return AnalysisLimits.PARSER.apply(parser, () -> matcher);
|
return AnalysisLimits.PARSER.apply(parser, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEquals_GivenEqual() {
|
public void testEquals_GivenEqual() {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.job;
|
package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
@ -32,8 +31,8 @@ public class DataCountsTests extends AbstractSerializingTestCase<DataCounts> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DataCounts parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected DataCounts parseInstance(XContentParser parser) {
|
||||||
return DataCounts.PARSER.apply(parser, () -> matcher);
|
return DataCounts.PARSER.apply(parser, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCountsEquals_GivenEqualCounts() {
|
public void testCountsEquals_GivenEqualCounts() {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.job;
|
package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.ParsingException;
|
import org.elasticsearch.common.ParsingException;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
||||||
|
@ -176,7 +175,7 @@ public class DataDescriptionTests extends AbstractSerializingTestCase<DataDescri
|
||||||
BytesArray json = new BytesArray("{ \"format\":\"INEXISTENT_FORMAT\" }");
|
BytesArray json = new BytesArray("{ \"format\":\"INEXISTENT_FORMAT\" }");
|
||||||
XContentParser parser = XContentFactory.xContent(json).createParser(NamedXContentRegistry.EMPTY, json);
|
XContentParser parser = XContentFactory.xContent(json).createParser(NamedXContentRegistry.EMPTY, json);
|
||||||
ParsingException ex = expectThrows(ParsingException.class,
|
ParsingException ex = expectThrows(ParsingException.class,
|
||||||
() -> DataDescription.PARSER.apply(parser, () -> ParseFieldMatcher.STRICT));
|
() -> DataDescription.PARSER.apply(parser, null));
|
||||||
assertThat(ex.getMessage(), containsString("[data_description] failed to parse field [format]"));
|
assertThat(ex.getMessage(), containsString("[data_description] failed to parse field [format]"));
|
||||||
Throwable cause = ex.getCause();
|
Throwable cause = ex.getCause();
|
||||||
assertNotNull(cause);
|
assertNotNull(cause);
|
||||||
|
@ -189,7 +188,7 @@ public class DataDescriptionTests extends AbstractSerializingTestCase<DataDescri
|
||||||
BytesArray json = new BytesArray("{ \"field_delimiter\":\",,\" }");
|
BytesArray json = new BytesArray("{ \"field_delimiter\":\",,\" }");
|
||||||
XContentParser parser = XContentFactory.xContent(json).createParser(NamedXContentRegistry.EMPTY, json);
|
XContentParser parser = XContentFactory.xContent(json).createParser(NamedXContentRegistry.EMPTY, json);
|
||||||
ParsingException ex = expectThrows(ParsingException.class,
|
ParsingException ex = expectThrows(ParsingException.class,
|
||||||
() -> DataDescription.PARSER.apply(parser, () -> ParseFieldMatcher.STRICT));
|
() -> DataDescription.PARSER.apply(parser, null));
|
||||||
assertThat(ex.getMessage(), containsString("[data_description] failed to parse field [field_delimiter]"));
|
assertThat(ex.getMessage(), containsString("[data_description] failed to parse field [field_delimiter]"));
|
||||||
Throwable cause = ex.getCause();
|
Throwable cause = ex.getCause();
|
||||||
assertNotNull(cause);
|
assertNotNull(cause);
|
||||||
|
@ -202,7 +201,7 @@ public class DataDescriptionTests extends AbstractSerializingTestCase<DataDescri
|
||||||
BytesArray json = new BytesArray("{ \"quote_character\":\"''\" }");
|
BytesArray json = new BytesArray("{ \"quote_character\":\"''\" }");
|
||||||
XContentParser parser = XContentFactory.xContent(json).createParser(NamedXContentRegistry.EMPTY, json);
|
XContentParser parser = XContentFactory.xContent(json).createParser(NamedXContentRegistry.EMPTY, json);
|
||||||
ParsingException ex = expectThrows(ParsingException.class,
|
ParsingException ex = expectThrows(ParsingException.class,
|
||||||
() -> DataDescription.PARSER.apply(parser, () -> ParseFieldMatcher.STRICT));
|
() -> DataDescription.PARSER.apply(parser, null));
|
||||||
assertThat(ex.getMessage(), containsString("[data_description] failed to parse field [quote_character]"));
|
assertThat(ex.getMessage(), containsString("[data_description] failed to parse field [quote_character]"));
|
||||||
Throwable cause = ex.getCause();
|
Throwable cause = ex.getCause();
|
||||||
assertNotNull(cause);
|
assertNotNull(cause);
|
||||||
|
@ -245,7 +244,7 @@ public class DataDescriptionTests extends AbstractSerializingTestCase<DataDescri
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DataDescription parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected DataDescription parseInstance(XContentParser parser) {
|
||||||
return DataDescription.PARSER.apply(parser, () -> matcher).build();
|
return DataDescription.PARSER.apply(parser, null).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.job;
|
package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
@ -183,8 +182,8 @@ public class DetectorTests extends AbstractSerializingTestCase<Detector> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Detector parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Detector parseInstance(XContentParser parser) {
|
||||||
return Detector.PARSER.apply(parser, () -> matcher).build();
|
return Detector.PARSER.apply(parser, null).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVerifyFieldNames_givenInvalidChars() {
|
public void testVerifyFieldNames_givenInvalidChars() {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.job;
|
package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator;
|
||||||
import org.elasticsearch.common.io.stream.Writeable;
|
import org.elasticsearch.common.io.stream.Writeable;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
@ -16,8 +16,6 @@ import org.elasticsearch.xpack.ml.job.transform.TransformConfig;
|
||||||
import org.elasticsearch.xpack.ml.job.transform.TransformType;
|
import org.elasticsearch.xpack.ml.job.transform.TransformType;
|
||||||
import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase;
|
import org.elasticsearch.xpack.ml.support.AbstractSerializingTestCase;
|
||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.generators.CodepointSetGenerator;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -39,8 +37,8 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Job parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected Job parseInstance(XContentParser parser) {
|
||||||
return Job.PARSER.apply(parser, () -> matcher).build();
|
return Job.PARSER.apply(parser, null).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testConstructor_GivenEmptyJobConfiguration() {
|
public void testConstructor_GivenEmptyJobConfiguration() {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.job;
|
package org.elasticsearch.xpack.ml.job;
|
||||||
|
|
||||||
import org.elasticsearch.common.ParseFieldMatcher;
|
|
||||||
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
@ -65,7 +64,7 @@ public class ModelDebugConfigTests extends AbstractSerializingTestCase<ModelDebu
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ModelDebugConfig parseInstance(XContentParser parser, ParseFieldMatcher matcher) {
|
protected ModelDebugConfig parseInstance(XContentParser parser) {
|
||||||
return ModelDebugConfig.PARSER.apply(parser, () -> matcher);
|
return ModelDebugConfig.PARSER.apply(parser, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue