ElasticSearch makes index for new records created by UI,but the records created by liquibase file not indexed so it don't appears in search result,ElasticSearch should index all records created by UI and liquibase files,Is there any process for indexing the records in liquibase files.
OK, in fact we should provide a way to re-index everything.
I have something similar in mind for database schema updates -> let me work on this, it might take some time and maybe I'm wrong, but there's something I'd like to try here
Great,I hope this issue fix in next versions.
I tried to make rest service to get records from database and index them but I get org.hibernate.LazyInitializationException: failed to lazily initialize a collection could not initialize proxy - no Session due to entities relationships
Person person=personRepository.findOne(id);
IndexQuery indexQuery=new IndexQueryBuilder().withId(person.getId).withObject(person).build();
elasticsearchTemplate.index(indexQuery);
Do you have any suggestions?
This is another issue : for the lazy loading to work, you need to be in a transaction
Thanks for you time.
I'm trying to solve it,What about your idea?
This is another issue: you should open another ticket for this, or everything will get mixed up.
Anyway, this is not really an issue: you need to handle your transactions correctly with Hibernate, or you will get lazy loading issues. Short solution: add @Transactional on your method. For more explanation, have a look on StackOverflow, there must be thousands of posts on this.
OK, back to the original issue:
I agree this would be really cool to have, but this goes far beyond what we currently provide.
So we won't do that feature at the moment (which is why I'm closing this issue), but in the future, if many people want this (or if anybody wants to code this and provide a PR!) this would definitely be an excellent add-on.
@alialrabi I've created a module that will generate a service to reindex your entire DB in Elasticsearch.
https://www.npmjs.com/package/generator-jhipster-elasticsearch-reindexer
Most helpful comment
@alialrabi I've created a module that will generate a service to reindex your entire DB in Elasticsearch.
https://www.npmjs.com/package/generator-jhipster-elasticsearch-reindexer