
Remove jest API which depends on Elasticsearch native API (also removed), so no longer depend on lucene for this scope. Replace such removed dependencies with the Elasticsearch low-level API, which does not depend on Lucene. That now used API is a REST client with minimal dependencies, indeed. -As opposed to Elastic's current high-level API, which still depends on lucene and other Gerrit-constraining libraries. Do so in order to decouple the elasticsearch client from lucene in Gerrit. That REST client does not logically require Lucene anyway. Most importantly, such decoupling now enables upcoming support for more than just one Elasticsearch server version. This includes the new possibility of bumping the latter to multiple yet later versions, such as 5 and 6.x. The currently used version (2.4) should also still be kept, for a while. Bumping such versions will likely require some Elasticsearch client code adaptations, so that Gerrit can (dynamically?) switch between either Elasticsearch server version to eventually support (hopefully soon). Doing the same for the elasticsearch tests in Gerrit is to be done using another change or more changes. Add a partial and customized fork of [1], based on [1]'s commit [2], to preserve the ability of building proper json requests for Elasticsearch. Put that forked json-generating code under a new 'builders' sub-package. There should be a possibility in some near future to consider removing that fork, based on potential progress such as the one proposed in [3]. Meanwhile, this fork shall be maintained to usual Gerrit quality levels. [1] https://github.com/elastic/elasticsearch [2] tag: v2.4.4 [3] https://github.com/elastic/elasticsearch/issues/30791 Bug: Issue 6094 Change-Id: I720c9885c9eab2388acc328eecb9eaa6940ced0c
31 lines
1.1 KiB
Java
31 lines
1.1 KiB
Java
// Copyright (C) 2018 The Android Open Source Project, 2009-2015 Elasticsearch
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package com.google.gerrit.elasticsearch.builders;
|
|
|
|
import java.io.IOException;
|
|
|
|
/**
|
|
* A query that matches on all documents. A trimmed down version of {@link
|
|
* org.elasticsearch.index.query.MatchAllQueryBuilder} for this very package.
|
|
*/
|
|
class MatchAllQueryBuilder extends QueryBuilder {
|
|
|
|
@Override
|
|
protected void doXContent(XContentBuilder builder) throws IOException {
|
|
builder.startObject("match_all");
|
|
builder.endObject();
|
|
}
|
|
}
|