in ES version 5.x, I used this query and works well.
"bool": {
"must": [
{
"script": {
"script": {
"inline": "params['_source']['my_field'] != null",
"lang": "painless"
},
BUT in ES version 6.2, It's error with below error message.
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"params['_source']['my_field'] != null"
,
" ^---- HERE"
],
"script": "params['_source']['my_field'] != null",
"lang": "painless"
}
],
There is no '_source' data in params. because there is no return data with below query.
"inline": "params['_source'] != null",
How should I do with this error?