[ML] Hide partition_scores field if empty (elastic/x-pack-elasticsearch#1189)
Original commit: elastic/x-pack-elasticsearch@5dec266e0d
This commit is contained in:
parent
6c0613f36f
commit
bd40dd36c9
|
@ -162,14 +162,16 @@ public class Bucket extends ToXContentToBytes implements Writeable {
|
|||
builder.field(BUCKET_SPAN.getPreferredName(), bucketSpan);
|
||||
builder.field(INITIAL_ANOMALY_SCORE.getPreferredName(), initialAnomalyScore);
|
||||
builder.field(RECORD_COUNT.getPreferredName(), recordCount);
|
||||
if (!records.isEmpty()) {
|
||||
if (records.isEmpty() == false) {
|
||||
builder.field(RECORDS.getPreferredName(), records);
|
||||
}
|
||||
builder.field(EVENT_COUNT.getPreferredName(), eventCount);
|
||||
builder.field(IS_INTERIM.getPreferredName(), isInterim);
|
||||
builder.field(BUCKET_INFLUENCERS.getPreferredName(), bucketInfluencers);
|
||||
builder.field(PROCESSING_TIME_MS.getPreferredName(), processingTimeMs);
|
||||
builder.field(PARTITION_SCORES.getPreferredName(), partitionScores);
|
||||
if (partitionScores.isEmpty() == false) {
|
||||
builder.field(PARTITION_SCORES.getPreferredName(), partitionScores);
|
||||
}
|
||||
builder.field(Result.RESULT_TYPE.getPreferredName(), RESULT_TYPE_VALUE);
|
||||
builder.endObject();
|
||||
return builder;
|
||||
|
|
|
@ -70,6 +70,8 @@ setup:
|
|||
- match: { buckets.1.timestamp: 1470009600000 }
|
||||
- match: { buckets.1.job_id: farequote}
|
||||
- match: { buckets.1.result_type: bucket}
|
||||
- is_false: buckets.0.partition_scores
|
||||
- is_false: buckets.1.partition_scores
|
||||
|
||||
---
|
||||
"Test get buckets given exclude_interim is false":
|
||||
|
|
Loading…
Reference in New Issue