【发布时间】:2022-09-27 21:37:11
【问题描述】:
我想在我的弹性搜索查询中有三个条件,因此我写如下。但我不知道为什么它会返回一个 DOCUMENT,其中 AMOUNT 为 250 并且它存在,而我的条件至少是两者之一,即 AMOUNT 小于或等于零或 AMOUNT 不应该存在。
{
\"from\":0,
\"size\":10,
\"track_total_hits\":true,
\"_source\": [\"amount\", \"npa_stageid_loanaccounts\"],
\"query\":{
\"bool\":{
\"must\":[
{
\"query_string\":{
\"default_field\":\"npa_stageid_loanaccounts.keyword\",
\"query\":\"Y\"
}
},
{
\"bool\":{
\"minimum_should_match\":1,
\"should\":[
{
\"range\":{
\"Amount\":{
\"lte\":0
}
}
},
{
\"bool\":{
\"must_not\":[
{
\"exists\":{
\"field\":\"Amount\"
}
}
]
}
}
]
}
}
]
}
}
}
标签: elasticsearch elasticsearch-dsl