Elasticsearch 搜索數組字段

我的個人博客:逐步前行STEP

1、搜索 數組字段 tags 中同時存在元素 str_astr_b

{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "tags": "str_a"
          }
        },
        {
          "term": {
            "tags": "str_b"
          }
        }
      ]
    }
  }
}

2、搜索 數組字段 tags 中存在元素 str_astr_b

{
  "query": {
    "bool": {
      "filter": [
        {
          "terms": {
            "tags": [
              "str_a",
              "str_b"
            ]
          }
        }
      ]
    }
  }
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章