"inline": "((new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S").parse(doc['mule.api.analytics.repliedTs'].value).getTime()) - (new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S").parse(doc['mule.api.analytics.receivedTs'].value).getTime())) ;"
}
}
}
}
The given script is working in kibana Dev Tools however we can’t use the same script for visualization that we need to generate new field by using Kibana painless script. However while generating new fields for latency to convert the string into number/Timestamp. It doesn’t convert into number, I have also tried another way to generate latency field by importing JSON it also it did not work. Could find these issue anywhere is the resources as well.
I'm not exactly sure what you are trying to do, or what you've tried so far. I would suggest looking at this guide on how to create a scripted field in Kibana: https://www.elastic.co/guide/en/kibana/current/scripted-fields.html . If you add a scripted field to your index pattern you should be able to use it in a visualization.
Bill, I was able to create the filed for Latency through painless scripts, however I am not able to get the data in the Discover field where we get the data in the tables.
In my project repTs and RecTs are in String Type and I couldn’t convert them from string to number(data) with the below painless script.
Script:
(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S").parse(doc['mule.api.analytics.repliedTS.keyword'].value).getTime()) - (new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S").parse(doc['mule.api.analytics.receivedTS.keyword'].value).getTime())
Please help me with the same as I need to finish high prior report due Today.
I would be grateful if you could help me with the same.
Did you look at the scripted field documentation referenced above? This is how you can create a field in Painless and have it be available in discover or visualizations.
Yes, the script I created and the one which is the scripted filed documentation both are same. Now my question is why am I not able to convert the string to number or date in the Index pattern
I was able to create latency filed with the script below: doc['mule.api.analytics.repliedTs'].value.getTime() -
doc['mule.api.analytics.receivedTs'].value.getTime()
However when i choose latency filed it has the warning mentioned below:
This field is present in your elasticsearch mapping but not in any documents in the search results. You may still be able to visualize or search on it.
I was able to create latency filed with the script below: doc['mule.api.analytics.repliedTs'].value.getTime() -
doc['mule.api.analytics.receivedTs'].value.getTime()
However when i This field is present in your elasticsearch mapping but not in any documents in the search results. You may still be able to visualize or search on it.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.