Merge branch 'stable-2.14' into stable-2.15
* stable-2.14:
Move: Return the modified change in JSON response
Elasticsearch: fix changes index type for bulk calls
Change-Id: I4ecd8cb0e36dc39f376a84eaeede97651b055f83
diff --git a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/AbstractElasticIndex.java b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/AbstractElasticIndex.java
index 4996847..c3bc66b 100644
--- a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/AbstractElasticIndex.java
+++ b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/AbstractElasticIndex.java
@@ -93,7 +93,8 @@
SitePaths sitePaths,
Schema<V> schema,
ElasticRestClientProvider client,
- String indexName) {
+ String indexName,
+ String indexType) {
this.sitePaths = sitePaths;
this.schema = schema;
this.gson = new GsonBuilder().setFieldNamingPolicy(LOWER_CASE_WITH_UNDERSCORES).create();
@@ -101,7 +102,16 @@
this.indexName = cfg.getIndexName(indexName, schema.getVersion());
this.indexNameRaw = indexName;
this.client = client;
- this.type = client.adapter().getType(indexName);
+ this.type = client.adapter().getType(indexType);
+ }
+
+ AbstractElasticIndex(
+ ElasticConfiguration cfg,
+ SitePaths sitePaths,
+ Schema<V> schema,
+ ElasticRestClientProvider client,
+ String indexName) {
+ this(cfg, sitePaths, schema, client, indexName, indexName);
}
@Override
diff --git a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticChangeIndex.java b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticChangeIndex.java
index 7d70e80..adb2a0f 100644
--- a/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticChangeIndex.java
+++ b/gerrit-elasticsearch/src/main/java/com/google/gerrit/elasticsearch/ElasticChangeIndex.java
@@ -99,6 +99,7 @@
private static final String CHANGES = "changes";
private static final String OPEN_CHANGES = "open_" + CHANGES;
private static final String CLOSED_CHANGES = "closed_" + CHANGES;
+ private static final String ALL_CHANGES = OPEN_CHANGES + "," + CLOSED_CHANGES;
private final ChangeMapping mapping;
private final Provider<ReviewDb> db;
private final ChangeData.Factory changeDataFactory;
@@ -112,7 +113,7 @@
SitePaths sitePaths,
ElasticRestClientProvider client,
@Assisted Schema<ChangeData> schema) {
- super(cfg, sitePaths, schema, client, CHANGES);
+ super(cfg, sitePaths, schema, client, CHANGES, ALL_CHANGES);
this.db = db;
this.changeDataFactory = changeDataFactory;
this.schema = schema;