Elasticsearch 多字段值匹配

牧云@^-^@ 提交于 2020-02-10 05:35:39
GET /data_stat_index/_search{
  "query":{
    "bool":{
      "must":[
        {
          "match":{ "category":"rdfdb" }
        },
        {
          "match":{ "region":"CN2" }
        },
        {
          "match":{ "vendor":"AUTONAVI"  }
        },
        {
          "match":{ "name":"cn_axf_17q3"}
        }
        ]
      }
    }
  }

  利用elasticsearch 查询多个字段的值:

must 表示下面所有条件满足;

match 匹配某字段, 是查询的是具有解析类型的字段;https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#query-dsl-match-query-fuzziness。

Elasticsearch 6 以后 具有解析类型的字段为 text, 不具有解析类型的字段为keyword. 默认会为text类型的字段创建 keyword类型的field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!