public void createOrUpdateData(String indexName, String type, List<NutMap> list) {
        BulkRequestBuilder bulkRequest = getClient().prepareBulk();
        if (list.size() > 0) {
            for (NutMap nutMap : list) {
                bulkRequest.add(getClient().prepareIndex(indexName, type).setId(nutMap.getString("id")).setSource(Lang.obj2map(nutMap.get("obj"))));
            }
            bulkRequest.execute().actionGet();
        }
    }
public void createOrUpdateData ( String indexName , String type , List < NutMap > list ) { BulkRequestBuilder bulkRequest = getClient ( ) . prepareBulk ( ) ; if ( list . size ( ) > 0 ) { for ( NutMap nutMap : list ) { bulkRequest . add ( getClient ( ) . prepareIndex ( indexName , type ) . setId ( nutMap . getString ( "id" ) ) . setSource ( Lang . obj2map ( nutMap . get ( "obj" ) ) ) ) ; } bulkRequest . execute ( ) . actionGet ( ) ; } }
批量创建或更新文档

@param indexName 索引名
@param type      数据类型(表名)
@param list      包含id和obj的NutMap集合对象