Jpa Datadescriptor
ElasticSearch is a distributed search and analytics engine that ensures extremely fast searches even in large data sets. We integrated ElasticSearch into JBStrap as an alternative database, allowing fast searches in the JBStrap framework. In JBStrap, you can use ElasticSearch to quickly search in structured and unstructured data sets and search for text, numbers, dates or even IDs.
Please note: The ElasticSearch plugin only works with a 6.1.2 version ElasticSearch server!
Connecting to the ElasticSearch server
In order to access the data in an ElasticSearch server, first you have to connect to the server. You only have to connect to the server once, since once a connection is open, it remains active until it is closed. Implement the connection in the Startup class.
To implement the connection, specify the server name, IP address and port. The default address and port for the ElasticSearch is localhost:9300. Write the following code to implement the connection:
Disconnecting from an ElasticSearch server
Just like all database server connections, you have to close an ElasticSearch server connection before you quit the application. Do this in the shutdown() method of the Startup class, as this method is executed before each application shutdown. Use the following statement to disconnect from the server:
ElasticSearch entity class
The entity class used by the ElasticSearch plugin is very similar to that used by the JPA DAO. You have to create a POJO class and describe the physical data structure (ElasticSearch index attributes and the corresponding parameters).
Here's an example for an ElasticSearch entity class: