Elasticsearch on Jhipster, Spring

喜欢而已 提交于 2019-12-06 05:00:50

Well, it seems that your index is empty. If you add entities programmatically (i.e. not from the interface), be sure to save them in the search repository as well.

Example :

Sample sample = new Sample();
sample.setName("bar");
sample = sampleRepository.save(sample);
sampleSearchRepository.save(sample);

You need to reaffect sample to get the id generated by Hibernate correctly indexed in elasticsearch.

UPDATE 10/02/2016

There is now a JHipster module to reindex elasticsearch repositories.

You should just do a GET call to the url by substituting the placeolder with the string that you want to search in the 'sample' entity.

You can test the call by using a rest client (eg. restclient plugin for firefox) or curl. The url should be something like:

http://localhost:8080/_search/samples/queryString

You'll get the results in json format.

If you need to customize the default search behaviour check the Elasticsearch documentation on Spring:

http://docs.spring.io/spring-data/elasticsearch/docs/1.0.5.RELEASE/reference/html/elasticsearch.repositories.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!