我对 Elasticsearch 相当陌生。我正在尝试将基本逻辑查询映射到 elasticsearch 查询 DSL。
我知道 bool 用于对 ES 进行布尔(逻辑)查询。我可以映射 if (cond1 && cond2) 之类的查询,但我不明白如何进行 if(cond1 || cond2) 之类的 OR 查询
逻辑查询
if(attr1==val1 && attr2=val2){}
弹性搜索 DSL
"bool" : {
"must" : {
["term":{"attr1":"val1"}, {"term":"attr2":"val2"}]
}
}
我写if(attr1==val1 || attr2==val2)
什么?