Groovy Client - Closure Issue

Hi all,

I am trying to use Groovy Client through Grails application, and getting the error below, any help would be appreciated. if using without closure it works (the Java client way).

Grails version - 2.3.11
ES version - 1.4
Groovy Client version - 1.4.4

Code snippet -
import org.elasticsearch.client.transport.TransportClient
import org.elasticsearch.common.transport.InetSocketTransportAddress
import org.elasticsearch.common.settings.ImmutableSettings
import org.elasticsearch.action.search.SearchResponse
TransportClient client = new TransportClient(ImmutableSettings.settingsBuilder { cluster { name = "elasticsearch" } client { transport { sniff = true } } });

Error -
No signature of method: static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder() is applicable for argument types

Any help would be greatly appreciated. Thanks!

Elasticsearch 1.4 is outdated and has severe CVS issues. Do not use it.

Please update to Elasticsearch 2.3+, Groovy 2.4.4+, and Groovy client 2.x, then you can use

TransportClient client = TransportClient.builder().settings(Settings.settingsBuilder {
  cluster.name = "elasticsearch"
  client.transport.sniff = true
}).build()