Beispiel #1
0
def delete_snapshot_nodes_by_id(id_list):
    if not isinstance(id_list, list):
        id_list = [id_list]

    es = Common.get_elasticsearch().get_connection()
    for i in id_list:
        try:
            es.delete(index=SNAPSHOT_INDEX, doc_type=SNAPSHOT_DOC_TYPE, id=i)
        except ElasticsearchException, e:
            Common.get_logger().error('Error deleting node<%s>\n%s' % (i, e))
Beispiel #2
0
def execute_query(query, **kwargs):
    es = Common.get_elasticsearch().get_connection()
    try:
        response = es.search(index=SNAPSHOT_INDEX,
                             doc_type=SNAPSHOT_DOC_TYPE,
                             body=query,
                             **kwargs)
        return response
    except ElasticsearchException, e:
        Common.get_logger().error('Error ES query execution\n%s' % e)
Beispiel #3
0
def insert_into_snapshot(inputs):
    data = []
    for item in inputs:
        data.append(inputs[item])
    Common.get_elasticsearch().put_bulk_data(SNAPSHOT_INDEX, SNAPSHOT_DOC_TYPE,
                                             data)