elasticsearch支持批量添加或删除索引文档,java api里面就是通过构造BulkRequestBuilder,然后把批量的index/delete请求添加到BulkRequestBuilder里面,执行BulkRequestBuilder。下面是个例子:

import static org.elasticsearch.common.xcontent.XContentFactory.*; 
		 
		BulkRequestBuilder bulkRequest = client.prepareBulk(); 
		 
		bulkRequest.add(client.prepareIndex("twitter", "tweet", "1") 
		        .setSource(jsonBuilder() 
		                    .startObject() 
		                        .field("user", "kimchy") 
		                        .field("postDate", new Date()) 
		                        .field("message", "trying out Elastic Search") 
		                    .endObject() 
		                  ) 
		        ); 
		 
		bulkRequest.add(client.prepareIndex("twitter", "tweet", "2") 
		        .setSource(jsonBuilder() 
		                    .startObject() 
		                        .field("user", "kimchy") 
		                        .field("postDate", new Date()) 
		                        .field("message", "another post") 
		                    .endObject() 
		                  ) 
		        ); 
		         
		BulkResponse bulkResponse = bulkRequest.execute().actionGet(); 
		if (bulkResponse.hasFailures()) { 
		    //处理错误 
		}

添加索引操作参考:http://blog.csdn.net/laigood12345/article/details/7460544

删除索引操作参考:http://blog.csdn.net/laigood12345/article/details/7460602

参考资料:http://www.elasticsearch.org/guide/reference/java-api/bulk.html