The official Elasticsearch docs tell to instantiate ElasticsearchClient
like this:
ElasticsearchClient client = new ElasticsearchClient(transport);
Once I write this in my Grails 3 application with Gradle build management, I get the following compilation error: Cannot instantiate interface 'ElasticsearchClient'
The import
statement is: import org.elasticsearch.client.ElasticsearchClient
.
Indeed, ElasticsearchClient
gets resolved to:
package org.elasticsearch.client;
// ...
public interface ElasticsearchClient {
The Gradle dependency is: compile 'org.elasticsearch:elasticsearch:7.17.2'
- Why do they propose to instantiate an interface in their docs?
- What can I do to make it compile and use the Elasticsearch client?