WHAT IS SCRIPT FOR FINDING MINIMUM OF DATES WHICH ARE IN strict_date_time_no_millis FORMAT IN KIBANA

FIND MINIMUM OF DATES WHICH ARE IN strict_date_time_no_millis FORMAT IN KIBANA PAINLESS SCRIPT FIELD

2019-03-14T11:36:49.635Z,
2019-03-14T11:37:49.635Z,
2019-03-14T11:34:49.635Z,

I have several dates like above in array.I need to find minimum of theses dates

@PRUDHVI_CHOWDHARY_NE If I understood it correctly, I believe you will be able to use a common loop over the array (you can found some examples here https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-examples.html )

And then just use the available Date functions to compare the dates until you found the minimum one:

https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html#isBefore-java.time.chrono.ChronoLocalDateTime-

Hello Tiago Costa

I have an array of objects in every document of an index.
for example
"content " :[
{
"queryId": "20190314_113638_00349_krexs",
"query_service_entry_time": "2019-03-14T11:36:38.201Z",
"query_service_exit_time": "2019-03-14T11:36:49.635Z",
},
{
"queryId": "20190314_113638_00352_krexs",
"query_service_entry_time": "2019-03-14T11:36:38.219Z",
"query_service_exit_time": "2019-03-14T11:36:49.765Z",
},
{
"queryId": "20190314_113638_00353_krexs",
"query_service_entry_time": "2019-03-14T11:36:38.236Z",
"query_service_exit_time": "2019-03-14T11:36:49.907Z",
}
]

What is the painless script for display minimum of query_service_entry_time and maximum of query_service_exit_time in array of objects in saved search

MAIN INTENSION IS HOW TO MAKE OBJECTS IN ARRAY WELL SUPPORTED IN KIBANA DASHBOARDS,SAVED SEARCH

Please don't use all caps, it's considered rude.

1 Like

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