Search in sources :

Example 1 with GroupMapping

use of com.google.gerrit.elasticsearch.ElasticGroupIndex.GroupMapping in project gerrit by GerritCodeReview.

the class ElasticTestUtils method createAllIndexes.

static void createAllIndexes(ElasticNodeInfo nodeInfo) {
    Schema<ChangeData> changeSchema = ChangeSchemaDefinitions.INSTANCE.getLatest();
    ChangeMapping openChangesMapping = new ChangeMapping(changeSchema);
    ChangeMapping closedChangesMapping = new ChangeMapping(changeSchema);
    openChangesMapping.closedChanges = null;
    closedChangesMapping.openChanges = null;
    nodeInfo.node.client().admin().indices().prepareCreate(String.format("%s%04d", CHANGES_PREFIX, changeSchema.getVersion())).addMapping(OPEN_CHANGES, gson.toJson(openChangesMapping)).addMapping(CLOSED_CHANGES, gson.toJson(closedChangesMapping)).execute().actionGet();
    Schema<AccountState> accountSchema = AccountSchemaDefinitions.INSTANCE.getLatest();
    AccountMapping accountMapping = new AccountMapping(accountSchema);
    nodeInfo.node.client().admin().indices().prepareCreate(String.format("%s%04d", ACCOUNTS_PREFIX, accountSchema.getVersion())).addMapping(ElasticAccountIndex.ACCOUNTS, gson.toJson(accountMapping)).execute().actionGet();
    Schema<AccountGroup> groupSchema = GroupSchemaDefinitions.INSTANCE.getLatest();
    GroupMapping groupMapping = new GroupMapping(groupSchema);
    nodeInfo.node.client().admin().indices().prepareCreate(String.format("%s%04d", GROUPS_PREFIX, groupSchema.getVersion())).addMapping(ElasticGroupIndex.GROUPS, gson.toJson(groupMapping)).execute().actionGet();
}
Also used : AccountGroup(com.google.gerrit.reviewdb.client.AccountGroup) AccountState(com.google.gerrit.server.account.AccountState) AccountMapping(com.google.gerrit.elasticsearch.ElasticAccountIndex.AccountMapping) GroupMapping(com.google.gerrit.elasticsearch.ElasticGroupIndex.GroupMapping) ChangeData(com.google.gerrit.server.query.change.ChangeData) ChangeMapping(com.google.gerrit.elasticsearch.ElasticChangeIndex.ChangeMapping)

Aggregations

AccountMapping (com.google.gerrit.elasticsearch.ElasticAccountIndex.AccountMapping)1 ChangeMapping (com.google.gerrit.elasticsearch.ElasticChangeIndex.ChangeMapping)1 GroupMapping (com.google.gerrit.elasticsearch.ElasticGroupIndex.GroupMapping)1 AccountGroup (com.google.gerrit.reviewdb.client.AccountGroup)1 AccountState (com.google.gerrit.server.account.AccountState)1 ChangeData (com.google.gerrit.server.query.change.ChangeData)1