Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 785CE200AE4 for ; Tue, 10 May 2016 22:31:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 770D6160877; Tue, 10 May 2016 20:31:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C10C0160A16 for ; Tue, 10 May 2016 22:31:15 +0200 (CEST) Received: (qmail 50052 invoked by uid 500); 10 May 2016 20:31:15 -0000 Mailing-List: contact commits-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list commits@flink.apache.org Received: (qmail 49904 invoked by uid 99); 10 May 2016 20:31:14 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 May 2016 20:31:14 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C59EEE38A9; Tue, 10 May 2016 20:31:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: fhueske@apache.org To: commits@flink.apache.org Date: Tue, 10 May 2016 20:31:17 -0000 Message-Id: <4ee8cee116bf4a20bdfc38843a92834d@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [4/4] flink git commit: [FLINK-3882] [docs] Fix errors in sample Java code for the Elasticsearch2 sink archived-at: Tue, 10 May 2016 20:31:16 -0000 [FLINK-3882] [docs] Fix errors in sample Java code for the Elasticsearch2 sink This closes #1971 Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/43bd6f6e Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/43bd6f6e Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/43bd6f6e Branch: refs/heads/master Commit: 43bd6f6e4020d4102c34c5874ddfa850a281c8c8 Parents: 08e8054 Author: markreddy Authored: Sun May 8 21:41:13 2016 +0100 Committer: Fabian Hueske Committed: Tue May 10 18:59:57 2016 +0200 ---------------------------------------------------------------------- docs/apis/streaming/connectors/elasticsearch2.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/43bd6f6e/docs/apis/streaming/connectors/elasticsearch2.md ---------------------------------------------------------------------- diff --git a/docs/apis/streaming/connectors/elasticsearch2.md b/docs/apis/streaming/connectors/elasticsearch2.md index 74650ec..7146285 100644 --- a/docs/apis/streaming/connectors/elasticsearch2.md +++ b/docs/apis/streaming/connectors/elasticsearch2.md @@ -78,20 +78,19 @@ transports.add(new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 9300)); transports.add(new InetSocketAddress(InetAddress.getByName("10.2.3.1"), 9300)); input.addSink(new ElasticsearchSink(config, transports, new ElasticsearchSinkFunction() { - public IndexRequest createIndexRequest(String element): IndexRequest = { - Map json = new HashMap<>() - json.put("data", element) + public IndexRequest createIndexRequest(String element) { + Map json = new HashMap<>(); + json.put("data", element); return Requests.indexRequest() .index("my-index") .type("my-type") .source(json); - } - + @Override public void process(String element, RuntimeContext ctx, RequestIndexer indexer) { - indexer.add(createIndexRequest(element)) + indexer.add(createIndexRequest(element)); } })); {% endhighlight %} @@ -116,10 +115,10 @@ input.addSink(new ElasticsearchSink(config, transports, new ElasticsearchSinkFun json.put("data", element) Requests.indexRequest.index("my-index").`type`("my-type").source(json) } - + override def process(element: String, ctx: RuntimeContext, indexer: RequestIndexer) { indexer.add(createIndexRequest(element)) - } + } })) {% endhighlight %} @@ -139,7 +138,7 @@ This will buffer elements and Action Requests before sending to the cluster. The * **bulk.flush.interval.ms**: Interval at which to flush data regardless of the other two settings in milliseconds -This now provides a list of Elasticsearch Nodes +This now provides a list of Elasticsearch Nodes to which the sink should connect via a `TransportClient`. More about information about Elasticsearch can be found [here](https://elastic.co).