Sravani Ps
Sravani Ps

Reputation: 1

To perform search operation through UI in Jhipster using elastic search for existing database MySQL

I started Jhipster for PoC purpose and I need to perform search through UI for already existing data present in MySQL database.I have the following doubts:

  1. Do we need to install/have elastic search in order to run it first and check for the results?
  2. Or choosing elastic search while creating the Jhipster application and configuring it is enough to use it further?

I have tried using generator-jhipster-elasticsearch-reindexer module by installing it. but it did not worked as expected.After installing it I ended up with the following error.

java.lang.IllegalStateException: handshake failed, mismatched cluster name [Cluster [internal-test-cluster-name2843e241-29cc-4bc0-82db-600eb78ed261]] - {127.0.0.1:9300}{pbkSwq2SQ-CTopOjTqsVcg}{127.0.0.1}{127.0.0.1:9300} at org.elasticsearch.transport.TransportService.handshake(TransportService.java:404) at org.elasticsearch.transport.TransportService.handshake(TransportService.java:367) at org.elasticsearch.discovery.zen.UnicastZenPing$PingingRound.getOrConnect(UnicastZenPing.java:366) at org.elasticsearch.discovery.zen.UnicastZenPing$3.doRun(UnicastZenPing.java:471) at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723) at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

The above error was resolved by adding sprig.data.jest.uri in application-dev.yml, but still the search mechanism is not working. i.e., It is not able to query on existing database.

Actual result: able to perform search from UI when i create an entity from the UI. Reason being when an entity is made through API then it is updating the elastic search database and producing the result. Expected result: To able to perform the same search for already existing data when I connect to the MySQL database.

Upvotes: 0

Views: 456

Answers (1)

Duc Le
Duc Le

Reputation: 51

Jhipster already explained how to work with elasticsearch on their website: https://www.jhipster.tech/using-elasticsearch/

Here is short answer for your question: 1. You do not need to install elasticsearch if you run your app in dev profile, because it uses embedded Elasticsearch instance. 2. You must select Elasticsearch open while creating Jhipster app so that the generator add search capabilities to your code.

The generator-jhipster-elasticsearch-reindexer module only works if you have enabled Elasticsearch in your app.

Upvotes: 1

Related Questions