elasticsearch - Spring Boot + Elastic Search -
i trying setup application spring boot , elastic search. application use spring data jpa repositories persist entities. problem have when try run application elasticsearch configuration enabled getting exception when repositories scanned.
i getting following exception:
caused by: java.lang.illegalargumentexception: unable obtain mapping metadata int!
my repository defined in following way:
@repository public interface adminuserrepository extends pagingandsortingrepository<adminuser, long> { /** * returns adminuser match email specified parameter. * @param email adminuser email. * @return adminuser instance. */ adminuser findbyemail(final string email); /** * returns adminuser match email , business name specified parameter. * @param email adminuser email. * @param businessname business name. * @return number of matching instances. */ int countbyemailandbusinessname(final string email, final string businessname); }
seems exception occurs due signature of count query returns int. though repository works fine jpa, throws exception enabling elastic search.
i want know if there restrictions return type in repository or if missing in configuration.
my java config class:
@configuration @enableelasticsearchrepositories public class elasticsearchconfig { }
thanks!
it looks spring data elasticsearch finding repository intended use spring data jpa. when you're using multiple spring data modules in same application, should place repositories in separate packages , reference package on @enable...
annotation.
for example:
@configuration @enableelasticsearchrepositories("com.foo.elasticsearch") @enablejparepositories("com.foo.jpa") public class myconfiguration { }
Comments
Post a Comment