Java Code Examples for org.elasticsearch.action.bulk.BulkRequest#waitForActiveShards()
The following examples show how to use
org.elasticsearch.action.bulk.BulkRequest#waitForActiveShards() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EsPublisher.java From tunnel with Apache License 2.0 | 5 votes |
private BulkRequest createBulkRequest(List<DocWriteRequest> doc) { BulkRequest br = new BulkRequest(); br.add(doc); br.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE); br.waitForActiveShards(ActiveShardCount.ONE); return br; }
Example 2
Source File: EsPublisher.java From tunnel with Apache License 2.0 | 5 votes |
private BulkRequest createBulkRequest(List<DocWriteRequest> doc) { BulkRequest br = new BulkRequest(); br.add(doc); br.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE); br.waitForActiveShards(ActiveShardCount.ONE); return br; }
Example 3
Source File: ElasticSearch7Client.java From skywalking with Apache License 2.0 | 5 votes |
public void synchronousBulk(BulkRequest request) { request.timeout(TimeValue.timeValueMinutes(2)); request.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL); request.waitForActiveShards(ActiveShardCount.ONE); try { int size = request.requests().size(); BulkResponse responses = client.bulk(request, RequestOptions.DEFAULT); log.info("Synchronous bulk took time: {} millis, size: {}", responses.getTook().getMillis(), size); } catch (IOException e) { log.error(e.getMessage(), e); } }
Example 4
Source File: ElasticSearchClient.java From skywalking with Apache License 2.0 | 5 votes |
public void synchronousBulk(BulkRequest request) { request.timeout(TimeValue.timeValueMinutes(2)); request.setRefreshPolicy(WriteRequest.RefreshPolicy.WAIT_UNTIL); request.waitForActiveShards(ActiveShardCount.ONE); try { int size = request.requests().size(); BulkResponse responses = client.bulk(request); log.info("Synchronous bulk took time: {} millis, size: {}", responses.getTook().getMillis(), size); } catch (IOException e) { log.error(e.getMessage(), e); } }