Class ElasticSinks

java.lang.Object
com.hazelcast.jet.elastic.ElasticSinks

public final class ElasticSinks extends Object
Provides factory methods for Elasticsearch sinks. Alternatively you can use ElasticSinkBuilder
Since:
Jet 4.2
  • Method Details

    • elastic

      @Nonnull public static <T> Sink<T> elastic(@Nonnull FunctionEx<? super T,? extends org.elasticsearch.action.DocWriteRequest<?>> mapToRequestFn)
      Creates an Elasticsearch sink, uses a local instance of Elasticsearch

      Usage:

      Sink<Map<String, Object>> sink = ElasticSinks.elastic(
         map -> new IndexRequest("my-index").source(map)
       );
      Parameters:
      mapToRequestFn - function that maps an item from a pipeline to an indexing request
    • elastic

      @Nonnull public static <T> Sink<T> elastic(@Nonnull SupplierEx<org.elasticsearch.client.RestClientBuilder> clientFn, @Nonnull FunctionEx<? super T,? extends org.elasticsearch.action.DocWriteRequest<?>> mapToRequestFn)
      Creates an Elasticsearch sink, uses a client obtained from clientFn and maps items using given mapToRequestFn

      Usage:

      Sink<Map<String, Object>> sink = ElasticSinks.elastic(
         () -> ElasticClients.client("es-host", 9200),
         map -> new IndexRequest("my-index").source(map)
       );
      Type Parameters:
      T - type of incoming items
      Parameters:
      clientFn - supplier function returning configured RestClientBuilder
      mapToRequestFn - function that maps an item from a pipeline to an indexing request
    • builder

      @Nonnull public static ElasticSinkBuilder<Void> builder()
      Returns new instance of ElasticSinkBuilder