當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。