Elasticsearch 搜索数组字段


1、搜索 数组字段 tags 中同时存在元素 str_astr_b

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

 

2、搜索 数组字段 tags 中存在元素 str_a 或 str_b

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM