1 回答

TA貢獻(xiàn)2039條經(jīng)驗(yàn) 獲得超8個(gè)贊
試試這個(gè):
$items = $this->elasticsearch->search([
'index' => $index_name,
'body' => [
'query' => [
'bool' => [
'must' => [
['match' => ['nits_account' => $account] ],
['match' => ['nits_url' => $domain] ]
],
],
]
]
]);
您應(yīng)該使用關(guān)鍵字,而不是關(guān)鍵字。 行為類似于 AND 操作,而作用類似于 OR 操作。mustshouldmustshould
請(qǐng)參閱此 https://stackoverflow.com/a/28768600/5430055
如果需要使用條件匹配,請(qǐng)使用如下內(nèi)容:
"query": {
"bool": {
"must": [
{
"range": {
"nits_url": {
"gte": 1000,
"lte": 10000
}
}
},
{
"match": {
"nits_account": "$account"
}
}
]
}
}
- 1 回答
- 0 關(guān)注
- 122 瀏覽
添加回答
舉報(bào)