我使用以下代码构建脚本化查询
ScriptQueryBuilder sb = new ScriptQueryBuilder( new Script("ctx._source.id=9"));
--> This is produing the following ES query where script tag has been created twice
{
"script" : {
"script" : {
"inline" : "ctx._source.id=9",
"lang" : "painless"
},
"boost" : 1.0
}
}
当我更改为查询构建器时,脚本标记仍然生成两次如何克服
QueryBuilder qb = QueryBuilders.scriptQuery(new Script("ctx._source.id=9"));
{
"script" : {
"script" : {
"inline" : "ctx._source.id=9",
"lang" : "painless"
},
"boost" : 1.0
}
}
我错过了什么?如何删除额外的脚本标签?
以下是使用
的代码QueryBuilder qb = QueryBuilders.scriptQuery(new Script("ctx._source.id=10"));
Update update = new Update.Builder(qb).index(index).type(type).id("1").build();
JestResult result = JestClientInstance.getInstance().getClient().execute(update);