Using script fields in Kibana


(Gal Zolkover) #1

Hi All

I'm new to ES and Kibana and i have a simple question:

I have ES collecting counters and i'd like to present in Kibana KPI based
on the collected counters so i have a script that works in Chrome Sense
extension,
my question is how do i pass this script and execute it via Kibana to
present the calculated counters AKA KPI new calculated fields in the
Dashboard as a histogram and as table?

script example

GET kpi1-xxxx/_search
{

    "script_fields" : {
    "reg_succ_rate" : {
        "script" : "doc['UEREGISTRATIONSUCCESS'].value / 

doc['UEREGISTRATIONATTEMPTS'].value"
},
"test2" : {
"script" : "doc['UEREGISTRATIONATTEMPTS'].value * factor",
"params" : {
"factor" : 1.0
}
}
}
}

Regards

Gal

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7dd9a0be-fc34-4c30-8111-ebe07417528a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #2

Unfortunately not out of the box. If you're up to it, you can probably
create a panel that runs this kind of query in Kibana and wire it in. Need
to learn a little of Angular and Javascript but its doable. :slight_smile:

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/bfeb09a5-8efb-4900-8781-f6b0d062e9bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Gal Zolkover) #3

ok i'm native to java so no issue there, any references i can use or
examples i can follow ?

On Tuesday, April 1, 2014 3:48:19 PM UTC+3, Gal Zolkover wrote:

Hi All

I'm new to ES and Kibana and i have a simple question:

I have ES collecting counters and i'd like to present in Kibana KPI based
on the collected counters so i have a script that works in Chrome Sense
extension,
my question is how do i pass this script and execute it via Kibana to
present the calculated counters AKA KPI new calculated fields in the
Dashboard as a histogram and as table?

script example

GET kpi1-xxxx/_search
{

    "script_fields" : {
    "reg_succ_rate" : {
        "script" : "doc['UEREGISTRATIONSUCCESS'].value / 

doc['UEREGISTRATIONATTEMPTS'].value"
},
"test2" : {
"script" : "doc['UEREGISTRATIONATTEMPTS'].value * factor",
"params" : {
"factor" : 1.0
}
}
}
}

Regards

Gal

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/48560ce2-c39a-4f83-bdea-fd557c21324c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #4

The basic idea is as follows:

  1. In the Kibana src folder, there is a config.js file. At the bottom of
    that file is a list of panel names available to Kibana. You will add your
    new panel name there.

  2. Then, under src/app/panels, create folder that corresponds to your panel
    name and then copy a bunch of files from an existing panel - I'd probably
    use the text panel as the basis for testing and experimentation

  3. Then in your new panel folder, edit the files that you copied from
    another panel so that the name of the panel and references in code matches
    your new panel name

  4. Then study the more complex panels like histogram or table and you
    should be able to duplicate them and adapt to your requirements. Just need
    to inject your script fields right where the query is constructed and then
    extract the script field results and inject into the panel's model data
    structure

It will be time consuming but not impossible. :slight_smile:

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e388fd5d-3686-4f5d-be61-6f72fa599191%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Gal Zolkover) #5

Ok thank you , I'm up for the chalange :grinning:

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ad37c4db-ce55-4e0a-af5b-22d007fa452e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(giu.migliozzi) #6

Hi Gal, if you complete this challenge...can you post the result?

Il giorno martedì 1 aprile 2014 21:57:42 UTC+5:30, Gal Zolkover ha scritto:

Ok thank you , I'm up for the chalange :grinning:

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/41018a05-c994-410f-a21e-dfa5320571fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(linkwoman) #7

Gal, I too would appreciate seeing your solution. Thank you!

On Tuesday, April 1, 2014 9:27:42 AM UTC-7, Gal Zolkover wrote:

Ok thank you , I'm up for the chalange :grinning:

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7e7347fe-dc75-4c97-933c-eddb06484e8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #8