ElasticSearch DSL查询不适用于具有多个字段(“术语”)参数的“必须”过滤器

时间:2018-07-11 11:12:32

标签: elasticsearch kibana

ElasticSearch DSL查询不适用于具有多个字段项的“必须”过滤器

*例如在SQL中=> 从my_type中选择*,其中email='david@gmail.com'和password ='test'

我的弹性查询

 GET rangadb/user/_search {    "query" : {
  "constant_score" : { 
     "filter" : {
        "bool" : {
          "must" : [
             { "term" : {"email": "david@gmail.com"}},
             { "term" : { "password": "test"}} 
          ]
        }
     }
  }    
}    }

但是:我的数据在弹性内建立了索引,能够使用完整的搜索API来获取

API = GET / rangadb / user / _search

结果

"hits": [
  {
    "_index": "rangadb",
    "_type": "user",
    "_id": "7YTCamQBL7qmMu7d2wqI",
    "_score": 1,
    "_source": {
      "name": "David",
      "email": "david@gmail.com",
      "password": "test",
      "date": "2018-07-05T14:04:55.727Z"
    }
  },

0 个答案:

没有答案