Skip to content

Commit

Permalink
SAMZA-868: support elasticsearch version 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiri Humpolicek authored and nickpan47 committed Apr 20, 2017
1 parent de8cffd commit e753c8d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle/dependency-versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
ext {
elasticsearchVersion = "1.5.1"
elasticsearchVersion = "2.2.0"
jerseyVersion = "2.22.1"
jodaTimeVersion = "2.2"
joptSimpleVersion = "3.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import org.apache.samza.config.ElasticsearchConfig;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
Expand All @@ -46,7 +45,7 @@ public NodeClientFactory(ElasticsearchConfig config) {

@Override
public Client getClient() {
Settings settings = ImmutableSettings.settingsBuilder()
Settings settings = Settings.settingsBuilder()
.put(clientSettings)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
import org.apache.samza.config.ElasticsearchConfig;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.transport.TransportAddress;

import java.util.Map;
import java.net.InetSocketAddress;

/**
* A {@link ClientFactory} that creates a {@link org.elasticsearch.node.Node} client that connects
Expand Down Expand Up @@ -65,12 +65,12 @@ public TransportClientFactory(ElasticsearchConfig config) {

@Override
public Client getClient() {
Settings settings = ImmutableSettings.settingsBuilder()
Settings settings = Settings.settingsBuilder()
.put(clientSettings)
.build();

TransportAddress address = new InetSocketTransportAddress(transportHost, transportPort);
TransportAddress address = new InetSocketTransportAddress(new InetSocketAddress(transportHost, transportPort));

return new TransportClient(settings).addTransportAddress(address);
return TransportClient.builder().settings(settings).build().addTransportAddress(address);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.apache.samza.system.OutgoingMessageEnvelope;
import org.apache.samza.system.SystemStream;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.common.base.Charsets;
import com.google.common.base.Charsets;
import org.junit.Before;
import org.junit.Test;

Expand Down

0 comments on commit e753c8d

Please sign in to comment.