我是彈性搜索的新手。我正在嘗試撰寫 elasticsearch 查詢以回傳 或 值。如果 statusfield == status1 或 statusfield == status2,則回傳結果。下面的查詢給出了錯誤
{
"query": {
"bool": {
"must": [
{
"match": {
"status": ["status1","status2"]
}
}
],
"must_not": [],
"should": []
}
}
}
uj5u.com熱心網友回復:
使用termswhich 接受一組值而不是matchwhich 不接受
{
"query": {
"bool": {
"must": [
{
"terms": { <--- change this
"status": ["status1","status2"]
}
}
],
"must_not": [],
"should": []
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/365797.html
標籤:弹性搜索
