Open pascalgrimaud opened 6 years ago
The main changes that impact this module are:
Backend
- import org.elasticsearch.indices.IndexAlreadyExistsException;
+ import org.elasticsearch.ResourceAlreadyExistsException;
- Spring Data changed method signatures for CrudRepository, saving lists is changed from `save` -> `saveAll` ([related commit](https://github.com/spring-projects/spring-data-commons/commit/727ab8384cac21e574526f325e19d6af92b8c8df))
After those changes the backend works with JHipster 5 and Spring Boot 2
Frontend
shared
folder to the core
folder:
elasticsearch-reindex.route.ts
- import { UserRouteAccessService } from '../../shared';
+ import { UserRouteAccessService } from 'app/core';
elasticsearch-reindex
route, not sure how to fix this, but it probably requires changes toelasticsearch-reindex.route.ts
Thanks a lot for the summary. Do you know if bullet point 1 affects the module at all?
It doesn't affect the module at all, just a note for when you test
Some changes in PR #47
Any update on this? +1 for React support:)
@kenhuang REST API is ready, but I'm not ready write full React template. If you can provide example page for React and service layer same as angular or angularjs I'll try to implement it.
Hi, to fix the lazy-loaded problem, I made this 2 changes:
In file navbar.component.html:
- <a class="dropdown-item" routerLink="elasticsearch-reindex" routerLinkActive="active" (click)="collapseNavbar()">
- <fa-icon [icon]="'fw fa-search'" [fixedWidth]="true"></fa-icon>
+ <a class="dropdown-item" routerLink="admin/elasticsearch-reindex" routerLinkActive="active" (click)="collapseNavbar()">
+ <fa-icon [icon]="'search'" [fixedWidth]="true"></fa-icon>
In file elasticsearch-reindex.module.ts
- RouterModule.forRoot(ADMIN_ROUTES, { useHash: true })
+ RouterModule.forChild(ADMIN_ROUTES)
I attach the patch files.
Any progress on this? Looks like there are other changes needed for JH 5.7.2
For Jhipster 5.7.2:
In ElasticsearchIndexService.java :
- private final ElasticsearchTemplate elasticsearchTemplate
- TransactionStatusSearchRepository transactionStatusSearchRepository,
- ElasticsearchTemplate elasticsearchTemplate)
+ TransactionStatusSearchRepository transactionStatusSearchRepository)
- this.elasticsearchTemplate = elasticsearchTemplate;
- elasticsearchTemplate.deleteIndex(entityClass);
- try {
- elasticsearchTemplate.createIndex(entityClass);
- } catch (ResourceAlreadyExistsException e) {
- // Do nothing. Index was already concurrently recreated by some other service.
- }
- elasticsearchTemplate.putMapping(entityClass);
In elasticsearch-reindex.module.ts :
- RouterModule.forChild(ADMIN_ROUTES)
+ RouterModule.forChild(ADMIN_ROUTES)
For Jhipster 5.7.2:
In ElasticsearchIndexService.java :
- private final ElasticsearchTemplate elasticsearchTemplate - TransactionStatusSearchRepository transactionStatusSearchRepository, - ElasticsearchTemplate elasticsearchTemplate) + TransactionStatusSearchRepository transactionStatusSearchRepository) - this.elasticsearchTemplate = elasticsearchTemplate; - elasticsearchTemplate.deleteIndex(entityClass); - try { - elasticsearchTemplate.createIndex(entityClass); - } catch (ResourceAlreadyExistsException e) { - // Do nothing. Index was already concurrently recreated by some other service. - } - elasticsearchTemplate.putMapping(entityClass);
In elasticsearch-reindex.module.ts :
- RouterModule.forChild(ADMIN_ROUTES) + RouterModule.forChild(ADMIN_ROUTES)
It worked! thanks a lot
Hi all,
I did the above and it is working now for me. The problem I have now is that with removing the elasticsearchTemplate I removed also the delete/create index.
This means that I am left with orphan entries in elasticsearch indexes in some cases.
Any idea how to delete/create again the indexes?
Thank you.
I'm getting the following compilation error. ElasticsearchIndexService.java:[107,32] cannot access com.sun.beans.introspect.PropertyInfo [ERROR] class file for com.sun.beans.introspect.PropertyInfo not found workaround here https://bugs.openjdk.java.net/browse/JDK-8212636
In elasticsearch-reindex.module.ts :
what is the change in In elasticsearch-reindex.module.ts ?
The main changes that impact this module are:
Backend
- Elasticsearch removed the embedded option, so you have to run an instance locally in dev.
- Elasticsearch deprecated IndexAlreadyExistsException for ResourceAlreadyExistsException (release notes)
- import org.elasticsearch.indices.IndexAlreadyExistsException; + import org.elasticsearch.ResourceAlreadyExistsException; - } catch (IndexAlreadyExistsException e) { + } catch (ResourceAlreadyExistsException e) {
- Spring Data changed method signatures for CrudRepository, saving lists is changed from
save
->saveAll
(related commit)- elasticsearchRepository.save(results.getContent()); + elasticsearchRepository.saveAll(results.getContent());
After those changes the backend works with JHipster 5 and Spring Boot 2
Frontend
- Some files were moved from the
shared
folder to thecore
folder:elasticsearch-reindex.route.ts - import { UserRouteAccessService } from '../../shared'; + import { UserRouteAccessService } from 'app/core';
- JHipster's Angular Admin module is now lazy-loaded and it doesn't recognize the
elasticsearch-reindex
route, not sure how to fix this, but it probably requires changes toelasticsearch-reindex.route.ts
- New JHipster React frontend option, I can help with this part if you want
Please how to use this module with React? I'm using JHipster 6.10.3
Hi @geraldhumphries,
Just to let you know that, with the release of JHipster 5, they can be some breaking changes.
You need to test if your module works well, and if it's the case, you need to add
jhipster-5
in keywords: https://github.com/geraldhumphries/generator-jhipster-elasticsearch-reindexer/blob/master/package.json#L5-L8With that, your module will be displayed at this question:
? Would you like to install other generators from the JHipster Marketplace? (y/N)
See https://github.com/jhipster/generator-jhipster/pull/7408Thank you for this module ;)