-
Notifications
You must be signed in to change notification settings - Fork 43
Elasticsearch 7 rest client #58
base: master
Are you sure you want to change the base?
Changes from 20 commits
ae1a25c
8557d8c
50a3077
e9e1162
358d966
884ec00
2c119f9
c063419
bab9fd9
5ebc6e7
fc889bf
2e96a0c
26bb7ff
223bc45
22d01c7
29dffca
9afc1ea
cfda4b3
f5498d8
01b8fda
43bbef2
691fe3f
aa473f3
4ce4c2e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,8 @@ release.properties | |
| *.iws | ||
| .idea/ | ||
| out/ | ||
| build/ | ||
| **/buildOutputCleanup/ | ||
|
|
||
| # Eclipse | ||
| .settings/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,61 +1,37 @@ | ||
| package io.dropwizard.elasticsearch.config; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.google.common.net.HostAndPort; | ||
| import io.dropwizard.validation.ValidationMethod; | ||
| import org.hibernate.validator.constraints.NotEmpty; | ||
|
|
||
| import javax.validation.constraints.NotNull; | ||
| import org.apache.http.HttpHost; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import javax.validation.constraints.NotNull; | ||
|
|
||
| /** | ||
| * Configuration class for Elasticsearch related settings. | ||
| */ | ||
| public class EsConfiguration { | ||
| @JsonProperty | ||
| @NotNull | ||
| private List<HostAndPort> servers = Collections.emptyList(); | ||
|
|
||
| @JsonProperty | ||
| @NotEmpty | ||
| private String clusterName = "elasticsearch"; | ||
|
|
||
| @JsonProperty | ||
| private boolean nodeClient = true; | ||
|
|
||
| @JsonProperty | ||
| @NotNull | ||
| private Map<String, String> settings = Collections.emptyMap(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are quite few settings which might be interesting for the Low Level REST client. https://www.elastic.co/guide/en/elasticsearch/client/java-rest/7.1/java-rest-low-usage-initialization.html Also adding the possibility to add the Sniffer would be nice:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added a bunch more.. Not sure if did it properly.. Tests will be added soon.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added more tests now the coverage is higher and 100% on health checks. Could you comment more about what do you think is necessary to be covered in configuration? I added most of them listed in the documentation (but feel a bit hard to write test unless using testcontainer). Also I sort of feel it's a bit too complicate, maybe it's better to cover some simple common configs and then let sophisticated users do what they want with the |
||
|
|
||
| @JsonProperty | ||
| private String settingsFile = null; | ||
| private List<String> servers = Collections.emptyList(); | ||
|
|
||
| public List<HostAndPort> getServers() { | ||
| public List<String> getServers() { | ||
| return servers; | ||
| } | ||
|
|
||
| public String getClusterName() { | ||
| return clusterName; | ||
| } | ||
|
|
||
| public boolean isNodeClient() { | ||
| return nodeClient; | ||
| public List<HttpHost> getServersAsHttpHosts() { | ||
| ArrayList<HttpHost> httpHosts=new ArrayList<>(); | ||
| getServers().forEach(hostAndPort -> { | ||
| HttpHost httpHost = HttpHost.create(hostAndPort); | ||
| if (httpHost.getPort() < 0) { | ||
| httpHost = new HttpHost(httpHost.getHostName(), 9200); | ||
| } | ||
| httpHosts.add(httpHost); | ||
| }); | ||
| return httpHosts; | ||
| } | ||
|
|
||
| public Map<String, String> getSettings() { | ||
| return settings; | ||
| } | ||
|
|
||
| public String getSettingsFile() { | ||
| return settingsFile; | ||
| } | ||
|
|
||
| @ValidationMethod | ||
| @JsonIgnore | ||
| public boolean isValidConfig() { | ||
| return nodeClient || !servers.isEmpty(); | ||
| } | ||
| } | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.