elasticsearch-grails-plugin icon indicating copy to clipboard operation
elasticsearch-grails-plugin copied to clipboard

Searchable closure to use for inheritance

Open cwneill opened this issue 12 years ago • 0 comments

Our domain model has simple inheritance with class B inheriting from concrete base class A. We would like all instances of plain A's and B's to show up in the Elasticsearch index and be able to retrieve both A's and B's with the same query. We can't figure out what to specify for the searchable closure in class B to make this work. Any suggestions or examples would be greatly appreciated.

Charlie

class A implements Comparable {

static searchable = { types component: true author component: true categories component: true state component: true ... imageSmallUrl index: 'not_analyzed', excludeFromAll: false screenshot2Url index: 'not_analyzed', excludeFromAll: false

except = [
    'createdBy',
    'createdDate',
    'editedBy',
    'version'
]

}

...

}

class B extends A {

static searchable = { ... <<<<<<<====== Not sure what to put here! }

String systemUri String externalId String externalViewUrl String externalEditUrl

...

}

cwneill avatar Jul 17 '12 19:07 cwneill