7 Low level API - Reference Documentation
Authors: Manuarii Stein, Stephane Maldini, Serge P. Nekoval
Version: 0.18.7.1-SNAPSHOT
7 Low level API
If you need to use the Elastic Search client directly, you can use theelasticSearchHelper bean that is
injected in any services/controllers to get the current instance.
Simply encapsulate your code within a withElasticSearch bloc,
and you will get a org.elasticsearch.client.Client implementation to play with.class MySearchService {
static transactional = true def elasticSearchHelper def myMethod(indexName, settings) {
elasticSearchHelper.withElasticSearch { client ->
// Do some stuff with the ElasticSearch client
client.admin()
.indices()
.prepareCreate(indexName)
.setSettings(settings)
.execute()
.actionGet()
}
}
}