I am using the following code to build the scripted query
ScriptQueryBuilder sb = new ScriptQueryBuilder( new Script("ctx._source.id=9"));
--> This is producing the following ES query
{
"script" : {
"script" : {
"inline" : "ctx._source.id=9",
"lang" : "painless"
},
"boost" : 1.0
}
}
When I changed to query builder
QueryBuilder qb = QueryBuilders.scriptQuery(new Script("ctx._source.id=9"));
{
"script" : {
"script" : {
"inline" : "ctx._source.id=9",
"lang" : "painless"
},
"boost" : 1.0
}
}
M i missing anything ?
when running the both of the above query's Iam getting the following exception
{"root_cause":[{"type":"illegal_argument_exception","reason":"[script] unknown field [script], parser not found"}],"type":"illegal_argument_exception","reason":"[script] unknown field [script], parser not found"}