首页 > 其他 > 详细

复合查询

时间:2019-03-03 15:41:41      阅读:177      评论:0      收藏:0      [点我收藏+]

复合查询

  • 将多个基本查询组合成单一查询的查询

    GET /lib2/user/_search
    {
       "query":{
           "bool":{
               "must":{
                   "match":{"interests":"唱歌"}
              },
               "must_not":{
                   "match":{"interests":"旅游"}
              },
               "should":[
                  {"match":{"adress":"bei jing"}}
              ],
               "filter":{
                   "range":{"birthday":{"gte":"1996-01-01"}}
              }
          }
      }
    }
  • constant_score查询:它将一个不变的常量评分应用于所有匹配的文档。它被经常用于你需要执行一个filter而没有其他查询(例如,评分查询)的情况下。

    GET /lib2/user/_search
    {
     "query": {
       "constant_score": {
         "filter": {
           "term": {
             "interests": "唱歌"
          }
        }
      }
    }
    }

复合查询

原文:https://www.cnblogs.com/zxbdboke/p/10465793.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!