Reputation: 431
it is my first time to use elasticsearch Grails plugin in my Grails2.5.1
application , when i'm trying to search for age=35
using elasticSearchService.search("${age:35}").searchResults
or using domainName.search("${age:35}").searchResults
the searchresults
is empty although there is a record in the DB age is equal to 35
. And is there any useful tutorial for using ElasticSearch
with Grails.
here is my domain:
class EmploymentSeeker {
String empType
String email
String fullName
String expYears
String socialStatus
Integer nubOfKids =0
String computerKnowledge
String militaryStatus
String haveDrivingLic
String gender
String eduQualification
String hasVehicle
String placeOfStudying
String courses
String currentTitle
String currentEmployerName
Integer age
Date dateCreated
static searchable = {
age boost:2.0
root true
except = ['email', 'fullName', 'placeOfStudying', 'currentTitle', 'currentEmployerName', 'dateCreated']
}
static constraints = {
}
static mapping={
}
}
Upvotes: 0
Views: 541
Reputation: 356
Looks like you have a rogue '$' in your query string. It probably should be:
elasticSearchService.search("age:35")
${..} is needed only if you are passing in a query and want Groovy to replace the expression before invoking the ElasticSearchService.
Upvotes: 0