private void indexContentletList(BulkRequestBuilder req, List<Contentlet> contentToIndex, boolean reindexOnly) throws DotStateException, DotDataException, DotSecurityException, DotMappingException {
for(Contentlet con : contentToIndex) {
String id=con.getIdentifier()+"_"+con.getLanguageId();
IndiciesInfo info=APILocator.getIndiciesAPI().loadIndicies();
Gson gson=new Gson();
String mapping=null;
try {
if(con.isWorking()) {
mapping=gson.toJson(mappingAPI.toMap(con));
if(!reindexOnly)
req.add(new IndexRequest(info.working, "content", id)
.source(mapping));
if(info.reindex_working!=null)
req.add(new IndexRequest(info.reindex_working, "content", id)
.source(mapping));
}
if(con.isLive()) {
if(mapping==null)
mapping=gson.toJson(mappingAPI.toMap(con));
if(!reindexOnly)
req.add(new IndexRequest(info.live, "content", id)
.source(mapping));
if(info.reindex_live!=null)