Explain how to use bulk processor in a test context
Explain how to use bulk processor in a test context

When using a bulk processor in test, you might write something like:

```java
BulkProcessor bulkProcessor = BulkProcessor.builder(client, new BulkProcessor.Listener() {
    @Override public void beforeBulk(long executionId, BulkRequest request) {}
    @Override public void afterBulk(long executionId, BulkRequest request, BulkResponse response) {}
    @Override public void afterBulk(long executionId, BulkRequest request, Throwable failure) {}
})
        .setBulkActions(10000)
        .setFlushInterval(TimeValue.timeValueSeconds(10))
        .build();

for (int i = 0; i < 10000; i++) {
    bulkProcessor.add(new IndexRequest("foo", "bar", "doc_" + i)
            .source(jsonBuilder().startObject().field("foo", "bar").endObject()
    ));
}

bulkProcessor.flush();
client.admin().indices().prepareRefresh("foo").get();
SearchResponse response = client.prepareSearch("foo").get();
// response does not contain any hit
```

The problem is that by default bulkProcessor defines the number of concurrent requests to 1 which is using behind the scene an Async BulkRequestHandler.
When you call `flush()` in a test, you expect it to flush all the content of the bulk so you can search for your docs.
But because of the async handling, there is a great chance that none of the documents has been indexed yet when you call the `refresh` method.

We should advice in our Java guide to explicitly set concurrent requests to `0` so users will use behind the scene the Sync BulkRequestHandler.

```java
BulkProcessor bulkProcessor = BulkProcessor.builder(client, new BulkProcessor.Listener() {
    @Override public void beforeBulk(long executionId, BulkRequest request) {}
    @Override public void afterBulk(long executionId, BulkRequest request, BulkResponse response) {}
    @Override public void afterBulk(long executionId, BulkRequest request, Throwable failure) {}
})
        .setBulkActions(5000)
        .setFlushInterval(TimeValue.timeValueSeconds(10))
        .setConcurrentRequests(0)
        .build();
```

Closes #22158.

