在 ES 里我想把两个字段的值是一样的查出来。

2023-07-21 19:14:52 浏览数 (1)

代码语言:javascript复制
if (Objects.nonNull(param.getAreaEqualSecondAreaId()) && param.getAreaEqualSecondAreaId()) {
Map<String, Object> params = new HashMap<>();
String idOrCode = "doc['area_id'].value - doc['second_area_id'].value == 0";
Script script = new Script(ScriptType.INLINE, "painless", idOrCode, params);
ScriptQueryBuilder scriptQueryBuilder = new ScriptQueryBuilder(script);
builder.must(scriptQueryBuilder);
}

0 人点赞