kibana - Timestamp difference in Elasticsearch -


i know has been asked, elk seems changing rapidly , maybe possible @ point. so, i'm using kibana 4 , i'm trying visualize (or @ least calculate) time difference between 2 docs in query. docs logs batch process lot of fields , timestamp 1 of them (of type "date"). possible calculate time difference between consecutive docs in query using scripted field? (doesn't matter type returned).

i hope made sense, i'm new elk. in advance.

dauta

_from understand, cannot in kibana, scripted fields apply documents 1 one. however, if matters getting calculated result, can scripted_metric agregation in es query.

i think may like

{     "sort" : [         { "mydatefield" : {"order" : "asc"}}     ],     "query" : {         (something of match, range, match_all...)     },     "aggregations": {         "scripted_metric": {             "init_script": "(declarations, eg :) _agg['myarray']=[]",             "map_script": (store relevant timestamps in datastructure, eg :) "_ạgg.myarray.add(doc['mydatefield'])",             "reduce_script": "(aggregate results, eg :) otherarray = [] ; (x in ạggs){otherarray.putall(x.myarray)} ;             (and sort otherarray) ; result = [] ;            (i = 0 ; < otherarray.length-1 ; i++){result.add(otherarray[i+1]-otherarray[i])} ;            return result ;"         }     } } 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -