Two different date fields want to check is gte or lte

Hi All !...

Am new to Elasticsearch 6.2.1 and Kibana 6.2.1. Now am working on scripted Field in kibana.
I have two different date fields in indices like (resolved_on and resolve_due_by) i want check the condition if resolved_on is lessThan or equalTo resolve_due_bye. I tried some scripted query that are shown below

doc['resolved_on'] <= doc['resolve_due_by']  <!-- This not working -->

The below code is working now. I don't know whether it's correct way or not to proceed with two different dates.

((doc['resolved_on'].date.dayOfYear <= doc['resolve_due_by'].date.dayOfYear) && (doc['resolved_on'].date.millisOfDay <= doc['resolve_due_by'].date.millisOfDay)) 

Please can anyone help me this ?

Thank you

Your solution is what I would recommend. Here is the date field API that is exposed: https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-scripting-expression.html#_date_field_api

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.