Using Elasticsearch
Elasticsearch is an option that adds seach capabilities on top of your database.
This option has some limitations:
- It only works with SQL databases. There should not be too much work to add this feature to the Cassandra and MongoDB options, but as Elasticsearch support is new in JHipster, we first focus on our main use case before making it available for everyone.
When the Elasticsearch option is selected:
- Spring Data Elasticsearch is being used, and is automatically configured by Spring Boot (here is the documentation).
- By default, we use an embedded Elasticsearch in development, and try to connect to a local cluster in production. This can be configured by the standard Spring Boot properties, in the
application.yml
file.
When using the dev profile, the embedded Elasticsearch is configured to store data files under the target folder, a simplemvn clean
will destroy the persisted indices. - The "repository" package has new subpackage, called "search", that holds all ElastiSearch repositories.
- The "User" entity gets indexed in Elasticsearch, and you can query is using the
/api/_search/users/:query
REST endpoint. - When the entity sub-generator is used, the generated entity gets automatically indexed by Elasticsearch, and is used in the REST endpoint. Search capabilities are also added to the AngularJS user interface, so you can search your entity in the main CRUD screen.