summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacek Centkowski <jcentkowski@collab.net>2019-03-11 18:16:54 +0100
committerDavid Pursehouse <dpursehouse@collab.net>2019-03-12 09:54:52 +0900
commit17329c7629986eeb8e40ff83e2ba1202ca717f0f (patch)
tree4aed2e1a4094e5ff2de720de5fb2eaf70941c7bc
parent1ad849274e5aba54486d73700f32470b505c11a8 (diff)
Fix account and group query with Elasticsearch 6
When querying against Elasticsearch 6, gerrit uses the following URLs: http://elasticsearch:9200/gerrit_accounts_0010/accounts/_search http://elasticsearch:9200/gerrit_groups_0007/groups/_search whereas it should use: http://elasticsearch:9200/gerrit_accounts_0010/_doc/_search http://elasticsearch:9200/gerrit_groups_0007/_doc/_search The type is properly resolved through the index adapter, so use that to build the ElasticQuerySource instead of using hard coded constants for both accounts and groups indexes. Bug: Issue 10591 Change-Id: I90cd74da9246f56bc9b2ef8464587ab04152876b Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
-rw-r--r--java/com/google/gerrit/elasticsearch/ElasticAccountIndex.java3
-rw-r--r--java/com/google/gerrit/elasticsearch/ElasticGroupIndex.java2
2 files changed, 2 insertions, 3 deletions
diff --git a/java/com/google/gerrit/elasticsearch/ElasticAccountIndex.java b/java/com/google/gerrit/elasticsearch/ElasticAccountIndex.java
index 1b69b6d295..d0b70ae6bd 100644
--- a/java/com/google/gerrit/elasticsearch/ElasticAccountIndex.java
+++ b/java/com/google/gerrit/elasticsearch/ElasticAccountIndex.java
@@ -93,8 +93,7 @@ public class ElasticAccountIndex extends AbstractElasticIndex<Account.Id, Accoun
public DataSource<AccountState> getSource(Predicate<AccountState> p, QueryOptions opts)
throws QueryParseException {
JsonArray sortArray = getSortArray(AccountField.ID.getName());
- return new ElasticQuerySource(
- p, opts.filterFields(IndexUtils::accountFields), ACCOUNTS, sortArray);
+ return new ElasticQuerySource(p, opts.filterFields(IndexUtils::accountFields), type, sortArray);
}
@Override
diff --git a/java/com/google/gerrit/elasticsearch/ElasticGroupIndex.java b/java/com/google/gerrit/elasticsearch/ElasticGroupIndex.java
index f694a05482..e74f2084fa 100644
--- a/java/com/google/gerrit/elasticsearch/ElasticGroupIndex.java
+++ b/java/com/google/gerrit/elasticsearch/ElasticGroupIndex.java
@@ -91,7 +91,7 @@ public class ElasticGroupIndex extends AbstractElasticIndex<AccountGroup.UUID, I
public DataSource<InternalGroup> getSource(Predicate<InternalGroup> p, QueryOptions opts)
throws QueryParseException {
JsonArray sortArray = getSortArray(GroupField.UUID.getName());
- return new ElasticQuerySource(p, opts.filterFields(IndexUtils::groupFields), GROUPS, sortArray);
+ return new ElasticQuerySource(p, opts.filterFields(IndexUtils::groupFields), type, sortArray);
}
@Override