ES基础四 in查询和between



POST /forum/article/_bulk
{ "update": { "_id": "1"} }
{ "doc" : {"tag" : ["java", "hadoop"]} }
{ "update": { "_id": "2"} }
{ "doc" : {"tag" : ["java"]} }
{ "update": { "_id": "3"} }
{ "doc" : {"tag" : ["hadoop"]} }
{ "update": { "_id": "4"} }
{ "doc" : {"tag" : ["java", "elasticsearch"]} }


GET /forum/article/_search { "query": { "constant_score": { "filter": { "terms": { "articleID": [ "KDKE-B-9947-#kL5", "QQPX-R-3956-#aD8" ] } } } } }


GET /forum/article/_search
{
"query": {
"constant_score": {
"filter": {
"terms": {
"tag": [
"java",
"elasticsearch"
]
}
}
}
}
}




terms字段后面必须是数组

 

GET /forum/article/_search
{
  "query": {"constant_score": {
    "filter":  {
      "range": {
        "view_cnt": {
          "gte": 40,
          "lte": 60
        }
      }
    }
  }}
}

 

posted @ 2020-06-07 16:06  javabeginer  阅读(4228)  评论(0编辑  收藏  举报