Wednesday, December 12, 2018

การใช้ or operation ใน elasticsearch

ตัวอย่างการทำ bool query หาบทความที่มี title คำว่า Previous หรือ hyperspectral

GET aci/article/_search?pretty=true
{
  "query": {
    "bool": {
      "must": [
           {
               "bool": {
                   "should": [
                      {"match_phrase": { "title": "Previous" }},
                      {"match_phrase": { "tltle": "hyperspectral" }}
                   ]
               }
           }
        ]
    }
  }
}

No comments:

Post a Comment