(Quick Reference)
index
Purpose
Index domain instances to ElasticSearch.
Internally, the plugin uses the Bulk API of ElasticSearch to perform the index requests.
Examples
// Index all searchable instances
elasticSearchService.index()// Index a specific domain instance
MyDomain md = new MyDomain(value:'that')
md.save()
elasticSearchService.index(md)// Index a collection of domain instances
def ds = [new MyDomain(value:'that'), new MyOtherDomain(name:'this'), new MyDomain(value:'thatagain')]
ds*.save()
elasticSearchService.index(ds)// Index all instances of the specified domain class
elasticSearchService.index(MyDomain)
elasticSearchService.index(class:MyDomain)
elasticSearchService.index(MyDomain, MyOtherDomain)
elasticSearchService.index([MyDomain, MyOtherDomain])
Description
index signatures:
def index()
def index(Map params)
def index(Collection<Domain> domains)
def index(Domain… domain)
def index(Collection<Class> classes)
def index(Class… class)
Parameters
Map params - A map containing the Class (or Collection of Class) of the domain. Will index ALL persisted instances of the specified class(es).
Collection<Domain> domains - A Collection of domain instances to index.
Domain... domain - Same as Collection<Domain>, but with an ellipsis.
Collection<Class> classes - A Collection of Class of the domain to index. Will index ALL persisted instances of the specified classes.
Class... classes - Same as Collection<Class>, but with an ellipsis.