TransportClient in scala


(Dmitry) #1

How to create transport client in Scala for Elasticsearch 5.1.1 version?

I try to create class extends on abstract class TransportClient named PreBuiltTransportClient (like in docs).

class PreBuiltTransportClient(settings: Settings) extends TransportClient(settings, new util.ArrayList[Class[_ <: Plugin]])

But Idea tell me that it can't resolve constructor.

If i try this:

class PreBuiltTransportClient(settings: Settings) extends TransportClient(settings, List().asJava)

I catch an exception with null type


(Wanglifengwf) #2

you can use java client instead!


(Dmitry) #3

But I have project on scala, and need scala client for Elasticsearch. I can create client for Elasticsearch 2.x version, but can't for last version. I need a help :disappointed_relieved:


(David Pilato) #4

What is the problem?


(Dmitry) #5

I try to create class extends on abstract class TransportClient named PreBuiltTransportClient (like in docs).

class PreBuiltTransportClient(settings: Settings) extends TransportClient(settings, new util.ArrayList[Class[_ <: Plugin]])
But Idea tell me that it can't resolve constructor.


(David Pilato) #6

Can't you use the provided PreBuiltTransportClient class directly?
It's provided in this artifact:

<dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>transport</artifactId>
    <version>5.1.1</version>
</dependency>

(Dmitry) #7

Thanks it works. :relaxed:. Really works)


(system) #8

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.