Open user-0209 opened 9 months ago
I tried to generate an app with the configuration below. I don't get an error anymore (probably because the pagination is turned off), but the search simply delivers no results. I turned the faker off and added my own entries. I also tried to add "generator-jhipster-es-entity-reindexer", but apparently it didn't help.
@user-0209 So you still don't have a solution? At least some manual fix after the generation?
{
"generator-jhipster": {
"applicationType": "monolith",
"authenticationType": "oauth2",
"baseName": "kitakeiler",
"buildTool": "gradle",
"cacheProvider": "ehcache",
"clientFramework": "angular",
"clientTestFrameworks": ["cypress"],
"clientTheme": "journal",
"clientThemeVariant": "primary",
"creationTimestamp": 1699909007890,
"cypressAudit": false,
"cypressCoverage": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"devServerPort": 4200,
"enableGradleEnterprise": null,
"enableHibernateCache": true,
"enableSwaggerCodegen": false,
"enableTranslation": true,
"entities": [
"AcquisitionTarget",
"Agent",
"ChangeEvent",
"ColoredCategory",
"ContactInfo",
"Country",
"Employee",
"Facility",
"FacilityType",
"Guidelines",
"Notification",
"StatusAdvancement",
"StatusCampaign",
"StatusInterest"
],
"gradleEnterpriseHost": null,
"jhipsterVersion": "8.0.0",
"languages": ["de", "en"],
"lastLiquibaseTimestamp": 1699909847000,
"messageBroker": false,
"microfrontend": null,
"microfrontends": [],
"nativeLanguage": "de",
"otherModules": [
{
"name": "generator-jhipster-es-entity-reindexer",
"version": "1.0.1"
}
],
"packageName": "com.company",
"prodDatabaseType": "postgresql",
"reactive": false,
"searchEngine": "elasticsearch",
"serverPort": null,
"serverSideOptions": ["searchEngine:elasticsearch"],
"serviceDiscoveryType": false,
"skipUserManagement": true,
"testFrameworks": ["gatling", "cypress"],
"websocket": false,
"withAdminUi": true
}
}
I don't have a solution at this moment. I'm trying to make https://github.com/Ebsan/generator-jhipster-es-entity-reindexer work. I'm pretty sure its just about rebuilding the index.
JHipster has completed the sample check
.yo-rc.json
: valid
Entities JDL:
Application: successfully generated
Frontend check: success
Backend check: success
E2E check: success
This check uses jhipster info
output from the issue description to generate the sample.
Bug report that does not contain this information will be marked as invalid.
Meanwhile I undestand that in version 8 jhipster adopted the ES module standard. Also, some exports might have changed and that breaks not only https://github.com/Ebsan/generator-jhipster-es-entity-reindexer but also most of the other generators not immediately part of the jhipster repository. However, I need this reindexing functionality and would go forward to update the generator. Can somebody provide a pointer to a sample generator that is up to speed with jhipster 8 and not part of the jhipster repository? Or, point me to documentation about creating a generator from scratch? That would be helpful.
@user-0209 I believe you can use https://github.com/jhipster/generator-jhipster-entity-audit as an example. Updated documentation is available here, any feedback is welcome
@user-0209 I found this sample with elasticsearch on version 8. https://github.com/jhipster/jhipster-sample-app-elasticsearch
Maybe it is of any to you.
@user-0209 I found this sample with elasticsearch on version 8. https://github.com/jhipster/jhipster-sample-app-elasticsearch
Maybe it is of any to you.
Thank you for responding. In fact, I find it amazing, how fast I'm getting responses in this Jhipster context. However, although the project has been upgraded to 8.0.0, it exhibits the same weired behaviour as my newly generated application. In fact, it is even more strange: The BankAccount and Label entities can be searched without throwing exception, but matching entities would not be found. The Operation entity is throwing an exception. In all cases, after just updating an entity (click edit, then save), that specific entity instance can be found, all others of the same type still not. I guess, there has been a difference, how these three entities have been generated. Altogether, this makes it very difficult to get into a strictly repeatable development/testing flow. That's why I'm so insisting on that. I hope, I can achieve something with the blueprint link, which appears to open another box.... Anyways, I'll try to solve this and report back.
Our elasticsearch tests needs improvements to avoid regressions like this one.
By the way, if someone is interested, I positively tested running the backend generated with the latest version 7 and the frontend with version 8. The search works. You only need to change the GET mappings in all *Resource.java files from @GetMapping("/_search/RESOURCE") to @GetMapping("/RESOURCE/_search"), which is really not hard to do.
This way you get Angular 16, which is nice.
@user-0209 Any progress in the meanwhile?
@aturyng: The problem is not ES as such. Once the index for the entity is in place, things work (for the entity instances that have been updated). The problem is with the preloaded fake-data. Not sure, if I'm old-fashioned, but I want defined, repeatable test data in the development cycle. Earlier (I think version 6), I had one of those re-indexing extensions in place and it worked. However, and here is the point: since few versions so many things have changed that all these blueprints don't work and apparently, nobody is taking the effort, to update them (guess why). So I embarked on porting one of the reindexing modules to a proper blueprint, but I have to say, it is very time-consuming due to a complete lack of documentation of those jHipster base classes, but not only. The blueprints chapter can only serve as a teaser, re-eingineering the base classes is necessary. In summary, I'd highly appreciate JSDoc for the baseclasses and in the blueprints documentation experts should say, when (scenario) you want which base class. Amongst the core-team maintained official blueprints there should be an (almost) empty blueprint that is up to speed with the respective JHipster version.
Having said this, I'm still much in favour of getting the application generated, because otherwise you'd end in another tunnel. Thanks to the core team. Let me know, if I'm missing some documentation.
The issue seems to be with new elasticsearch. As a workaround I've used elasticsearch version from Jhipster 7 and it works very good. Version 7.17.4 –> OK, version 8.7.1 -> NOT OK. I'm pretty sure protocol changed on ES side, since Jhipster 7 with ES v8.7.1 also gets an error.
@Nenzyz Thank you for your input! Unfortunately, when I simply change the version in the docker container from 8.7.1 to 7.17.4 -- it does not solve the problem. Have you done more than this? Can you maybe share your relevant config snippets with us?
@Nenzyz Thank you for your input! Unfortunately, when I simply change the version in the docker container from 8.7.1 to 7.17.4 -- it does not solve the problem. Have you done more than this? Can you maybe share your relevant config snippets with us?
The only change from the freshly created project was changes in src/main/docker/elasticsearch.yml
version, and for sure restart of the container. It would be nice to know if the error you are getting the same as reporter has or something else?
What doesn't work still is reindexing of existing entities, but this is unrelated to this issue.
(I won't post in the old issue, since this one is referenced in the old)
I think I know what happened here, give me some time I'll get a reason and a way to solve it.
Unfortunately, jhipster 8.1.0 does not solve the problem. I get exactly the same error.
The same error with me, anyone can help to fix it?
Hi,
Not a real fix, but the jhipster-reindexer module can be used to resync entities in search engine
@Tcharl thank you for your reply. I faced this error with jhipster-reindexer. I have never used jhipster modules. Could you let me know how to use it?
$ yo jhipster-es-entity-reindexer Error jhipster-es-entity-reindexer
Cannot find module 'C:\Users\Nyen.npm-packages\node_modules\generator-jhipster-es-entity-reindexer\node_modules\generator-jhipster\dist\generators\generator-base\index.js' TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('MODULE_NOT_FOUND')
It's kind of an old one: the class has to be adapted a bit
Overview of the issue
In a newly generated application, Elastic Search is causing an "Internal server error" by throwing an exception. Once an entity instance has been updated, it can be searched. On all other (not yet updated) entities of the same type, ElasticSearch doesn't find anything. On other entity types, where no entity yet has been updated, the Internal Server Error/ElasticSearch Exception still occurs.
Stack Traces and Messages
Application Message when no entity has been updated:
Messages upon successful search on an previously updated entity:
Messages upon failed search on a not-yet updated entity:
Motivation for or Use Case
A newly generated application should work out of the box. Apparently ElasticSearch has to build datastructures that do not exist on a new application. Also, initial indexing does not happen on fake data. All of this creates much irritation because you are not told, what the problem is.
Reproduce the error
A sample JDL is given below. JDL is in the otherwise empty application folder.
Related issues
https://github.com/jhipster/generator-jhipster/issues/22603
Suggest a Fix
JHipster Version(s)
JHipster configuration
.yo-rc.json file
JDL definitions
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryBrowsers and Operating System
Ubuntu 22.04 Firefox: 119.0.1
Environment and Tools
openjdk version "17.0.8.1" 2023-08-24 OpenJDK Runtime Environment (build 17.0.8.1+1-Ubuntu-0ubuntu122.04) OpenJDK 64-Bit Server VM (build 17.0.8.1+1-Ubuntu-0ubuntu122.04, mixed mode, sharing) git version 2.34.1 node: v20.9.0 npm: 10.1.0 Docker version 24.0.7, build afdd53b