flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From StephanEwen <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2558] Add Streaming Connector for Elast...
Date Sat, 22 Aug 2015 16:11:34 GMT
Github user StephanEwen commented on a diff in the pull request:

    --- Diff: docs/apis/streaming_guide.md ---
    @@ -1661,6 +1674,165 @@ More about Kafka can be found [here](https://kafka.apache.org/documentation.html
     [Back to top](#top)
    +### Elasticsearch
    +This connector provides a Sink that can write to an
    +[Elasticsearch](https://elastic.co/) Index. To use this connector, add the
    +following dependency to your project:
    +{% highlight xml %}
    +  <groupId>org.apache.flink</groupId>
    +  <artifactId>flink-connector-elasticsearch</artifactId>
    +  <version>{{site.version }}</version>
    +{% endhighlight %}
    +Note that the streaming connectors are currently not part of the binary
    +distribution. See
    +for information about how to package the program with the libraries for
    +cluster execution.
    +#### Installing Elasticsearch
    +Instructions for setting up an Elasticsearch cluster can be found
    +Make sure to set and remember a cluster name. This must be set when
    +creating a Sink for writing to your cluster
    +#### Elasticsearch Sink
    +The connector provides a Sink that can send data to an Elasticsearch Index.
    +The sink can use two different methods for communicating with Elasticsearch:
    +1. An embedded Node
    +2. The TransportClient
    +See [here](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/client.html)
    +for information about the differences between the two modes.
    +This code shows how to create a sink that uses an embedded Node for
    +<div class="codetabs" markdown="1">
    +<div data-lang="java" markdown="1">
    +{% highlight java %}
    +DataStream<String> input = ...;
    +Map<String, String> config = Maps.newHashMap();
    +// This instructs the sink to emit after every element, otherwise they would be buffered
    +config.put("bulk.flush.max.actions", "1");
    +config.put("cluster.name", "my-cluster-name");
    +input.addSink(new ElasticsearchSink<>(config, new IndexRequestBuilder<String>()
    +    @Override
    +    public IndexRequest createIndexRequest(String element, RuntimeContext ctx) {
    --- End diff --
    Can we make the ElasticsearchSink rich? Then it has access to the RuntimeContext anyways,
and it needs not be passed in every call.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message