Beispiel #1
0
def sensitive_func(index_name, ts):
    bulk_action = []
    query_body = {
        'query': {
            'match_all': {}
        },
        'size': 999,
    }
    res = es.search(index=index_name, doc_type='text',
                    body=query_body)['hits']['hits']
    for r in res:
        _id = r['_id']
        uid = r['_source']['uid']
        mid = ''
        if r['_source'].has_key('mid'):
            mid = r['_source']['mid']
        text = ''
        if r['_source'].has_key('text'):
            text = r['_source']['text']
        sensitive_info = get_sensitive_info(ts, mid, text)
        sensitive_user = get_sensitive_user(ts, uid)
        item = {
            'sensitive_info': sensitive_info,
            'sensitive_user': sensitive_user,
        }

        action = {'update': {'_id': _id}}
        bulk_action.extend([action, {'doc': item}])
    if bulk_action:
        print es.bulk(bulk_action,
                      index=index_name,
                      doc_type='text',
                      timeout=600)
Beispiel #2
0
def sensitive_func(ts, text, uid):
    sensitive_info = get_sensitive_info(ts, text)
    sensitive_user = get_sensitive_user(ts, uid)
    return sensitive_info, sensitive_user
Beispiel #3
0
def sensitive_func(ts, text, uid):
    sensitive_info = get_sensitive_info(timestamp=ts, text=text)
    sensitive_user = get_sensitive_user(timestamp=ts, uid=uid)
    return sensitive_info, sensitive_user