当前位置: 首页>>代码示例>>Java>>正文


Java BulkResponse.toString方法代码示例

本文整理汇总了Java中org.elasticsearch.action.bulk.BulkResponse.toString方法的典型用法代码示例。如果您正苦于以下问题:Java BulkResponse.toString方法的具体用法?Java BulkResponse.toString怎么用?Java BulkResponse.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.action.bulk.BulkResponse的用法示例。


在下文中一共展示了BulkResponse.toString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bulkDelete

import org.elasticsearch.action.bulk.BulkResponse; //导入方法依赖的package包/类
@Override
public String bulkDelete(String index, String type, String... ids) {
	try {
		if(client==null){
			init();
		}
		BulkRequestBuilder bulkRequest = client.prepareBulk();
		for (String id : ids) {
			bulkRequest.add(client.prepareDelete(index, type, id));
		}
		BulkResponse result = bulkRequest.execute().get();
		return result.toString();
	}catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:dev-share,项目名称:database-transform-tool,代码行数:19,代码来源:ElasticsearchTransportFactory.java

示例2: bulkDelete

import org.elasticsearch.action.bulk.BulkResponse; //导入方法依赖的package包/类
public String bulkDelete(String index,String type,String... ids){
	try {
		if(xclient==null){
			init();
		}
		BulkRequest request = new BulkRequest();
		for (String id : ids) {
			request.add(new DeleteRequest(index, type, id));
		}
		BulkResponse result = xclient.bulk(request);
		return result.toString();
	}catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:dev-share,项目名称:css-elasticsearch,代码行数:18,代码来源:ElasticsearchHighRestFactory.java

示例3: bulkUpsert

import org.elasticsearch.action.bulk.BulkResponse; //导入方法依赖的package包/类
public String bulkUpsert(String index,String type,List<Object> jsons){
	try {
		if(client==null){
			init();
		}
		BulkRequestBuilder bulkRequest = client.prepareBulk();
		for (Object json : jsons) {
			JSONObject obj = JSON.parseObject(JSON.toJSONString(json));
			String id = UUIDs.base64UUID();
			if(obj.containsKey("id")){
				id = obj.getString("id");
				obj.remove("id");
				bulkRequest.add(client.prepareUpdate(index, type, id).setDoc(obj.toJSONString(),XContentType.JSON));
			}else{
				bulkRequest.add(client.prepareIndex(index, type, id).setSource(obj.toJSONString(),XContentType.JSON));
			}
		}
		BulkResponse result = bulkRequest.execute().get();
		return result.toString();
	}catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:dev-share,项目名称:css-elasticsearch,代码行数:26,代码来源:ElasticsearchTransportFactory.java

示例4: bulkUpsert

import org.elasticsearch.action.bulk.BulkResponse; //导入方法依赖的package包/类
public String bulkUpsert(String index,String type,List<Object> jsons){
		try {
			if(xclient==null){
				init();
			}
			BulkRequest request = new BulkRequest();
			for (Object json : jsons) {
				JSONObject obj = JSON.parseObject(JSON.toJSONString(json));
				String id = UUIDs.base64UUID();
				if(obj.containsKey("id")){
					id = obj.getString("id");
					obj.remove("id");
				}
//				if(obj.containsKey("id")){
//					request.add(new UpdateRequest(index, type, id).doc(obj.toJSONString(),XContentType.JSON));
//				}else{
//					request.add(new IndexRequest(index, type).source(obj.toJSONString(),XContentType.JSON));
//				}
				request.add(new UpdateRequest(index, type, id).upsert(obj.toJSONString(),XContentType.JSON));
			}
			BulkResponse result = xclient.bulk(request);
			return result.toString();
		}catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
 
开发者ID:dev-share,项目名称:css-elasticsearch,代码行数:29,代码来源:ElasticsearchHighRestFactory.java

示例5: indexTicks

import org.elasticsearch.action.bulk.BulkResponse; //导入方法依赖的package包/类
/**
 * put the given ticks into elasticsearch
 * @param ticks the ticks to be saved
 * @return the toString() of the response from elasticsearch client
 */
@Override
public String indexTicks(List<TickJson> ticks) {
  Validate.notNull(ticks);
  logger.info("indexTicks:{}", ticks.size());
  BulkRequestBuilder bulk = elasticsearch.prepareBulk();

  ticks.forEach(tick -> bulk.add(elasticsearch
      .prepareIndex(indexForTicks, typeForTicks)
      .setSource(tick.toString())));

  BulkResponse response = bulk.get();
  return response.toString();
}
 
开发者ID:the-james-burton,项目名称:the-turbine,代码行数:19,代码来源:ElasticsearchNativeServiceImpl.java

示例6: indexIndicators

import org.elasticsearch.action.bulk.BulkResponse; //导入方法依赖的package包/类
@Override
public String indexIndicators(List<IndicatorJson> indicators) {
  Validate.notNull(indicators);
  logger.info("indexIndicators:{}", indicators.size());
  BulkRequestBuilder bulk = elasticsearch.prepareBulk();

  indicators.forEach(indicator -> bulk.add(elasticsearch
      .prepareIndex(indexForIndicators, typeForIndicators)
      .setSource(indicator.toString())));

  BulkResponse response = bulk.get();
  return response.toString();
}
 
开发者ID:the-james-burton,项目名称:the-turbine,代码行数:14,代码来源:ElasticsearchNativeServiceImpl.java

示例7: indexStrategies

import org.elasticsearch.action.bulk.BulkResponse; //导入方法依赖的package包/类
@Override
public String indexStrategies(List<StrategyJson> strategies) {
  Validate.notNull(strategies);
  logger.info("indexStrategies:{}", strategies.size());
  BulkRequestBuilder bulk = elasticsearch.prepareBulk();

  strategies.forEach(strategy -> bulk.add(elasticsearch
      .prepareIndex(indexForStrategies, typeForStrategies)
      .setSource(strategy.toString())));

  BulkResponse response = bulk.get();
  return response.toString();
}
 
开发者ID:the-james-burton,项目名称:the-turbine,代码行数:14,代码来源:ElasticsearchNativeServiceImpl.java


注:本文中的org.elasticsearch.action.bulk.BulkResponse.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。