Exemplo n.º 1
0
 def on_update(data):
     _id, obj = util.obj_from_oplog(data, car_offer_cursor.filter)
     if _id and obj:
         index_one(_id)
     else:
         es_sync_util.delete(index=opt['index'],
                             doc_type=opt['type'],
                             data=data,
                             _filter=car_offer_cursor.filter,
                             es_params=opt['params'])
Exemplo n.º 2
0
 def on_delete(data):
     _id = util.obj_from_oplog(data, car_offer_cursor.filter)[0]
     if _id:
         c = es_client.count(index=opt['index'],
                             doc_type=opt['type'],
                             body={'query': {
                                 'term': {
                                     '_id': _id
                                 }
                             }},
                             filter_path=['count'])
         if _.get(c, 'count') > 0:
             es_sync_util.delete(index=opt['index'],
                                 doc_type=opt['type'],
                                 data=data,
                                 _filter=car_offer_cursor.filter,
                                 es_params=opt['params'])
Exemplo n.º 3
0
 def on_delete(data):
     es_sync_util.delete(index=opt['index'],
                         doc_type=opt['type'],
                         data=data,
                         _filter=wx_order_cursor.filter,
                         es_params=opt['params'])