Exemple #1
0
def send2esBulk(index, type, data):
    '''
    向ES中的某个type下新增批量数据
    '''
    execute = str.format('/{}/{}/_bulk', index, type)
    print execute
    result = httpPOST(config.ES_HOST, config.ES_PORT, execute, data)
    return result
Exemple #2
0
def sendSingleObjToEs(index, type, data):
    '''
        index:索引名称
        type:表名称
        data:需要插入的数据
    '''
    execute = str.format('/{}/{}/', index, type)
    result = httpPOST(config.ES_HOST, config.ES_PORT, execute, data)
    return result