use of org.apache.sdap.mudrod.recommendation.structure.PODAACMetadataFeature in project incubator-sdap-mudrod by apache.
the class NormalizeFeatures method normalizeMetadataVariables.
public void normalizeMetadataVariables(ESDriver es) {
es.createBulkProcessor();
SearchResponse scrollResp = es.getClient().prepareSearch(indexName).setTypes(metadataType).setScroll(new TimeValue(60000)).setQuery(QueryBuilders.matchAllQuery()).setSize(100).execute().actionGet();
while (true) {
for (SearchHit hit : scrollResp.getHits().getHits()) {
Map<String, Object> metadata = hit.getSource();
Map<String, Object> updatedValues = new HashMap<>();
// !!!important change to other normalizer class when using other metadata
MetadataFeature normalizer = new PODAACMetadataFeature();
normalizer.normalizeMetadataVariables(metadata, updatedValues);
UpdateRequest ur = es.generateUpdateRequest(indexName, metadataType, hit.getId(), updatedValues);
es.getBulkProcessor().add(ur);
}
scrollResp = es.getClient().prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(600000)).execute().actionGet();
if (scrollResp.getHits().getHits().length == 0) {
break;
}
}
es.destroyBulkProcessor();
}
Aggregations