Es 常用命令
索引操作
GET _search { "query": { "bool": { "must": [ { "bool": { "must": [ { "range": { "dt": { "from": "20211001", "to": "20211028" } } } ] } }, { "bool": { "must": [ { "terms": { "pid": [ "100294" ] } } ] } }, { "bool": { "must": [ { "terms": { "mid": [ 1, 2, 3 ] } } ] } }, { "bool": { "must": [ { "terms": { "account_id": [ 21400112, 21401210, 21401211, 21401212, 21401213, 21688884, 21688885, 21688886, 21688888, 21688889, 1696281089303565, 1696367049969677, 1696367050802189, 1696367110029320, 1696367110543367, 1705151365502990, 1705151366017032, 1705151366552584, 1705151367142414, 1705151367900168, 1705151368597511, 1708603462663181, 1708603463529486, 1708603464228878, 1708603464862728, 1708603465416711, 1714648790943758, 1714648791588871, 1714648792055886, 1714648792598535, 1714648793081863, 10020820, 10020823, 10020825, 10020827, 10249828, 10249829, 10249831, 10249832, 10249833, 10292515, 10292516, 10292517, 10292518, 10749450, 10749453, 10749460, 10749464, 10749465 ] } } ] } }, { "bool": { "must": [ { "terms": { "ctype": [ 1, 2 ] } } ] } } ] } }, "aggregations": { "agg_buckets": { "composite": { "size": 4000, "sources": [ { "pid": { "terms": { "field": "pid", "missing_bucket": true, "order": "asc" } } }, { "designer": { "terms": { "field": "designer", "missing_bucket": true, "order": "asc" } } }, { "material_dna_id": { "terms": { "field": "material_dna_id", "missing_bucket": true, "order": "asc" } } } ] }, "aggregations": { "imp": { "sum": { "field": "imp" } }, "mimp": { "sum": { "field": "mimp" } }, "clk": { "sum": { "field": "clk" } }, "landing_clk": { "sum": { "field": "landing_clk" } }, "act": { "sum": { "field": "act" } }, "waken": { "sum": { "field": "waken" } }, "reg": { "sum": { "field": "reg" } }, "active": { "sum": { "field": "active" } }, "pay": { "sum": { "field": "pay" } }, "price": { "sum": { "field": "price" } }, "price_sort": { "bucket_sort": { "sort": { "price": { "order": "desc" } } } }, "key_action": { "sum": { "field": "key_action" } }, "pay_first_day": { "sum": { "field": "pay_first_day" } }, "pay_purchase_amount_first_day": { "sum": { "field": "pay_purchase_amount_first_day" } }, "pay_purchase_amount": { "sum": { "field": "pay_purchase_amount" } }, "form_count": { "sum": { "field": "form_count" } }, "valid_play": { "sum": { "field": "valid_play" } }, "total_play": { "sum": { "field": "total_play" } }, "play10_feed_break": { "sum": { "field": "play10_feed_break" } }, "play25_feed_break": { "sum": { "field": "play25_feed_break" } }, "play50_feed_break": { "sum": { "field": "play50_feed_break" } }, "play75_feed_break": { "sum": { "field": "play75_feed_break" } }, "play95_feed_break": { "sum": { "field": "play95_feed_break" } }, "play99_feed_break": { "sum": { "field": "play99_feed_break" } }, "play100_feed_break": { "sum": { "field": "play100_feed_break" } }, "averge_play_time_per_play": { "sum": { "field": "averge_play_time_per_play" } }, "video_outer_play_time_count": { "sum": { "field": "video_outer_play_time_count" } }, "wifi_play": { "sum": { "field": "wifi_play" } }, "card_show": { "sum": { "field": "card_show" } }, "play3s_count": { "sum": { "field": "play3s_count" } }, "play5s_count": { "sum": { "field": "play5s_count" } }, "play7s_count": { "sum": { "field": "play7s_count" } }, "follow": { "sum": { "field": "follow" } }, "like": { "sum": { "field": "like" } }, "comment": { "sum": { "field": "comment" } }, "share": { "sum": { "field": "share" } }, "message_action": { "sum": { "field": "message_action" } }, "download_start": { "sum": { "field": "download_start" } }, "download_finish": { "sum": { "field": "download_finish" } }, "install_finish": { "sum": { "field": "install_finish" } }, "play_over_rate": { "avg": { "field": "play_over_rate" } }, "video_outer_play_time_avg_rate": { "avg": { "field": "video_outer_play_time_avg_rate" } }, "play3s_ratio": { "avg": { "field": "play3s_ratio" } }, "play5s_ratio": { "avg": { "field": "play5s_ratio" } }, "cpc": { "bucket_script": { "script": { "source": "params.price/params.clk/100" }, "buckets_path": { "price": "price", "clk": "clk" } } }, "ctr": { "bucket_script": { "script": { "source": "params.clk/params.imp*100" }, "buckets_path": { "clk": "clk", "imp": "imp" } } }, "cpm": { "bucket_script": { "script": { "source": "params.price/params.imp/100*1000" }, "buckets_path": { "price": "price", "imp": "imp" } } }, "act_price": { "bucket_script": { "script": { "source": "params.price/params.act/100" }, "buckets_path": { "price": "price", "act": "act" } } }, "reg_price": { "bucket_script": { "script": { "source": "params.price/params.reg/100" }, "buckets_path": { "price": "price", "reg": "reg" } } }, "active_price": { "bucket_script": { "script": { "source": "params.price/params.active/100" }, "buckets_path": { "price": "price", "active": "active" } } }, "act_rate": { "bucket_script": { "script": { "source": "params.act/params.clk*100" }, "buckets_path": { "act": "act", "clk": "clk" } } }, "active_rate": { "bucket_script": { "script": { "source": "params.active/params.act*100" }, "buckets_path": { "active": "active", "act": "act" } } }, "reg_rate": { "bucket_script": { "script": { "source": "params.reg/params.clk*100" }, "buckets_path": { "reg": "reg", "clk": "clk" } } }, "first_day_roi": { "bucket_script": { "script": { "source": "params.pay_purchase_amount_first_day/params.price*100" }, "buckets_path": { "pay_purchase_amount_first_day": "pay_purchase_amount_first_day", "price": "price" } } }, "roi": { "bucket_script": { "script": { "source": "params.pay_purchase_amount/params.price*100" }, "buckets_path": { "pay_purchase_amount": "pay_purchase_amount", "price": "price" } } }, "key_action_price": { "bucket_script": { "script": { "source": "params.price/params.key_action/100" }, "buckets_path": { "price": "price", "key_action": "key_action" } } }, "pay_first_day_price": { "bucket_script": { "script": { "source": "params.price/params.pay_first_day/100" }, "buckets_path": { "price": "price", "pay_first_day": "pay_first_day" } } }, "pay_count_price": { "bucket_script": { "script": { "source": "params.price/params.pay/100" }, "buckets_path": { "price": "price", "pay": "pay" } } }, "valid_play_price": { "bucket_script": { "script": { "source": "params.price/params.valid_play/100" }, "buckets_path": { "price": "price", "valid_play": "valid_play" } } }, "download_start_price": { "bucket_script": { "script": { "source": "params.price/params.download_start/100" }, "buckets_path": { "price": "price", "download_start": "download_start" } } }, "download_finish_price": { "bucket_script": { "script": { "source": "params.price/params.download_finish/100" }, "buckets_path": { "price": "price", "download_finish": "download_finish" } } }, "install_finish_price": { "bucket_script": { "script": { "source": "params.price/params.install_finish/100" }, "buckets_path": { "price": "price", "install_finish": "install_finish" } } }, "key_action_rate": { "bucket_script": { "script": { "source": "params.key_action/params.act*100" }, "buckets_path": { "key_action": "key_action", "act": "act" } } }, "pay_count_rate": { "bucket_script": { "script": { "source": "params.pay/params.reg*100" }, "buckets_path": { "pay": "pay", "reg": "reg" } } }, "valid_play_rate": { "bucket_script": { "script": { "source": "params.valid_play/params.total_play*100" }, "buckets_path": { "valid_play": "valid_play", "total_play": "total_play" } } }, "wifi_play_rate": { "bucket_script": { "script": { "source": "params.wifi_play/params.total_play*100" }, "buckets_path": { "wifi_play": "wifi_play", "total_play": "total_play" } } }, "play7s_ratio": { "bucket_script": { "script": { "source": "params.play7s_count/params.total_play*100" }, "buckets_path": { "play7s_count": "play7s_count", "total_play": "total_play" } } }, "download_start_rate": { "bucket_script": { "script": { "source": "params.download_start/params.clk*100" }, "buckets_path": { "download_start": "download_start", "clk": "clk" } } }, "download_finish_rate": { "bucket_script": { "script": { "source": "params.download_finish/params.download_start*100" }, "buckets_path": { "download_finish": "download_finish", "download_start": "download_start" } } }, "install_finish_rate": { "bucket_script": { "script": { "source": "params.install_finish/params.download_finish*100" }, "buckets_path": { "install_finish": "install_finish", "download_finish": "download_finish" } } } } } } } GET _search { "query": { "bool": { "must": [ { "bool": { "must": [ { "range": { "dt": { "from": "20211108", "to": "20211115" } } } ] } }, { "bool": { "must": [ { "terms": { "pid": [ "100277" ] } } ] } }, { "bool": { "must": [ { "terms": { "mid": [ 1, 2, 3 ] } } ] } }, { "bool": { "must": [ { "terms": { "account_id": [ 19788205, 22363376, 22363377, 22363378 ] } } ] } }, { "bool": { "must": [ { "terms": { "ctype": [ 1, 2 ] } } ] } } ] } }, "aggregations": { "agg_buckets": { "composite": { "size": 200000, "sources": [ { "pid": { "terms": { "field": "pid", "missing_bucket": true, "order": "asc" } } }, { "material_dna_id": { "terms": { "field": "material_dna_id", "missing_bucket": true, "order": "asc" } } } ] }, "aggregations": { "imp": { "sum": { "field": "imp" } }, "mimp": { "sum": { "field": "mimp" } }, "clk": { "sum": { "field": "clk" } }, "landing_clk": { "sum": { "field": "landing_clk" } }, "act": { "sum": { "field": "act" } }, "waken": { "sum": { "field": "waken" } }, "reg": { "sum": { "field": "reg" } }, "active": { "sum": { "field": "active" } }, "pay": { "sum": { "field": "pay" } }, "price": { "sum": { "field": "price" } }, "key_action": { "sum": { "field": "key_action" } }, "pay_first_day": { "sum": { "field": "pay_first_day" } }, "pay_purchase_amount_first_day": { "sum": { "field": "pay_purchase_amount_first_day" } }, "pay_purchase_amount": { "sum": { "field": "pay_purchase_amount" } }, "form_count": { "sum": { "field": "form_count" } }, "valid_play": { "sum": { "field": "valid_play" } }, "total_play": { "sum": { "field": "total_play" } }, "play10_feed_break": { "sum": { "field": "play10_feed_break" } }, "play25_feed_break": { "sum": { "field": "play25_feed_break" } }, "play50_feed_break": { "sum": { "field": "play50_feed_break" } }, "play75_feed_break": { "sum": { "field": "play75_feed_break" } }, "play95_feed_break": { "sum": { "field": "play95_feed_break" } }, "play99_feed_break": { "sum": { "field": "play99_feed_break" } }, "play100_feed_break": { "sum": { "field": "play100_feed_break" } }, "averge_play_time_per_play": { "sum": { "field": "averge_play_time_per_play" } }, "video_outer_play_time_count": { "sum": { "field": "video_outer_play_time_count" } }, "wifi_play": { "sum": { "field": "wifi_play" } }, "card_show": { "sum": { "field": "card_show" } }, "play3s_count": { "sum": { "field": "play3s_count" } }, "play5s_count": { "sum": { "field": "play5s_count" } }, "play7s_count": { "sum": { "field": "play7s_count" } }, "follow": { "sum": { "field": "follow" } }, "like": { "sum": { "field": "like" } }, "comment": { "sum": { "field": "comment" } }, "share": { "sum": { "field": "share" } }, "message_action": { "sum": { "field": "message_action" } }, "download_start": { "sum": { "field": "download_start" } }, "download_finish": { "sum": { "field": "download_finish" } }, "install_finish": { "sum": { "field": "install_finish" } }, "play_over_rate": { "avg": { "field": "play_over_rate" } }, "video_outer_play_time_avg_rate": { "avg": { "field": "video_outer_play_time_avg_rate" } }, "play3s_ratio": { "avg": { "field": "play3s_ratio" } }, "play5s_ratio": { "avg": { "field": "play5s_ratio" } }, "cpc": { "bucket_script": { "script": { "source": "params.price/params.clk/100" }, "buckets_path": { "price": "price", "clk": "clk" } } }, "ctr": { "bucket_script": { "script": { "source": "params.clk/params.imp*100" }, "buckets_path": { "clk": "clk", "imp": "imp" } } }, "cpm": { "bucket_script": { "script": { "source": "params.price/params.imp/100*1000" }, "buckets_path": { "price": "price", "imp": "imp" } } }, "act_price": { "bucket_script": { "script": { "source": "params.price/params.act/100" }, "buckets_path": { "price": "price", "act": "act" } } }, "reg_price": { "bucket_script": { "script": { "source": "params.price/params.reg/100" }, "buckets_path": { "price": "price", "reg": "reg" } } }, "active_price": { "bucket_script": { "script": { "source": "params.price/params.active/100" }, "buckets_path": { "price": "price", "active": "active" } } }, "act_rate": { "bucket_script": { "script": { "source": "params.act/params.clk*100" }, "buckets_path": { "act": "act", "clk": "clk" } } }, "active_rate": { "bucket_script": { "script": { "source": "params.active/params.act*100" }, "buckets_path": { "active": "active", "act": "act" } } }, "reg_rate": { "bucket_script": { "script": { "source": "params.reg/params.clk*100" }, "buckets_path": { "reg": "reg", "clk": "clk" } } }, "first_day_roi": { "bucket_script": { "script": { "source": "params.pay_purchase_amount_first_day/params.price*100" }, "buckets_path": { "pay_purchase_amount_first_day": "pay_purchase_amount_first_day", "price": "price" } } }, "roi": { "bucket_script": { "script": { "source": "params.pay_purchase_amount/params.price*100" }, "buckets_path": { "pay_purchase_amount": "pay_purchase_amount", "price": "price" } } }, "key_action_price": { "bucket_script": { "script": { "source": "params.price/params.key_action/100" }, "buckets_path": { "price": "price", "key_action": "key_action" } } }, "pay_first_day_price": { "bucket_script": { "script": { "source": "params.price/params.pay_first_day/100" }, "buckets_path": { "price": "price", "pay_first_day": "pay_first_day" } } }, "pay_count_price": { "bucket_script": { "script": { "source": "params.price/params.pay/100" }, "buckets_path": { "price": "price", "pay": "pay" } } }, "valid_play_price": { "bucket_script": { "script": { "source": "params.price/params.valid_play/100" }, "buckets_path": { "price": "price", "valid_play": "valid_play" } } }, "download_start_price": { "bucket_script": { "script": { "source": "params.price/params.download_start/100" }, "buckets_path": { "price": "price", "download_start": "download_start" } } }, "download_finish_price": { "bucket_script": { "script": { "source": "params.price/params.download_finish/100" }, "buckets_path": { "price": "price", "download_finish": "download_finish" } } }, "install_finish_price": { "bucket_script": { "script": { "source": "params.price/params.install_finish/100" }, "buckets_path": { "price": "price", "install_finish": "install_finish" } } }, "key_action_rate": { "bucket_script": { "script": { "source": "params.key_action/params.act*100" }, "buckets_path": { "key_action": "key_action", "act": "act" } } }, "pay_count_rate": { "bucket_script": { "script": { "source": "params.pay/params.reg*100" }, "buckets_path": { "pay": "pay", "reg": "reg" } } }, "valid_play_rate": { "bucket_script": { "script": { "source": "params.valid_play/params.total_play*100" }, "buckets_path": { "valid_play": "valid_play", "total_play": "total_play" } } }, "wifi_play_rate": { "bucket_script": { "script": { "source": "params.wifi_play/params.total_play*100" }, "buckets_path": { "wifi_play": "wifi_play", "total_play": "total_play" } } }, "play7s_ratio": { "bucket_script": { "script": { "source": "params.play7s_count/params.total_play*100" }, "buckets_path": { "play7s_count": "play7s_count", "total_play": "total_play" } } }, "download_start_rate": { "bucket_script": { "script": { "source": "params.download_start/params.clk*100" }, "buckets_path": { "download_start": "download_start", "clk": "clk" } } }, "download_finish_rate": { "bucket_script": { "script": { "source": "params.download_finish/params.download_start*100" }, "buckets_path": { "download_finish": "download_finish", "download_start": "download_start" } } }, "install_finish_rate": { "bucket_script": { "script": { "source": "params.install_finish/params.download_finish*100" }, "buckets_path": { "install_finish": "install_finish", "download_finish": "download_finish" } } } } } } }
-- 设置处理数据的上线,默认10万 PUT _cluster/settings { "transient": { "search.max_buckets": 200000 } } PUT ug_stats_creative_hourly/_settings { "max_result_window" : 200000 } PUT ug_stats_creative_hourly_base_reports/_settings { "max_result_window" : 200000 } PUT ug_stats_hourly_base_reports/_settings { "max_result_window" : 200000 } PUT ug_stats_hourly/_settings { "max_result_window" : 200000 }
知止而后有定,定而后能静,静而后能安,安而后能虑,虑而后能得。
所谓诚其意者,毋自欺也。