ES脚本笔记 Posted on 2021-09-07 | In AiSpeeech 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485#脚本查type非数字的粉丝数POST /weibo_interest_push_material_alias/_search{ "track_total_hits": true, "query": { "bool": { "must": [ { "query_string": { "default_field": "FIELD", "query": """ +features.static_features.user_fans_num:[* TO *] +features.static_features.text_length:[140 TO *] -features.static_features.has_link: 1 -content_tag.tag_name:财经 -_exists_:filter_rules.content_rules.keyword """ } }, { "script": { "script": """ def my_val = Integer.parseInt(doc['features.static_features.user_fans_num.keyword'].value); if(my_val>=0&&my_val<1000) return true;else return false; """ } } ] } }, "aggs": { "day": { "terms": { "field": "kibana_info.store_at_day.keyword", "size": 1000 } } }, "size": 1000}#聚合查点赞数GET /weibo_interest_push_material_alias/_search{ "query": { "bool": { "must": [ {"range": { "features.static_features.text_length": { "gte": 140 } }}, {"range": {"kibana_info.store_at_day": {"gte": 20210805,"lt":20210905}}}, {"range": {"features.static_features.hot_his_like": {"gte": 1,"lt":1000}}} ], "must_not": [ {"term": { "features.static_features.has_link": { "value": 1 } }}, {"terms": { "content_tag.tag_name": [ "财经" ] }}, {"exists": {"field": "filter_rules.content_rules.keyword"}} ] } }, "aggs": { "day": { "terms": { "field": "kibana_info.store_at_day.keyword", "size": 1000 } } }, "size": 0}