Log data sending response-time in string format. So it is not showing in aggregations unless it's in number format. How to convert string to number in Painless script Kibana or any other alternative options? Please advise.
Kibana can with Scripted fields but that is not really converting the field , it is creating a new dynamic field
You need to actually send it to Elastic as a Int and Set the Mapping of your index so the field is a int not string
for example if you groking the field "%{NUMER:responseTime:int} adding the int will make it an integer (you can use float if it is a decimal) or you can do it with the "MUTATE" filter to convert the field from string to whatever
Your options would work but our data is coming from AWS CloudWatch logs and I don't have control on Elasticsearch. Can I make string to int in painless script in Kibana? If so can you provide me an example.
Thinking about it a little bit more I think I over thought your issue.
You will have to change the Mappings of your index. If you mapping data says "response-time" is a int , Elastic will try to convert the "string" to int. and if your mapping says it is a "String" it will convert int's to strings. So even if you write a painless script it will remain the same type
Changing the mapping will help you on all future data, old history will have to be re-indexed to pickup the new changes but then you don't have to write a script to run all the time you get new data
Btw, now you have to make this file a template , its bacically just adding the "template matching" and any additional information you need when the index is created
I am not able to write a full tutorial on this for you, you may want to try googling are reading the rest of the docs.
It is pretty easy to do but it is a wide subject
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.