專案

一般

配置概況

工作單 #86 » tf_momo_smartfds_login_daily.json

marlboro chu, 2025-05-26 03:37

 
{
"source": {
"index": "momo_smartfds_login*"
},
"dest": {
"index": "momo_smartfds_all_daily"
},
"frequency": "1h",
"sync": {
"time": {
"field": "create_datetime",
"delay": "60s"
}
},
"pivot": {
"group_by": {
"datetime_field": {
"date_histogram": {
"field": "create_datetime",
"calendar_interval": "day"
}
}
},
"aggregations": {
"decision_code_terms": {
"scripted_metric": {
"init_script": "state.docs = new HashMap();",
"map_script": "if (doc.containsKey('decision_code') && doc['decision_code'].size() > 0) { def code = doc['decision_code'].value; state.docs.put(code, state.docs.getOrDefault(code, 0) + 1); } else { state.docs.put('nullvalue', state.docs.getOrDefault('nullvalue', 0) + 1); }",
"combine_script": "return state.docs;",
"reduce_script": "def result = new HashMap(); for (state in states) { for (entry in state.entrySet()) { result.put(entry.getKey(), result.getOrDefault(entry.getKey(), 0) + entry.getValue()); } } return result;"
}
},
"missing_decision_code": {
"cardinality": {
"field": "decision_code"
}
},
"total_count": {
"value_count": {
"field": "_id"
}
}
}
}
}

(7-7/12)