geraldhumphries / generator-jhipster-elasticsearch-reindexer

A JHipster module that inserts all your data into Elasticsearch and helps solve mapping and maintenance issues.
Other
45 stars 22 forks source link

JHipster 5 compatibility #45

Open pascalgrimaud opened 6 years ago

pascalgrimaud commented 6 years ago

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-L8

With 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/7408

Thank you for this module ;)

ruddell commented 6 years ago

The main changes that impact this module are:

Backend

 - 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))

Frontend

geraldhumphries commented 6 years ago

Thanks a lot for the summary. Do you know if bullet point 1 affects the module at all?

ruddell commented 6 years ago

It doesn't affect the module at all, just a note for when you test

FireWolf2007 commented 6 years ago

Some changes in PR #47

kenhuang commented 6 years ago

Any update on this? +1 for React support:)

FireWolf2007 commented 6 years ago

@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.

eforza commented 6 years ago

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>&nbsp;
+ <a class="dropdown-item" routerLink="admin/elasticsearch-reindex" routerLinkActive="active" (click)="collapseNavbar()">
+ <fa-icon [icon]="'search'" [fixedWidth]="true"></fa-icon>&nbsp;

In file elasticsearch-reindex.module.ts

-        RouterModule.forRoot(ADMIN_ROUTES, { useHash: true })
+        RouterModule.forChild(ADMIN_ROUTES)

I attach the patch files.

patchs.tar.gz

adnansenyurt commented 5 years ago

Any progress on this? Looks like there are other changes needed for JH 5.7.2

merymer commented 5 years ago

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)
adnansenyurt commented 5 years ago

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

lukianab commented 5 years ago

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.

dean0bambin0 commented 5 years ago

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

extraclassi commented 3 years ago

In elasticsearch-reindex.module.ts :

what is the change in In elasticsearch-reindex.module.ts ?

ArmelZy commented 3 years ago

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 the core 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