Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elastic search error operation [search] and lang [groovy] is disabled?

I am using elastic search 1.7.1 and when i am trying to use script_score or script_fields it is showing the error ScriptException[scripts of type inline], operation [search] and lang [groovy] is disabled can anyone please tell me how can i remove this error. my code is given below

function_score: {
        query: {
          query_string: {
            query: shop_search,
            fields: [ 'shop_name']
          } 
        },    
        functions: [
          {
            script_score: {
              script: "_score * doc['location'].value"
            }
          }
        ]
      }
like image 922
divanshu pratap Avatar asked Sep 17 '15 16:09

divanshu pratap


3 Answers

Add script.engine.groovy.inline.search: on to elasticsearch.yml configuration file and restart the node.

like image 50
Andrei Stefan Avatar answered Nov 06 '22 08:11

Andrei Stefan


adding script.groovy.sandbox.enabled: true to .yml works for me

For ES Version 2.x+

script.inline: on
script.indexed: on
like image 26
Eyal Ch Avatar answered Nov 06 '22 09:11

Eyal Ch


Add script.engine.groovy.inline.aggs: on script.engine.groovy.inline.update: on to elasticsearch.yml and restart

like image 7
Yc.Tan Avatar answered Nov 06 '22 10:11

Yc.Tan