From 4eda09d24a3bc3858d9ff8650c0556b0cb405acc Mon Sep 17 00:00:00 2001 From: David Kyle Date: Mon, 19 Dec 2016 11:27:32 +0000 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20write=20job=20description=20if?= =?UTF-8?q?=20not=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit: elastic/x-pack-elasticsearch@6e7ff939d39e4842f679fd646198afcedc81e6cf --- .../main/java/org/elasticsearch/xpack/prelert/job/Job.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/Job.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/Job.java index d29a59347eb..cf3709b507d 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/Job.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/prelert/job/Job.java @@ -417,7 +417,9 @@ public class Job extends AbstractDiffable implements Writeable, ToXContent public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException { builder.field(ID.getPreferredName(), jobId); - builder.field(DESCRIPTION.getPreferredName(), description); + if (description != null) { + builder.field(DESCRIPTION.getPreferredName(), description); + } builder.field(CREATE_TIME.getPreferredName(), createTime.getTime()); if (finishedTime != null) { builder.field(FINISHED_TIME.getPreferredName(), finishedTime.getTime());