I was looking around and came across 'scripted fields', the painless feature is great and also supports native Java methods. I just have a couple of question.
but on my installation, I can only access it with
First question: Why does it say here value and not date, even though the data format is 'date'
I would like to display on my x-axis the day of the month next to the month name
12 Feb" or "12. Feb
because right now my x-axis is formatted as "YYYY-MM-DD"
I know I can change it in Management => Advanced Settings => dateFormat:scaled
but this setting applies globally and since I just want to have specific visualization displayed with the month name, I would like to take the 'scripted field' solution
My code for the scripted field is:
def month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September','October', 'November', 'December' ]; return (doc["@timestamp"].value.monthOfYear+". "+month[(doc["@timestamp"].value.monthOfYear)-1])
Output is: 12. February
As you can see, Im concatenating the values which is the result of a return type of "String".
So trying to use this scripted field for the visualization for the x-axis results into Unexepected data type.
Second Question: Does someone have a solution for this?
I looked around in the native Java library but the documentation of Elastic does not really show how to call/invoke the functions within the painless/scripted field environment.
Third Question: How can I invoke the native Java methods within the scipted field env? Im using the Kibana UI on the Management as an Editor and there is no Code Completion, so its hard to try out the things on your own