Can use time in kibana to limit the search scope
Signed-off-by: Wu Zhende wuzhende666@163.com --- src/lib/job.cr | 4 ++++ src/scheduler/elasticsearch_client.cr | 3 +++ 2 files changed, 7 insertions(+)
diff --git a/src/lib/job.cr b/src/lib/job.cr index 8691082..b6bb730 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -315,6 +315,10 @@ class Job return package_dir end
+ def set_time + self["time"] = Time.local.to_s("%Y-%m-%dT%H:%M:%S+0800") + end + def set_upload_dirs self["upload_dirs"] = "#{result_root}#{get_package_dir}" end diff --git a/src/scheduler/elasticsearch_client.cr b/src/scheduler/elasticsearch_client.cr index 58bed08..0e83ff1 100644 --- a/src/scheduler/elasticsearch_client.cr +++ b/src/scheduler/elasticsearch_client.cr @@ -36,6 +36,9 @@ class Elasticsearch::Client
# caller should judge response["_id"] != nil def set_job_content(job : Job) + # time indicates the update time of each job event + job.set_time + response = get_job_content(job.id) if response["id"]? response = update(job.dump_to_json_any, job.id)