我使用elasticsearch搜索来检索一些文档,我想做一个简单的声明,如:
if ((a == "1" || b == "2") || (c == "3" && d == "4"))
我使用第一个语句((a ==“1”|| b ==“2”))
$filter ['bool'] ['must'] [] = array (
'bool' => array (
'should' => array (
array (
'terms' => array (
'a' => $aName
)
),
array (
'terms' => array (
'b' => $bName
)
),
),
)
);
但是在我迷路之后。我不知道如何添加:
(c == "3" && d == "4")
答案 0 :(得分:0)
看看Nesting Boolean Filters。对于你的情况,我相信这样的事情会起作用:
username = input("Please enter your username: ")[5]
if username == 'admin':
break
else:
print("You've given incorrect credentials thrice.")
import sys
sys.exit("Exiting...")
while True:
password = input("Please enter your password: ")
if password == 'KhS9':
break
print("Welcome admin!")
从这里将它转换回php应该很容易。