本文整理汇总了Java中org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer类的典型用法代码示例。如果您正苦于以下问题:Java RequestIndexer类的具体用法?Java RequestIndexer怎么用?Java RequestIndexer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestIndexer类属于org.apache.flink.streaming.connectors.elasticsearch包,在下文中一共展示了RequestIndexer类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: process
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void process(
Tuple5<Float, Float, Long, Boolean, Integer> record,
RuntimeContext ctx,
RequestIndexer indexer) {
// construct JSON document to index
Map<String, String> json = new HashMap<>();
json.put("time", record.f2.toString()); // timestamp
json.put("location", record.f1+","+record.f0); // lat,lon pair
json.put("isStart", record.f3.toString()); // isStart
json.put("cnt", record.f4.toString()); // count
IndexRequest rqst = Requests.indexRequest()
.index("nyc-places") // index name
.type("popular-locations") // mapping name
.source(json);
indexer.add(rqst);
}
开发者ID:dineshtrivedi,项目名称:flink-java-project,代码行数:21,代码来源:PoupularPlacesMain.java
示例2: process
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void process(
Tuple5<Float, Float, Long, Boolean, Integer> record,
RuntimeContext ctx,
RequestIndexer indexer) {
// construct JSON document to index
Map<String, String> json = new HashMap<>();
json.put("time", record.f2.toString()); // timestamp
json.put("location", record.f1+","+record.f0); // lat,lon pair
json.put("isStart", record.f3.toString()); // isStart
json.put("cnt", record.f4.toString()); // count
IndexRequest rqst = Requests.indexRequest()
.index("nyc-places") // index name
.type("popular-locations") // mapping name
.source(json);
indexer.add(rqst);
}
开发者ID:dataArtisans,项目名称:flink-training-exercises,代码行数:21,代码来源:PopularPlacesToES.java
示例3: main
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStream<String> source = env.generateSequence(0, 20).map(new MapFunction<Long, String>() {
@Override
public String map(Long value) throws Exception {
return "message #" + value;
}
});
Map<String, String> userConfig = new HashMap<>();
userConfig.put("cluster.name", "elasticsearch");
// This instructs the sink to emit after every element, otherwise they would be buffered
userConfig.put(ElasticsearchSink.CONFIG_KEY_BULK_FLUSH_MAX_ACTIONS, "1");
List<TransportAddress> transports = new ArrayList<>();
transports.add(new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));
source.addSink(new ElasticsearchSink<>(userConfig, transports, new ElasticsearchSinkFunction<String>() {
@Override
public void process(String element, RuntimeContext ctx, RequestIndexer indexer) {
indexer.add(createIndexRequest(element));
}
}));
env.execute("Elasticsearch Sink Example");
}
开发者ID:axbaretto,项目名称:flink,代码行数:29,代码来源:ElasticsearchSinkExample.java
示例4: process
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void process(T element, RuntimeContext ctx, RequestIndexer indexer) {
if (reusedRequestIndexerBridge == null) {
reusedRequestIndexerBridge = new OldNewRequestIndexerBridge(indexer);
}
deprecated.process(element, ctx, reusedRequestIndexerBridge);
}
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:OldNewElasticsearchSinkFunctionBridge.java
示例5: main
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStream<String> source = env.generateSequence(0, 20).map(new MapFunction<Long, String>() {
@Override
public String map(Long value) throws Exception {
return "message #" + value;
}
});
Map<String, String> userConfig = new HashMap<>();
userConfig.put("cluster.name", "elasticsearch");
// This instructs the sink to emit after every element, otherwise they would be buffered
userConfig.put(ElasticsearchSink.CONFIG_KEY_BULK_FLUSH_MAX_ACTIONS, "1");
List<InetSocketAddress> transports = new ArrayList<>();
transports.add(new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 9300));
source.addSink(new ElasticsearchSink<>(userConfig, transports, new ElasticsearchSinkFunction<String>() {
@Override
public void process(String element, RuntimeContext ctx, RequestIndexer indexer) {
indexer.add(createIndexRequest(element));
}
}));
env.execute("Elasticsearch Sink Example");
}
开发者ID:axbaretto,项目名称:flink,代码行数:29,代码来源:ElasticsearchSinkExample.java
示例6: onFailure
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void onFailure(ActionRequest action, Throwable failure, int restStatusCode, RequestIndexer indexer) throws Throwable {
if (ExceptionUtils.findThrowable(failure, EsRejectedExecutionException.class).isPresent()) {
indexer.add(action);
} else {
// rethrow all other failures
throw failure;
}
}
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:RetryRejectedExecutionFailureHandler.java
示例7: process
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void process(WindowWordRanking value, RuntimeContext ctx, RequestIndexer indexer) {
indexer.add(this.createWindowWordRanking(value));
}
开发者ID:gmarciani,项目名称:flink-scaffolding,代码行数:5,代码来源:MyESSinkFunction.java
示例8: process
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void process(PlayerRunningStatistics value, RuntimeContext ctx, RequestIndexer indexer) {
indexer.add(this.createWindowWordRanking(value));
}
开发者ID:braineering,项目名称:socstream,代码行数:5,代码来源:PlayerRunningStatisticsESSinkFunction.java
示例9: process
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void process(PlayersSpeedRanking value, RuntimeContext ctx, RequestIndexer indexer) {
indexer.add(this.createWindowWordRanking(value));
}
开发者ID:braineering,项目名称:socstream,代码行数:5,代码来源:PlayerSpeedRankingESSinkFunction.java
示例10: process
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void process(PlayerGridStatistics value, RuntimeContext ctx, RequestIndexer indexer) {
indexer.add(this.createWindowWordRanking(value));
}
开发者ID:braineering,项目名称:socstream,代码行数:5,代码来源:PlayerGridStatisticsESSinkFunction.java
示例11: process
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void process(Result element, RuntimeContext ctx, RequestIndexer indexer) {
indexer.add(createIndexRequest(element));
}
开发者ID:pravega,项目名称:pravega-samples,代码行数:5,代码来源:PravegaAnomalyDetectionProcessor.java
示例12: onFailure
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void onFailure(ActionRequest action, Throwable failure, int restStatusCode, RequestIndexer indexer) throws Throwable {
// simply fail the sink
throw failure;
}
开发者ID:axbaretto,项目名称:flink,代码行数:6,代码来源:NoOpFailureHandler.java
示例13: process
import org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer; //导入依赖的package包/类
@Override
public void process(Tuple2<Integer, String> element, RuntimeContext ctx, RequestIndexer indexer) {
indexer.add(createIndexRequest(element));
}
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:SourceSinkDataTestKit.java
注:本文中的org.apache.flink.streaming.connectors.elasticsearch.RequestIndexer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论