Package com.bazoud.elasticsearch.river.git.es

Source Code of com.bazoud.elasticsearch.river.git.es.Bulk

package com.bazoud.elasticsearch.river.git.es;

import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;

/**
* @author Olivier Bazoud
*/
public class Bulk {
    private static ESLogger logger = Loggers.getLogger(Bulk.class);

    public static void execute(BulkRequestBuilder bulk) {
        logger.info("Executing bulk {} actions", bulk.numberOfActions());
        if (bulk.numberOfActions() > 0) {
            BulkResponse response = bulk.execute().actionGet();
            logger.info("Bulk actions tooks {} ms", response.getTookInMillis());
            if (response.hasFailures()) {
                logger.warn("failed to execute bulk: {}", response.buildFailureMessage());
            }
        } else {
            logger.info("Sorry nothing to do");
        }
    }


}
TOP

Related Classes of com.bazoud.elasticsearch.river.git.es.Bulk

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.