Interface ElasticsearchSinkFunction<T>

  • Type Parameters:
    T - The type of the element handled by this ElasticsearchSinkFunction
    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 multiple ActionRequests from 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 void close()
      Deprecated.
      Tear-down method for the function.
      default void open()
      Deprecated.
      Initialization method for the function.
      default void open​(org.apache.flink.api.common.functions.RuntimeContext ctx)
      Deprecated.
      Initialization method for the function.
      void process​(T element, org.apache.flink.api.common.functions.RuntimeContext ctx, RequestIndexer indexer)
      Deprecated.
      Process the incoming element to produce multiple ActionsRequests.
    • Method Detail

      • open

        default void open()
                   throws Exception
        Deprecated.
        Initialization method for the function. It is called once before the actual working process methods, if open(RuntimeContext) is not overridden.
        Throws:
        Exception
      • open

        default void open​(org.apache.flink.api.common.functions.RuntimeContext ctx)
                   throws Exception
        Deprecated.
        Initialization method for the function. It is called once before the actual working process methods.
        Throws:
        Exception
      • close

        default void close()
                    throws Exception
        Deprecated.
        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 multiple ActionsRequests. The produced requests should be added to the provided RequestIndexer.
        Parameters:
        element - incoming element to process
        ctx - runtime context containing information about the sink instance
        indexer - request indexer that ActionRequest should be added to