Package com.hazelcast.jet.elastic
Class ElasticSinks
java.lang.Object
com.hazelcast.jet.elastic.ElasticSinks
Provides factory methods for Elasticsearch sinks.
Alternatively you can use
ElasticSinkBuilder
- Since:
- Jet 4.2
-
Method Summary
Modifier and TypeMethodDescriptionstatic ElasticSinkBuilder<Void>
builder()
Returns new instance ofElasticSinkBuilder
static <T> Sink<T>
elastic
(FunctionEx<? super T, ? extends org.elasticsearch.action.DocWriteRequest<?>> mapToRequestFn) Creates an Elasticsearch sink, uses a local instance of Elasticsearchstatic <T> Sink<T>
elastic
(SupplierEx<org.elasticsearch.client.RestClientBuilder> clientFn, 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
-
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 ElasticsearchUsage:
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 mapToRequestFnUsage:
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 RestClientBuildermapToRequestFn
- function that maps an item from a pipeline to an indexing request
-
builder
Returns new instance ofElasticSinkBuilder
-