How to index data using elasticSearch in grails without domain class
I have to index the data in elastic search using grails.
I have only used to index the domain class but i want to do it without
domain class is there any way to do it?
So at the end i just want a code from which i can index data to
elasticsearch and make sure that data is not the domain class object. it's
coming from file or in json.
I have below code by which i can index the domain calss object in
elasticsearch
// 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])
No comments:
Post a Comment