Jayni
Jayni

Reputation: 317

debugging groovy script elasticsearch

How is it possible to print or log some variables using a groovy script for scoring? I know there are log directories, but they don't log what I print in the script.

Upvotes: 7

Views: 2131

Answers (1)

progrrammer
progrrammer

Reputation: 4489

Ok, as you said, Here is my way of doing so.

curl -XPOST "http://localhost:9200/index/type/_search" -d'
{
    "size": 1, 
    "script_fields": {
       "toTestField": {
          "script": "_source.field_name.equals('key')? true : false "
       }
    }

}'

Change the script and Check the value of toTestField in response,

I think it is easy way to debug.

Upvotes: 2

Related Questions