Merge branch 'stable-2.15' into stable-2.16

* stable-2.15:
  ElasticContainer: Remove unneeded environment setting
  Remove redundant "testName" methods from Elasticsearch tests
  ElasticVersionTest: Add supportedVersion asserts for V7_0
  Add support for Elasticsearch 7
  Allow to set Elasticsearch number of shards and replicas
  Discontinue support for Elasticsearch 2.4.x
  ElasticSetting.Builder: Make methods return 'this'
  Add link to security documentation for Elasticsearch 6.5
  ElasticVersionTest: Add missing tests for 6.5.x

This merge also makes necessary changes related to the project index
which is not implemented on stable-2.15:

- Remove the tests for version 2.4.x
- Add tests for version 7

Change-Id: Id39158eb94aa71a8a5b22702ccc2009f4ce48b8c
This commit is contained in:
David Pursehouse
2018-12-04 10:39:36 +09:00
23 changed files with 143 additions and 155 deletions

View File

@@ -40,9 +40,13 @@ class ElasticConfiguration {
static final String KEY_MAX_RETRY_TIMEOUT = "maxRetryTimeout";
static final String KEY_PREFIX = "prefix";
static final String KEY_SERVER = "server";
static final String KEY_NUMBER_OF_SHARDS = "numberOfShards";
static final String KEY_NUMBER_OF_REPLICAS = "numberOfReplicas";
static final String DEFAULT_PORT = "9200";
static final String DEFAULT_USERNAME = "elastic";
static final int DEFAULT_MAX_RETRY_TIMEOUT_MS = 30000;
static final int DEFAULT_NUMBER_OF_SHARDS = 5;
static final int DEFAULT_NUMBER_OF_REPLICAS = 1;
static final TimeUnit MAX_RETRY_TIMEOUT_UNIT = TimeUnit.MILLISECONDS;
private final Config cfg;
@@ -51,6 +55,8 @@ class ElasticConfiguration {
final String username;
final String password;
final int maxRetryTimeout;
final int numberOfShards;
final int numberOfReplicas;
final String prefix;
@Inject
@@ -71,6 +77,10 @@ class ElasticConfiguration {
DEFAULT_MAX_RETRY_TIMEOUT_MS,
MAX_RETRY_TIMEOUT_UNIT);
this.prefix = Strings.nullToEmpty(cfg.getString(SECTION_ELASTICSEARCH, null, KEY_PREFIX));
this.numberOfShards =
cfg.getInt(SECTION_ELASTICSEARCH, null, KEY_NUMBER_OF_SHARDS, DEFAULT_NUMBER_OF_SHARDS);
this.numberOfReplicas =
cfg.getInt(SECTION_ELASTICSEARCH, null, KEY_NUMBER_OF_REPLICAS, DEFAULT_NUMBER_OF_REPLICAS);
this.hosts = new ArrayList<>();
for (String server : cfg.getStringList(SECTION_ELASTICSEARCH, null, KEY_SERVER)) {
try {