Groovy in kibana

Hi Team,

I am new to kibana just started working on it.I want to know how to use groovy script in kibana.
i tried below command in search
{ "filtered" : { "filter" : { "script" : { "script" : "groovy.txt" } } } }
i got error stating "failed to run inline script [groovy.txt] using lang [groovy]".

Can anyone help on this issue ?

If you want to run a script that's in a file you'll need to place it in the correct directory under Elasticsearch's home and use a query body like this:

{
  "script_fields": {
    "my_field": {
      "script": {
        "file": "my_script",
        "params": {
          "my_var": 2
        }
      }
    }
  }
}

You'll probably want to check out the docs on scripting here https://www.elastic.co/guide/en/elasticsearch/reference/2.3/modules-scripting.html