brandonkearby/elasticsearch,glefloch/elasticsearch,Shepard1212/elasticsearch,kalimatas/elasticsearch,wuranbo/elasticsearch,nilabhsagar/elasticsearch,geidies/elasticsearch,LeoYao/elasticsearch,obourgain/elasticsearch,gfyoung/elasticsearch,kalimatas/elasticsearch,JackyMai/elasticsearch,JackyMai/elasticsearch,a2lin/elasticsearch,i-am-Nathan/elasticsearch,LewayneNaidoo/elasticsearch,MaineC/elasticsearch,pozhidaevak/elasticsearch,markwalkom/elasticsearch,ThiagoGarciaAlves/elasticsearch,shreejay/elasticsearch,bawse/elasticsearch,nazarewk/elasticsearch,ThiagoGarciaAlves/elasticsearch,scorpionvicky/elasticsearch,naveenhooda2000/elasticsearch,LewayneNaidoo/elasticsearch,geidies/elasticsearch,robin13/elasticsearch,mjason3/elasticsearch,coding0011/elasticsearch,umeshdangat/elasticsearch,jprante/elasticsearch,winstonewert/elasticsearch,fernandozhu/elasticsearch,Helen-Zhao/elasticsearch,ZTE-PaaS/elasticsearch,winstonewert/elasticsearch,maddin2016/elasticsearch,mortonsykes/elasticsearch,njlawton/elasticsearch,henakamaMSFT/elasticsearch,umeshdangat/elasticsearch,rajanm/elasticsearch,nezirus/elasticsearch,maddin2016/elasticsearch,robin13/elasticsearch,mjason3/elasticsearch,Stacey-Gammon/elasticsearch,masaruh/elasticsearch,MaineC/elasticsearch,mortonsykes/elasticsearch,i-am-Nathan/elasticsearch,mohit/elasticsearch,uschindler/elasticsearch,masaruh/elasticsearch,masaruh/elasticsearch,JackyMai/elasticsearch,fernandozhu/elasticsearch,winstonewert/elasticsearch,bawse/elasticsearch,IanvsPoplicola/elasticsearch,wuranbo/elasticsearch,LeoYao/elasticsearch,fernandozhu/elasticsearch,njlawton/elasticsearch,Shepard1212/elasticsearch,Helen-Zhao/elasticsearch,JSCooke/elasticsearch,JSCooke/elasticsearch,lks21c/elasticsearch,gingerwizard/elasticsearch,brandonkearby/elasticsearch,gfyoung/elasticsearch,MisterAndersen/elasticsearch,fred84/elasticsearch,pozhidaevak/elasticsearch,MisterAndersen/elasticsearch,uschindler/elasticsearch,alexshadow007/elasticsearch,uschindler/elasticsearch,mohit/elasticsearch,nilabhsagar/elasticsearch,LewayneNaidoo/elasticsearch,wangtuo/elasticsearch,qwerty4030/elasticsearch,lks21c/elasticsearch,gingerwizard/elasticsearch,wangtuo/elasticsearch,strapdata/elassandra,nknize/elasticsearch,wenpos/elasticsearch,JSCooke/elasticsearch,alexshadow007/elasticsearch,Helen-Zhao/elasticsearch,s1monw/elasticsearch,wenpos/elasticsearch,s1monw/elasticsearch,maddin2016/elasticsearch,GlenRSmith/elasticsearch,coding0011/elasticsearch,MisterAndersen/elasticsearch,sneivandt/elasticsearch,scorpionvicky/elasticsearch,wangtuo/elasticsearch,rlugojr/elasticsearch,nknize/elasticsearch,nezirus/elasticsearch,kalimatas/elasticsearch,sneivandt/elasticsearch,henakamaMSFT/elasticsearch,Helen-Zhao/elasticsearch,wangtuo/elasticsearch,robin13/elasticsearch,artnowo/elasticsearch,C-Bish/elasticsearch,nilabhsagar/elasticsearch,nknize/elasticsearch,jprante/elasticsearch,fred84/elasticsearch,Stacey-Gammon/elasticsearch,markwalkom/elasticsearch,rajanm/elasticsearch,a2lin/elasticsearch,bawse/elasticsearch,IanvsPoplicola/elasticsearch,glefloch/elasticsearch,alexshadow007/elasticsearch,shreejay/elasticsearch,GlenRSmith/elasticsearch,GlenRSmith/elasticsearch,mikemccand/elasticsearch,maddin2016/elasticsearch,C-Bish/elasticsearch,jimczi/elasticsearch,masaruh/elasticsearch,vroyer/elasticassandra,rlugojr/elasticsearch,qwerty4030/elasticsearch,scorpionvicky/elasticsearch,scottsom/elasticsearch,StefanGor/elasticsearch,coding0011/elasticsearch,rlugojr/elasticsearch,umeshdangat/elasticsearch,gingerwizard/elasticsearch,i-am-Nathan/elasticsearch,coding0011/elasticsearch,obourgain/elasticsearch,ZTE-PaaS/elasticsearch,IanvsPoplicola/elasticsearch,gfyoung/elasticsearch,mikemccand/elasticsearch,StefanGor/elasticsearch,rajanm/elasticsearch,MisterAndersen/elasticsearch,mjason3/elasticsearch,vroyer/elasticassandra,JackyMai/elasticsearch,coding0011/elasticsearch,obourgain/elasticsearch,MisterAndersen/elasticsearch,scorpionvicky/elasticsearch,mohit/elasticsearch,ThiagoGarciaAlves/elasticsearch,uschindler/elasticsearch,lks21c/elasticsearch,markwalkom/elasticsearch,bawse/elasticsearch,njlawton/elasticsearch,qwerty4030/elasticsearch,brandonkearby/elasticsearch,gingerwizard/elasticsearch,bawse/elasticsearch,jprante/elasticsearch,Helen-Zhao/elasticsearch,strapdata/elassandra,masaruh/elasticsearch,C-Bish/elasticsearch,fred84/elasticsearch,lks21c/elasticsearch,jimczi/elasticsearch,scottsom/elasticsearch,fred84/elasticsearch,mortonsykes/elasticsearch,winstonewert/elasticsearch,henakamaMSFT/elasticsearch,mikemccand/elasticsearch,IanvsPoplicola/elasticsearch,ThiagoGarciaAlves/elasticsearch,Shepard1212/elasticsearch,i-am-Nathan/elasticsearch,scottsom/elasticsearch,glefloch/elasticsearch,sneivandt/elasticsearch,strapdata/elassandra,jimczi/elasticsearch,mjason3/elasticsearch,a2lin/elasticsearch,artnowo/elasticsearch,nknize/elasticsearch,MaineC/elasticsearch,shreejay/elasticsearch,C-Bish/elasticsearch,mjason3/elasticsearch,nezirus/elasticsearch,gingerwizard/elasticsearch,a2lin/elasticsearch,wenpos/elasticsearch,HonzaKral/elasticsearch,artnowo/elasticsearch,markwalkom/elasticsearch,C-Bish/elasticsearch,njlawton/elasticsearch,GlenRSmith/elasticsearch,geidies/elasticsearch,alexshadow007/elasticsearch,gingerwizard/elasticsearch,kalimatas/elasticsearch,wuranbo/elasticsearch,naveenhooda2000/elasticsearch,rlugojr/elasticsearch,ZTE-PaaS/elasticsearch,nazarewk/elasticsearch,jprante/elasticsearch,naveenhooda2000/elasticsearch,nazarewk/elasticsearch,elasticdog/elasticsearch,mikemccand/elasticsearch,maddin2016/elasticsearch,kalimatas/elasticsearch,robin13/elasticsearch,qwerty4030/elasticsearch,wuranbo/elasticsearch,gfyoung/elasticsearch,fernandozhu/elasticsearch,geidies/elasticsearch,elasticdog/elasticsearch,LewayneNaidoo/elasticsearch,LewayneNaidoo/elasticsearch,winstonewert/elasticsearch,Shepard1212/elasticsearch,naveenhooda2000/elasticsearch,elasticdog/elasticsearch,nazarewk/elasticsearch,mikemccand/elasticsearch,shreejay/elasticsearch,jimczi/elasticsearch,strapdata/elassandra,brandonkearby/elasticsearch,sneivandt/elasticsearch,strapdata/elassandra,LeoYao/elasticsearch,geidies/elasticsearch,rajanm/elasticsearch,sneivandt/elasticsearch,glefloch/elasticsearch,HonzaKral/elasticsearch,ZTE-PaaS/elasticsearch,LeoYao/elasticsearch,GlenRSmith/elasticsearch,wenpos/elasticsearch,IanvsPoplicola/elasticsearch,MaineC/elasticsearch,robin13/elasticsearch,artnowo/elasticsearch,fernandozhu/elasticsearch,ZTE-PaaS/elasticsearch,HonzaKral/elasticsearch,Stacey-Gammon/elasticsearch,wangtuo/elasticsearch,wenpos/elasticsearch,rajanm/elasticsearch,markwalkom/elasticsearch,mortonsykes/elasticsearch,pozhidaevak/elasticsearch,rlugojr/elasticsearch,StefanGor/elasticsearch,s1monw/elasticsearch,LeoYao/elasticsearch,nilabhsagar/elasticsearch,nezirus/elasticsearch,scottsom/elasticsearch,wuranbo/elasticsearch,pozhidaevak/elasticsearch,mohit/elasticsearch,mortonsykes/elasticsearch,vroyer/elassandra,geidies/elasticsearch,Shepard1212/elasticsearch,qwerty4030/elasticsearch,a2lin/elasticsearch,Stacey-Gammon/elasticsearch,rajanm/elasticsearch,fred84/elasticsearch,StefanGor/elasticsearch,nilabhsagar/elasticsearch,ThiagoGarciaAlves/elasticsearch,StefanGor/elasticsearch,scottsom/elasticsearch,vroyer/elassandra,jimczi/elasticsearch,obourgain/elasticsearch,nknize/elasticsearch,nazarewk/elasticsearch,vroyer/elassandra,elasticdog/elasticsearch,lks21c/elasticsearch,umeshdangat/elasticsearch,JackyMai/elasticsearch,LeoYao/elasticsearch,artnowo/elasticsearch,umeshdangat/elasticsearch,shreejay/elasticsearch,mohit/elasticsearch,s1monw/elasticsearch,markwalkom/elasticsearch,MaineC/elasticsearch,henakamaMSFT/elasticsearch,JSCooke/elasticsearch,pozhidaevak/elasticsearch,s1monw/elasticsearch,HonzaKral/elasticsearch,ThiagoGarciaAlves/elasticsearch,brandonkearby/elasticsearch,alexshadow007/elasticsearch,jprante/elasticsearch,LeoYao/elasticsearch,scorpionvicky/elasticsearch,gfyoung/elasticsearch,vroyer/elasticassandra,henakamaMSFT/elasticsearch,nezirus/elasticsearch,JSCooke/elasticsearch,elasticdog/elasticsearch,gingerwizard/elasticsearch,i-am-Nathan/elasticsearch,glefloch/elasticsearch,njlawton/elasticsearch,obourgain/elasticsearch,Stacey-Gammon/elasticsearch,naveenhooda2000/elasticsearch,uschindler/elasticsearch