Interface ElasticsearchSinkFunction<T>
-
- Type Parameters:
T- The type of the element handled by thisElasticsearchSinkFunction
- All Superinterfaces:
org.apache.flink.api.common.functions.Function,Serializable
@Deprecated @PublicEvolving public interface ElasticsearchSinkFunction<T> extends Serializable, org.apache.flink.api.common.functions.Function
Deprecated.This has been deprecated and will be removed in the future.Creates multipleActionRequestsfrom an element in a stream.This is used by sinks to prepare elements for sending them to Elasticsearch.
Example:
private static class TestElasticSearchSinkFunction implements ElasticsearchSinkFunction<Tuple2<Integer, String>> { public IndexRequest createIndexRequest(Tuple2<Integer, String> element) { Map<String, Object> json = new HashMap<>(); json.put("data", element.f1); return Requests.indexRequest() .index("my-index") .type("my-type") .id(element.f0.toString()) .source(json); } public void process(Tuple2<Integer, String> element, RuntimeContext ctx, RequestIndexer indexer) { indexer.add(createIndexRequest(element)); } }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default voidclose()Deprecated.Tear-down method for the function.default voidopen()Deprecated.Initialization method for the function.default voidopen(org.apache.flink.api.common.functions.RuntimeContext ctx)Deprecated.Initialization method for the function.voidprocess(T element, org.apache.flink.api.common.functions.RuntimeContext ctx, RequestIndexer indexer)Deprecated.Process the incoming element to produce multipleActionsRequests.
-
-
-
Method Detail
-
open
default void open() throws ExceptionDeprecated.Initialization method for the function. It is called once before the actual working process methods, ifopen(RuntimeContext)is not overridden.- Throws:
Exception
-
open
default void open(org.apache.flink.api.common.functions.RuntimeContext ctx) throws ExceptionDeprecated.Initialization method for the function. It is called once before the actual working process methods.- Throws:
Exception
-
close
default void close() throws ExceptionDeprecated.Tear-down method for the function. It is called when the sink closes.- Throws:
Exception
-
process
void process(T element, org.apache.flink.api.common.functions.RuntimeContext ctx, RequestIndexer indexer)
Deprecated.Process the incoming element to produce multipleActionsRequests. The produced requests should be added to the providedRequestIndexer.- Parameters:
element- incoming element to processctx- runtime context containing information about the sink instanceindexer- request indexer thatActionRequestshould be added to
-
-