Why I am getting error while executing this query

2019-09-19 05:27发布

问题:

My query in ElasticSearch :

'filter':{              
  'script':{                
      'script':'_source.brand == \"samsung galaxy\"'        
   }        
 }

The error I get :

     {
          "shard": 0,
          "index": "test_database",
          "node": "yHIFcx8LQzCJHFYydcpdgA",
          "reason": {
            "type": "script_exception",
            "reason": "scripts of type [inline], operation [search] and lang [groovy] are disabled"
          }
        }
      ]
    },
    "status": 500
  }

回答1:

You need to enable dynamic scripting in elasticsearch.yml and then restart your node. Add this to your configuration file:

script.inline: true