1

Has anyone successfully used elasticsearch (searchly) through the Pivotal Web Services market place for a Jhipster generated application? I have correctly bound the searchly service to my application, but keep getting the following error:

Failed to instantiate [org.elasticsearch.client.Client]: Factory method 'elasticsearchClient' threw exception; nested exception is java.lang.IllegalStateException: java.lang.NumberFormatException: For input string: "//gopivotal:<redacted>@dori-us-east-1.searchly.com"

My jhipster production profile is as follows:

data:
  elasticsearch:
    cluster-name:
    cluster-nodes: ${vcap.searchly.credentials.uri}

Any help appreciated.

Amit Kumar Gupta
  • 17,184
  • 7
  • 46
  • 64
  • 1
    `cluster-nodes` is a `host:port` pair. You're trying to match that against the URI of the service and I am not sure it's supposed to work; I am using [Jest](https://github.com/searchbox-io/Jest) on pws – Stephane Nicoll May 24 '16 at 06:20

1 Answers1

1

cluster-nodes is actually used behind the scenes by TransportClientFactoryBean and it can't parse the username:password bit. It doesn't feel right to paste the URI of the service in the "cluster-nodes" property but I couldn't find anything else to configure it.

Can you please create an issue in the Spring Data ElasticSearch tracker?

In the meantime, I suggest to use Jest, you can create your own client easily from PWS as follows:

public JestClient jestClient(String url) {

    HttpClientConfig clientConfig = new HttpClientConfig
            .Builder(String url)
            .readTimeout(6000)
            .multiThreaded(true)
            .build();

    JestClientFactory factory = new JestClientFactory();
    factory.setHttpClientConfig(clientConfig);
    return factory.getObject();
}

And pass the property (as you did in your description) to that method.

Stephane Nicoll
  • 31,977
  • 9
  • 97
  • 89