本文整理汇总了Java中com.github.fhuss.storm.elasticsearch.mapper.TridentTupleMapper类的典型用法代码示例。如果您正苦于以下问题:Java TridentTupleMapper类的具体用法?Java TridentTupleMapper怎么用?Java TridentTupleMapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TridentTupleMapper类属于com.github.fhuss.storm.elasticsearch.mapper包,在下文中一共展示了TridentTupleMapper类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bulkUpdateIndices
import com.github.fhuss.storm.elasticsearch.mapper.TridentTupleMapper; //导入依赖的package包/类
public void bulkUpdateIndices(List<TridentTuple> inputs, TridentTupleMapper<Document<T>> mapper, BulkResponseHandler handler) {
BulkRequestBuilder bulkRequest = client.prepareBulk();
for (TridentTuple input : inputs) {
Document<T> doc = mapper.map(input);
byte[] source = serializeSourceOrFail(doc);
IndexRequestBuilder request = client.prepareIndex(doc.getName(), doc.getType(), doc.getId()).setSource(source);
if(doc.getParentId() != null) {
request.setParent(doc.getParentId());
}
bulkRequest.add(request);
}
if( bulkRequest.numberOfActions() > 0) {
try {
handler.handle(bulkRequest.execute().actionGet());
} catch(ElasticsearchException e) {
LOGGER.error("error while executing bulk request to elasticsearch");
throw new FailedException("Failed to store data into elasticsearch", e);
}
}
}
示例2: ESIndexUpdater
import com.github.fhuss.storm.elasticsearch.mapper.TridentTupleMapper; //导入依赖的package包/类
public ESIndexUpdater(TridentTupleMapper<Document<T>> documentTupleMapper) {
this(documentTupleMapper, new LoggerResponseHandler());
}