Adjust to XContentBuilder decoupling (elastic/x-pack-elasticsearch#4212)
This is the x-pack side of https://github.com/elastic/elasticsearch/pull/29225 where some methods were renamed or take different arguments. Original commit: elastic/x-pack-elasticsearch@525e118381
This commit is contained in:
parent
9cc33f4e29
commit
b646abd12c
|
@ -393,13 +393,13 @@ public class License implements ToXContentObject {
|
||||||
if (version == VERSION_START) {
|
if (version == VERSION_START) {
|
||||||
builder.field(Fields.SUBSCRIPTION_TYPE, subscriptionType);
|
builder.field(Fields.SUBSCRIPTION_TYPE, subscriptionType);
|
||||||
}
|
}
|
||||||
builder.dateField(Fields.ISSUE_DATE_IN_MILLIS, Fields.ISSUE_DATE, issueDate);
|
builder.timeField(Fields.ISSUE_DATE_IN_MILLIS, Fields.ISSUE_DATE, issueDate);
|
||||||
if (version == VERSION_START) {
|
if (version == VERSION_START) {
|
||||||
builder.field(Fields.FEATURE, feature);
|
builder.field(Fields.FEATURE, feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expiryDate != LicenseService.BASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLIS) {
|
if (expiryDate != LicenseService.BASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLIS) {
|
||||||
builder.dateField(Fields.EXPIRY_DATE_IN_MILLIS, Fields.EXPIRY_DATE, expiryDate);
|
builder.timeField(Fields.EXPIRY_DATE_IN_MILLIS, Fields.EXPIRY_DATE, expiryDate);
|
||||||
}
|
}
|
||||||
builder.field(Fields.MAX_NODES, maxNodes);
|
builder.field(Fields.MAX_NODES, maxNodes);
|
||||||
builder.field(Fields.ISSUED_TO, issuedTo);
|
builder.field(Fields.ISSUED_TO, issuedTo);
|
||||||
|
@ -411,7 +411,7 @@ public class License implements ToXContentObject {
|
||||||
builder.humanReadable(previouslyHumanReadable);
|
builder.humanReadable(previouslyHumanReadable);
|
||||||
}
|
}
|
||||||
if (version >= VERSION_START_DATE) {
|
if (version >= VERSION_START_DATE) {
|
||||||
builder.dateField(Fields.START_DATE_IN_MILLIS, Fields.START_DATE, startDate);
|
builder.timeField(Fields.START_DATE_IN_MILLIS, Fields.START_DATE, startDate);
|
||||||
}
|
}
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class XPackInfoResponse extends ActionResponse {
|
||||||
.field("type", type)
|
.field("type", type)
|
||||||
.field("mode", mode)
|
.field("mode", mode)
|
||||||
.field("status", status.label())
|
.field("status", status.label())
|
||||||
.dateField("expiry_date_in_millis", "expiry_date", expiryDate)
|
.timeField("expiry_date_in_millis", "expiry_date", expiryDate)
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ public class FlushJobAction extends Action<FlushJobAction.Request, FlushJobActio
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field("flushed", flushed);
|
builder.field("flushed", flushed);
|
||||||
if (lastFinalizedBucketEnd != null) {
|
if (lastFinalizedBucketEnd != null) {
|
||||||
builder.dateField(FlushAcknowledgement.LAST_FINALIZED_BUCKET_END.getPreferredName(),
|
builder.timeField(FlushAcknowledgement.LAST_FINALIZED_BUCKET_END.getPreferredName(),
|
||||||
FlushAcknowledgement.LAST_FINALIZED_BUCKET_END.getPreferredName() + "_string", lastFinalizedBucketEnd.getTime());
|
FlushAcknowledgement.LAST_FINALIZED_BUCKET_END.getPreferredName() + "_string", lastFinalizedBucketEnd.getTime());
|
||||||
}
|
}
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
|
|
|
@ -162,8 +162,8 @@ public class ScheduledEvent implements ToXContentObject, Writeable {
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field(DESCRIPTION.getPreferredName(), description);
|
builder.field(DESCRIPTION.getPreferredName(), description);
|
||||||
builder.dateField(START_TIME.getPreferredName(), START_TIME.getPreferredName() + "_string", startTime.toInstant().toEpochMilli());
|
builder.timeField(START_TIME.getPreferredName(), START_TIME.getPreferredName() + "_string", startTime.toInstant().toEpochMilli());
|
||||||
builder.dateField(END_TIME.getPreferredName(), END_TIME.getPreferredName() + "_string", endTime.toInstant().toEpochMilli());
|
builder.timeField(END_TIME.getPreferredName(), END_TIME.getPreferredName() + "_string", endTime.toInstant().toEpochMilli());
|
||||||
builder.field(Calendar.ID.getPreferredName(), calendarId);
|
builder.field(Calendar.ID.getPreferredName(), calendarId);
|
||||||
if (eventId != null) {
|
if (eventId != null) {
|
||||||
builder.field(EVENT_ID.getPreferredName(), eventId);
|
builder.field(EVENT_ID.getPreferredName(), eventId);
|
||||||
|
|
|
@ -556,13 +556,13 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContentO
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
builder.field(DESCRIPTION.getPreferredName(), description);
|
builder.field(DESCRIPTION.getPreferredName(), description);
|
||||||
}
|
}
|
||||||
builder.dateField(CREATE_TIME.getPreferredName(), CREATE_TIME.getPreferredName() + humanReadableSuffix, createTime.getTime());
|
builder.timeField(CREATE_TIME.getPreferredName(), CREATE_TIME.getPreferredName() + humanReadableSuffix, createTime.getTime());
|
||||||
if (finishedTime != null) {
|
if (finishedTime != null) {
|
||||||
builder.dateField(FINISHED_TIME.getPreferredName(), FINISHED_TIME.getPreferredName() + humanReadableSuffix,
|
builder.timeField(FINISHED_TIME.getPreferredName(), FINISHED_TIME.getPreferredName() + humanReadableSuffix,
|
||||||
finishedTime.getTime());
|
finishedTime.getTime());
|
||||||
}
|
}
|
||||||
if (lastDataTime != null) {
|
if (lastDataTime != null) {
|
||||||
builder.dateField(LAST_DATA_TIME.getPreferredName(), LAST_DATA_TIME.getPreferredName() + humanReadableSuffix,
|
builder.timeField(LAST_DATA_TIME.getPreferredName(), LAST_DATA_TIME.getPreferredName() + humanReadableSuffix,
|
||||||
lastDataTime.getTime());
|
lastDataTime.getTime());
|
||||||
}
|
}
|
||||||
if (establishedModelMemory != null) {
|
if (establishedModelMemory != null) {
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class FlushAcknowledgement implements ToXContentObject, Writeable {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field(ID.getPreferredName(), id);
|
builder.field(ID.getPreferredName(), id);
|
||||||
if (lastFinalizedBucketEnd != null) {
|
if (lastFinalizedBucketEnd != null) {
|
||||||
builder.dateField(LAST_FINALIZED_BUCKET_END.getPreferredName(), LAST_FINALIZED_BUCKET_END.getPreferredName() + "_string",
|
builder.timeField(LAST_FINALIZED_BUCKET_END.getPreferredName(), LAST_FINALIZED_BUCKET_END.getPreferredName() + "_string",
|
||||||
lastFinalizedBucketEnd.getTime());
|
lastFinalizedBucketEnd.getTime());
|
||||||
}
|
}
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
|
|
|
@ -576,23 +576,23 @@ public class DataCounts implements ToXContentObject, Writeable {
|
||||||
builder.field(SPARSE_BUCKET_COUNT.getPreferredName(), sparseBucketCount);
|
builder.field(SPARSE_BUCKET_COUNT.getPreferredName(), sparseBucketCount);
|
||||||
builder.field(BUCKET_COUNT.getPreferredName(), bucketCount);
|
builder.field(BUCKET_COUNT.getPreferredName(), bucketCount);
|
||||||
if (earliestRecordTimeStamp != null) {
|
if (earliestRecordTimeStamp != null) {
|
||||||
builder.dateField(EARLIEST_RECORD_TIME.getPreferredName(), EARLIEST_RECORD_TIME.getPreferredName() + "_string",
|
builder.timeField(EARLIEST_RECORD_TIME.getPreferredName(), EARLIEST_RECORD_TIME.getPreferredName() + "_string",
|
||||||
earliestRecordTimeStamp.getTime());
|
earliestRecordTimeStamp.getTime());
|
||||||
}
|
}
|
||||||
if (latestRecordTimeStamp != null) {
|
if (latestRecordTimeStamp != null) {
|
||||||
builder.dateField(LATEST_RECORD_TIME.getPreferredName(), LATEST_RECORD_TIME.getPreferredName() + "_string",
|
builder.timeField(LATEST_RECORD_TIME.getPreferredName(), LATEST_RECORD_TIME.getPreferredName() + "_string",
|
||||||
latestRecordTimeStamp.getTime());
|
latestRecordTimeStamp.getTime());
|
||||||
}
|
}
|
||||||
if (lastDataTimeStamp != null) {
|
if (lastDataTimeStamp != null) {
|
||||||
builder.dateField(LAST_DATA_TIME.getPreferredName(), LAST_DATA_TIME.getPreferredName() + "_string",
|
builder.timeField(LAST_DATA_TIME.getPreferredName(), LAST_DATA_TIME.getPreferredName() + "_string",
|
||||||
lastDataTimeStamp.getTime());
|
lastDataTimeStamp.getTime());
|
||||||
}
|
}
|
||||||
if (latestEmptyBucketTimeStamp != null) {
|
if (latestEmptyBucketTimeStamp != null) {
|
||||||
builder.dateField(LATEST_EMPTY_BUCKET_TIME.getPreferredName(), LATEST_EMPTY_BUCKET_TIME.getPreferredName() + "_string",
|
builder.timeField(LATEST_EMPTY_BUCKET_TIME.getPreferredName(), LATEST_EMPTY_BUCKET_TIME.getPreferredName() + "_string",
|
||||||
latestEmptyBucketTimeStamp.getTime());
|
latestEmptyBucketTimeStamp.getTime());
|
||||||
}
|
}
|
||||||
if (latestSparseBucketTimeStamp != null) {
|
if (latestSparseBucketTimeStamp != null) {
|
||||||
builder.dateField(LATEST_SPARSE_BUCKET_TIME.getPreferredName(), LATEST_SPARSE_BUCKET_TIME.getPreferredName() + "_string",
|
builder.timeField(LATEST_SPARSE_BUCKET_TIME.getPreferredName(), LATEST_SPARSE_BUCKET_TIME.getPreferredName() + "_string",
|
||||||
latestSparseBucketTimeStamp.getTime());
|
latestSparseBucketTimeStamp.getTime());
|
||||||
}
|
}
|
||||||
builder.field(INPUT_RECORD_COUNT.getPreferredName(), getInputRecordCount());
|
builder.field(INPUT_RECORD_COUNT.getPreferredName(), getInputRecordCount());
|
||||||
|
|
|
@ -184,9 +184,9 @@ public class ModelSizeStats implements ToXContentObject, Writeable {
|
||||||
builder.field(TOTAL_PARTITION_FIELD_COUNT_FIELD.getPreferredName(), totalPartitionFieldCount);
|
builder.field(TOTAL_PARTITION_FIELD_COUNT_FIELD.getPreferredName(), totalPartitionFieldCount);
|
||||||
builder.field(BUCKET_ALLOCATION_FAILURES_COUNT_FIELD.getPreferredName(), bucketAllocationFailuresCount);
|
builder.field(BUCKET_ALLOCATION_FAILURES_COUNT_FIELD.getPreferredName(), bucketAllocationFailuresCount);
|
||||||
builder.field(MEMORY_STATUS_FIELD.getPreferredName(), memoryStatus);
|
builder.field(MEMORY_STATUS_FIELD.getPreferredName(), memoryStatus);
|
||||||
builder.dateField(LOG_TIME_FIELD.getPreferredName(), LOG_TIME_FIELD.getPreferredName() + "_string", logTime.getTime());
|
builder.timeField(LOG_TIME_FIELD.getPreferredName(), LOG_TIME_FIELD.getPreferredName() + "_string", logTime.getTime());
|
||||||
if (timestamp != null) {
|
if (timestamp != null) {
|
||||||
builder.dateField(TIMESTAMP_FIELD.getPreferredName(), TIMESTAMP_FIELD.getPreferredName() + "_string", timestamp.getTime());
|
builder.timeField(TIMESTAMP_FIELD.getPreferredName(), TIMESTAMP_FIELD.getPreferredName() + "_string", timestamp.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
|
|
|
@ -187,7 +187,7 @@ public class ModelSnapshot implements ToXContentObject, Writeable {
|
||||||
builder.field(Job.ID.getPreferredName(), jobId);
|
builder.field(Job.ID.getPreferredName(), jobId);
|
||||||
builder.field(MIN_VERSION.getPreferredName(), minVersion);
|
builder.field(MIN_VERSION.getPreferredName(), minVersion);
|
||||||
if (timestamp != null) {
|
if (timestamp != null) {
|
||||||
builder.dateField(TIMESTAMP.getPreferredName(), TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
builder.timeField(TIMESTAMP.getPreferredName(), TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
||||||
}
|
}
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
builder.field(DESCRIPTION.getPreferredName(), description);
|
builder.field(DESCRIPTION.getPreferredName(), description);
|
||||||
|
@ -200,11 +200,11 @@ public class ModelSnapshot implements ToXContentObject, Writeable {
|
||||||
builder.field(ModelSizeStats.RESULT_TYPE_FIELD.getPreferredName(), modelSizeStats);
|
builder.field(ModelSizeStats.RESULT_TYPE_FIELD.getPreferredName(), modelSizeStats);
|
||||||
}
|
}
|
||||||
if (latestRecordTimeStamp != null) {
|
if (latestRecordTimeStamp != null) {
|
||||||
builder.dateField(LATEST_RECORD_TIME.getPreferredName(), LATEST_RECORD_TIME.getPreferredName() + "_string",
|
builder.timeField(LATEST_RECORD_TIME.getPreferredName(), LATEST_RECORD_TIME.getPreferredName() + "_string",
|
||||||
latestRecordTimeStamp.getTime());
|
latestRecordTimeStamp.getTime());
|
||||||
}
|
}
|
||||||
if (latestResultTimeStamp != null) {
|
if (latestResultTimeStamp != null) {
|
||||||
builder.dateField(LATEST_RESULT_TIME.getPreferredName(), LATEST_RESULT_TIME.getPreferredName() + "_string",
|
builder.timeField(LATEST_RESULT_TIME.getPreferredName(), LATEST_RESULT_TIME.getPreferredName() + "_string",
|
||||||
latestResultTimeStamp.getTime());
|
latestResultTimeStamp.getTime());
|
||||||
}
|
}
|
||||||
if (quantiles != null) {
|
if (quantiles != null) {
|
||||||
|
|
|
@ -255,7 +255,7 @@ public class AnomalyRecord implements ToXContentObject, Writeable {
|
||||||
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
||||||
builder.field(Detector.DETECTOR_INDEX.getPreferredName(), detectorIndex);
|
builder.field(Detector.DETECTOR_INDEX.getPreferredName(), detectorIndex);
|
||||||
builder.field(Result.IS_INTERIM.getPreferredName(), isInterim);
|
builder.field(Result.IS_INTERIM.getPreferredName(), isInterim);
|
||||||
builder.dateField(Result.TIMESTAMP.getPreferredName(), Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
builder.timeField(Result.TIMESTAMP.getPreferredName(), Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
||||||
if (byFieldName != null) {
|
if (byFieldName != null) {
|
||||||
builder.field(BY_FIELD_NAME.getPreferredName(), byFieldName);
|
builder.field(BY_FIELD_NAME.getPreferredName(), byFieldName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class Bucket implements ToXContentObject, Writeable {
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field(JOB_ID.getPreferredName(), jobId);
|
builder.field(JOB_ID.getPreferredName(), jobId);
|
||||||
builder.dateField(Result.TIMESTAMP.getPreferredName(), Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
builder.timeField(Result.TIMESTAMP.getPreferredName(), Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
||||||
builder.field(ANOMALY_SCORE.getPreferredName(), anomalyScore);
|
builder.field(ANOMALY_SCORE.getPreferredName(), anomalyScore);
|
||||||
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
||||||
builder.field(INITIAL_ANOMALY_SCORE.getPreferredName(), initialAnomalyScore);
|
builder.field(INITIAL_ANOMALY_SCORE.getPreferredName(), initialAnomalyScore);
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class BucketInfluencer implements ToXContentObject, Writeable {
|
||||||
builder.field(ANOMALY_SCORE.getPreferredName(), anomalyScore);
|
builder.field(ANOMALY_SCORE.getPreferredName(), anomalyScore);
|
||||||
builder.field(RAW_ANOMALY_SCORE.getPreferredName(), rawAnomalyScore);
|
builder.field(RAW_ANOMALY_SCORE.getPreferredName(), rawAnomalyScore);
|
||||||
builder.field(PROBABILITY.getPreferredName(), probability);
|
builder.field(PROBABILITY.getPreferredName(), probability);
|
||||||
builder.dateField(Result.TIMESTAMP.getPreferredName(), Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
builder.timeField(Result.TIMESTAMP.getPreferredName(), Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
||||||
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
||||||
builder.field(Result.IS_INTERIM.getPreferredName(), isInterim);
|
builder.field(Result.IS_INTERIM.getPreferredName(), isInterim);
|
||||||
return builder;
|
return builder;
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class Forecast implements ToXContentObject, Writeable {
|
||||||
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
||||||
builder.field(DETECTOR_INDEX.getPreferredName(), detectorIndex);
|
builder.field(DETECTOR_INDEX.getPreferredName(), detectorIndex);
|
||||||
if (timestamp != null) {
|
if (timestamp != null) {
|
||||||
builder.dateField(Result.TIMESTAMP.getPreferredName(),
|
builder.timeField(Result.TIMESTAMP.getPreferredName(),
|
||||||
Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
||||||
}
|
}
|
||||||
if (partitionFieldName != null) {
|
if (partitionFieldName != null) {
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class Influencer implements ToXContentObject, Writeable {
|
||||||
builder.field(PROBABILITY.getPreferredName(), probability);
|
builder.field(PROBABILITY.getPreferredName(), probability);
|
||||||
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
||||||
builder.field(Result.IS_INTERIM.getPreferredName(), isInterim);
|
builder.field(Result.IS_INTERIM.getPreferredName(), isInterim);
|
||||||
builder.dateField(Result.TIMESTAMP.getPreferredName(), Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
builder.timeField(Result.TIMESTAMP.getPreferredName(), Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class ModelPlot implements ToXContentObject, Writeable {
|
||||||
builder.field(DETECTOR_INDEX.getPreferredName(), detectorIndex);
|
builder.field(DETECTOR_INDEX.getPreferredName(), detectorIndex);
|
||||||
|
|
||||||
if (timestamp != null) {
|
if (timestamp != null) {
|
||||||
builder.dateField(Result.TIMESTAMP.getPreferredName(),
|
builder.timeField(Result.TIMESTAMP.getPreferredName(),
|
||||||
Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
||||||
}
|
}
|
||||||
if (partitionFieldName != null) {
|
if (partitionFieldName != null) {
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class OverallBucket implements ToXContentObject, Writeable {
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.dateField(Result.TIMESTAMP.getPreferredName(), Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
builder.timeField(Result.TIMESTAMP.getPreferredName(), Result.TIMESTAMP.getPreferredName() + "_string", timestamp.getTime());
|
||||||
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
||||||
builder.field(OVERALL_SCORE.getPreferredName(), overallScore);
|
builder.field(OVERALL_SCORE.getPreferredName(), overallScore);
|
||||||
builder.field(JOBS.getPreferredName(), jobs);
|
builder.field(JOBS.getPreferredName(), jobs);
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class CertificateInfo implements ToXContentObject, Writeable {
|
||||||
.field("subject_dn", subjectDn)
|
.field("subject_dn", subjectDn)
|
||||||
.field("serial_number", serialNumber)
|
.field("serial_number", serialNumber)
|
||||||
.field("has_private_key", hasPrivateKey)
|
.field("has_private_key", hasPrivateKey)
|
||||||
.field("expiry", expiry)
|
.timeField("expiry", expiry)
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,7 @@ public class ActionStatus implements ToXContentObject {
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
return builder.startObject()
|
return builder.startObject()
|
||||||
.field(Field.TIMESTAMP.getPreferredName()).value(timestamp, dateTimeFormatter.printer())
|
.field(Field.TIMESTAMP.getPreferredName()).value(dateTimeFormatter.printer().print(timestamp))
|
||||||
.field(Field.ACK_STATUS_STATE.getPreferredName(), state.name().toLowerCase(Locale.ROOT))
|
.field(Field.ACK_STATUS_STATE.getPreferredName(), state.name().toLowerCase(Locale.ROOT))
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ public class ActionStatus implements ToXContentObject {
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field(Field.TIMESTAMP.getPreferredName()).value(timestamp, dateTimeFormatter.printer());
|
builder.field(Field.TIMESTAMP.getPreferredName()).value(dateTimeFormatter.printer().print(timestamp));
|
||||||
builder.field(Field.EXECUTION_SUCCESSFUL.getPreferredName(), successful);
|
builder.field(Field.EXECUTION_SUCCESSFUL.getPreferredName(), successful);
|
||||||
if (reason != null) {
|
if (reason != null) {
|
||||||
builder.field(Field.REASON.getPreferredName(), reason);
|
builder.field(Field.REASON.getPreferredName(), reason);
|
||||||
|
@ -442,7 +442,7 @@ public class ActionStatus implements ToXContentObject {
|
||||||
@Override
|
@Override
|
||||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||||
return builder.startObject()
|
return builder.startObject()
|
||||||
.field(Field.TIMESTAMP.getPreferredName()).value(timestamp, dateTimeFormatter.printer())
|
.field(Field.TIMESTAMP.getPreferredName()).value(dateTimeFormatter.printer().print(timestamp))
|
||||||
.field(Field.REASON.getPreferredName(), reason)
|
.field(Field.REASON.getPreferredName(), reason)
|
||||||
.endObject();
|
.endObject();
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,8 +73,8 @@ public class QueuedWatch implements Streamable, ToXContentObject {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field("watch_id", watchId);
|
builder.field("watch_id", watchId);
|
||||||
builder.field("watch_record_id", watchRecordId);
|
builder.field("watch_record_id", watchRecordId);
|
||||||
builder.field("triggered_time", triggeredTime);
|
builder.timeField("triggered_time", triggeredTime);
|
||||||
builder.field("execution_time", executionTime);
|
builder.timeField("execution_time", executionTime);
|
||||||
builder.endObject();
|
builder.endObject();
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,8 +110,8 @@ public class WatchExecutionSnapshot implements Streamable, ToXContentObject {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field("watch_id", watchId);
|
builder.field("watch_id", watchId);
|
||||||
builder.field("watch_record_id", watchRecordId);
|
builder.field("watch_record_id", watchRecordId);
|
||||||
builder.field("triggered_time", triggeredTime);
|
builder.timeField("triggered_time", triggeredTime);
|
||||||
builder.field("execution_time", executionTime);
|
builder.timeField("execution_time", executionTime);
|
||||||
builder.field("execution_phase", phase);
|
builder.field("execution_phase", phase);
|
||||||
if (executedActions != null) {
|
if (executedActions != null) {
|
||||||
builder.startArray("executed_actions");
|
builder.startArray("executed_actions");
|
||||||
|
|
|
@ -250,10 +250,10 @@ public class WatchStatus implements ToXContentObject, Streamable {
|
||||||
builder.field(Field.STATE.getPreferredName(), state, params);
|
builder.field(Field.STATE.getPreferredName(), state, params);
|
||||||
}
|
}
|
||||||
if (lastChecked != null) {
|
if (lastChecked != null) {
|
||||||
builder.field(Field.LAST_CHECKED.getPreferredName(), lastChecked);
|
builder.timeField(Field.LAST_CHECKED.getPreferredName(), lastChecked);
|
||||||
}
|
}
|
||||||
if (lastMetCondition != null) {
|
if (lastMetCondition != null) {
|
||||||
builder.field(Field.LAST_MET_CONDITION.getPreferredName(), lastMetCondition);
|
builder.timeField(Field.LAST_MET_CONDITION.getPreferredName(), lastMetCondition);
|
||||||
}
|
}
|
||||||
if (actions != null) {
|
if (actions != null) {
|
||||||
builder.startObject(Field.ACTIONS.getPreferredName());
|
builder.startObject(Field.ACTIONS.getPreferredName());
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.ml.job.process.autodetect;
|
package org.elasticsearch.xpack.ml.job.process.autodetect;
|
||||||
|
|
||||||
|
import org.elasticsearch.common.xcontent.XContentElasticsearchExtension;
|
||||||
import org.elasticsearch.core.internal.io.IOUtils;
|
import org.elasticsearch.core.internal.io.IOUtils;
|
||||||
import org.elasticsearch.ElasticsearchStatusException;
|
import org.elasticsearch.ElasticsearchStatusException;
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
|
@ -448,13 +449,13 @@ public class AutodetectProcessManager extends AbstractComponent {
|
||||||
msgBuilder.append("] with latest_record_timestamp [");
|
msgBuilder.append("] with latest_record_timestamp [");
|
||||||
Date snapshotLatestRecordTimestamp = modelSnapshot.getLatestRecordTimeStamp();
|
Date snapshotLatestRecordTimestamp = modelSnapshot.getLatestRecordTimeStamp();
|
||||||
msgBuilder.append(snapshotLatestRecordTimestamp == null ? "N/A" :
|
msgBuilder.append(snapshotLatestRecordTimestamp == null ? "N/A" :
|
||||||
XContentBuilder.DEFAULT_DATE_PRINTER.print(
|
XContentElasticsearchExtension.DEFAULT_DATE_PRINTER.print(
|
||||||
snapshotLatestRecordTimestamp.getTime()));
|
snapshotLatestRecordTimestamp.getTime()));
|
||||||
}
|
}
|
||||||
msgBuilder.append("], job latest_record_timestamp [");
|
msgBuilder.append("], job latest_record_timestamp [");
|
||||||
Date jobLatestRecordTimestamp = autodetectParams.dataCounts().getLatestRecordTimeStamp();
|
Date jobLatestRecordTimestamp = autodetectParams.dataCounts().getLatestRecordTimeStamp();
|
||||||
msgBuilder.append(jobLatestRecordTimestamp == null ? "N/A"
|
msgBuilder.append(jobLatestRecordTimestamp == null ? "N/A"
|
||||||
: XContentBuilder.DEFAULT_DATE_PRINTER.print(jobLatestRecordTimestamp.getTime()));
|
: XContentElasticsearchExtension.DEFAULT_DATE_PRINTER.print(jobLatestRecordTimestamp.getTime()));
|
||||||
msgBuilder.append("]");
|
msgBuilder.append("]");
|
||||||
String msg = msgBuilder.toString();
|
String msg = msgBuilder.toString();
|
||||||
logger.info("[{}] {}", jobId, msg);
|
logger.info("[{}] {}", jobId, msg);
|
||||||
|
|
|
@ -1149,7 +1149,7 @@ public class IndexAuditTrail extends AbstractComponent implements AuditTrail {
|
||||||
|
|
||||||
Message start() throws IOException {
|
Message start() throws IOException {
|
||||||
builder.startObject();
|
builder.startObject();
|
||||||
builder.field(Field.TIMESTAMP, timestamp);
|
builder.timeField(Field.TIMESTAMP, timestamp);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class Email implements ToXContentObject {
|
||||||
if (priority != null) {
|
if (priority != null) {
|
||||||
builder.field(Field.PRIORITY.getPreferredName(), priority.value());
|
builder.field(Field.PRIORITY.getPreferredName(), priority.value());
|
||||||
}
|
}
|
||||||
builder.field(Field.SENT_DATE.getPreferredName(), sentDate);
|
builder.timeField(Field.SENT_DATE.getPreferredName(), sentDate);
|
||||||
if (to != null) {
|
if (to != null) {
|
||||||
builder.field(Field.TO.getPreferredName(), to, params);
|
builder.field(Field.TO.getPreferredName(), to, params);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue