mstein / elasticsearch-grails-plugin

ElasticSearch grails plugin
Based on Graeme Rocher initial stub. Note that it is still in early stage.
Other
62 stars 164 forks source link

Elastic type names are not distinct for same name domain classes in different packages #51

Closed vsaar closed 11 years ago

vsaar commented 11 years ago

In ran into this issue while using a local checkout of the plugin. My app has a my.package.User and my.package.Tag domain class just as the plugin has. When I persist instances of my users, bulk index items are never removed from the operation batch list, because test.User is assumed to be the domain class' type, effectively resulting in an endless loop, as items are pushed again and again.

Mapping the domain class to the Elastic type name only takes the simple class name into account. my.package.User and test.User are both mapped to user.

This pull request is fixing this by using the fully-qualified class name, e.g. my.package.user and test.user.

mstein commented 11 years ago

By the way, when installing the plugin from the codebase, you should do a package-plugin command before and install the zip. The package-plugin command will remove all classes from the "test" package of the plugin (which should includes all test domain classes, controllers, services and tests).

verglor commented 11 years ago

Now there is warning "Type [*] contains a '.', it is recommended not to include it within a type name" http://elasticsearch-users.115913.n3.nabble.com/Type-name-warning-td2949735.html