Engine / Engine
Elasticsearch component is used to inject Elasticsearch into Guice container. After the configuration is loaded, it can be used globally.
- Support Elasticsearch version for 5.x
- Support custom configuration
How to use
<dependency> <groupId>io.edurt.gcm</groupId> <artifactId>gcm-elasticsearch</artifactId> <version>[1.0.9, )</version> </dependency>
Warning: >= 1.2.0 has been replaced with the following usage
<dependency> <groupId>io.edurt.gcm.engine</groupId> <artifactId>gcm-engine-elasticsearch</artifactId> <version>[1.2.0, )</version> </dependency>
Add the above configuration information to the pom.xml Reload the download dependency information in the file.
To configure the Elasticsearch connector, create a catalog properties file in
conf/catalog/elasticsearch.properties named, for example, elasticsearch.properties, to mount the Elasticsearch connector as the elasticsearch catalog. Create the file with the following contents, replacing the connection properties as appropriate for your setup:
|component.elasticsearch.urls||Connect to the database specified by the Elasticsearch server,Multiple address use
|component.elasticsearch.scheme||Protocol used to connect Elasticsearch service||
String path = "/etc/conf/catalog/elasticsearch.properties"; Injector injector = Guice.createInjector(new ElasticsearchModule(path)); @Inject private ElasticsearchClient client;
pathThe absolute path of the configuration file, usually