org.apache.flink.streaming.connectors.elasticsearch.util.ElasticsearchUtils Java Examples
The following examples show how to use
org.apache.flink.streaming.connectors.elasticsearch.util.ElasticsearchUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Elasticsearch2ApiCallBridge.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override public TransportClient createClient(Map<String, String> clientConfig) { Settings settings = Settings.settingsBuilder().put(clientConfig).build(); TransportClient transportClient = TransportClient.builder().settings(settings).build(); for (TransportAddress address : ElasticsearchUtils.convertInetSocketAddresses(transportAddresses)) { transportClient.addTransportAddress(address); } // verify that we actually are connected to a cluster if (transportClient.connectedNodes().isEmpty()) { // close the transportClient here IOUtils.closeQuietly(transportClient); throw new RuntimeException("Elasticsearch client is not connected to any Elasticsearch nodes!"); } if (LOG.isInfoEnabled()) { LOG.info("Created Elasticsearch TransportClient with connected nodes {}", transportClient.connectedNodes()); } return transportClient; }
Example #2
Source File: Elasticsearch2ApiCallBridge.java From flink with Apache License 2.0 | 6 votes |
@Override public TransportClient createClient(Map<String, String> clientConfig) { Settings settings = Settings.settingsBuilder().put(clientConfig).build(); TransportClient transportClient = TransportClient.builder().settings(settings).build(); for (TransportAddress address : ElasticsearchUtils.convertInetSocketAddresses(transportAddresses)) { transportClient.addTransportAddress(address); } // verify that we actually are connected to a cluster if (transportClient.connectedNodes().isEmpty()) { // close the transportClient here IOUtils.closeQuietly(transportClient); throw new RuntimeException("Elasticsearch client is not connected to any Elasticsearch nodes!"); } if (LOG.isInfoEnabled()) { LOG.info("Created Elasticsearch TransportClient with connected nodes {}", transportClient.connectedNodes()); } return transportClient; }
Example #3
Source File: ElasticsearchSinkITCase.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override protected ElasticsearchSinkBase<Tuple2<Integer, String>, Client> createElasticsearchSink( int bulkFlushMaxActions, String clusterName, List<InetSocketAddress> transportAddresses, ElasticsearchSinkFunction<Tuple2<Integer, String>> elasticsearchSinkFunction) { return new ElasticsearchSink<>( Collections.unmodifiableMap(createUserConfig(bulkFlushMaxActions, clusterName)), ElasticsearchUtils.convertInetSocketAddresses(transportAddresses), elasticsearchSinkFunction); }
Example #4
Source File: Elasticsearch5ApiCallBridge.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public TransportClient createClient(Map<String, String> clientConfig) { Settings settings = Settings.builder().put(clientConfig) .put(NetworkModule.HTTP_TYPE_KEY, Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME) .put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME) .build(); TransportClient transportClient = new PreBuiltTransportClient(settings); for (TransportAddress transport : ElasticsearchUtils.convertInetSocketAddresses(transportAddresses)) { transportClient.addTransportAddress(transport); } // verify that we actually are connected to a cluster if (transportClient.connectedNodes().isEmpty()) { // close the transportClient here IOUtils.closeQuietly(transportClient); throw new RuntimeException("Elasticsearch client is not connected to any Elasticsearch nodes!"); } if (LOG.isInfoEnabled()) { LOG.info("Created Elasticsearch TransportClient with connected nodes {}", transportClient.connectedNodes()); } return transportClient; }
Example #5
Source File: Elasticsearch5ApiCallBridge.java From flink with Apache License 2.0 | 5 votes |
@Override public TransportClient createClient(Map<String, String> clientConfig) { Settings settings = Settings.builder().put(clientConfig) .put(NetworkModule.HTTP_TYPE_KEY, Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME) .put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME) .build(); TransportClient transportClient = new PreBuiltTransportClient(settings); for (TransportAddress transport : ElasticsearchUtils.convertInetSocketAddresses(transportAddresses)) { transportClient.addTransportAddress(transport); } // verify that we actually are connected to a cluster if (transportClient.connectedNodes().isEmpty()) { // close the transportClient here IOUtils.closeQuietly(transportClient); throw new RuntimeException("Elasticsearch client is not connected to any Elasticsearch nodes!"); } if (LOG.isInfoEnabled()) { LOG.info("Created Elasticsearch TransportClient with connected nodes {}", transportClient.connectedNodes()); } return transportClient; }
Example #6
Source File: Elasticsearch5ApiCallBridge.java From flink with Apache License 2.0 | 5 votes |
@Override public TransportClient createClient(Map<String, String> clientConfig) { Settings settings = Settings.builder() .put(NetworkModule.HTTP_TYPE_KEY, Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME) .put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME) .put(clientConfig) .build(); TransportClient transportClient = new PreBuiltTransportClient(settings); for (TransportAddress transport : ElasticsearchUtils.convertInetSocketAddresses(transportAddresses)) { transportClient.addTransportAddress(transport); } return transportClient; }