1. 程式人生 > >查詢new特徵的使用者並去重

查詢new特徵的使用者並去重

GET app_test/_search
{
   "query": {
      "bool": {
        "must": [
          {
            "has_parent": {
              "parent_type": "user_specil",
              "query" : {
                 "match" : {
                   "user_key.keyword": "new"
                 }
              }
            }
          },
          {
            "term": {
              "phone.keyword": "android"
            }  
          }
        ]
      }
   },
  "collapse": {
    "field": "userid.keyword"
  },
  "aggs": {
    "diff_user": {
      "cardinality" : {
        "field": "userid.keyword"
      }
    }
  },
  "size": 0
}