Skip to content

Commit 6bca143

Browse files
Merge branch 'master' into reload-secure-store-action
2 parents 952ec3a + f94a757 commit 6bca143

File tree

1,015 files changed

+14817
-8406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,015 files changed

+14817
-8406
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,14 @@ Before submitting your changes, run the test suite to make sure that nothing is
209209
./gradlew check
210210
```
211211

212+
If your changes affect only the documentation, run:
213+
214+
```sh
215+
./gradlew -p docs check
216+
```
217+
For more information about testing code examples in the documentation, see
218+
https://github.com/elastic/elasticsearch/blob/master/docs/README.asciidoc
219+
212220
### Project layout
213221

214222
This repository is split into many top level directories. The most important

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
elasticsearch = 7.0.0-alpha1
2-
lucene = 7.4.0-snapshot-cc2ee23050
2+
lucene = 7.4.0-snapshot-0a7c3f462f
33

44
# optional dependencies
55
spatial4j = 0.7

client/benchmark/src/main/java/org/elasticsearch/client/benchmark/transport/TransportClientBenchmark.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private static final class TransportBulkRequestExecutor implements BulkRequestEx
7979

8080
@Override
8181
public boolean bulkIndex(List<String> bulkData) {
82-
NoopBulkRequestBuilder builder = NoopBulkAction.INSTANCE.newRequestBuilder(client);
82+
NoopBulkRequestBuilder builder = new NoopBulkRequestBuilder(client,NoopBulkAction.INSTANCE);
8383
for (String bulkItem : bulkData) {
8484
builder.add(new IndexRequest(indexName, typeName).source(bulkItem.getBytes(StandardCharsets.UTF_8), XContentType.JSON));
8585
}
@@ -108,7 +108,7 @@ private TransportSearchRequestExecutor(TransportClient client, String indexName)
108108
@Override
109109
public boolean search(String source) {
110110
final SearchResponse response;
111-
NoopSearchRequestBuilder builder = NoopSearchAction.INSTANCE.newRequestBuilder(client);
111+
NoopSearchRequestBuilder builder = new NoopSearchRequestBuilder(client, NoopSearchAction.INSTANCE);
112112
try {
113113
builder.setIndices(indexName);
114114
builder.setQuery(QueryBuilders.wrapperQuery(source));

client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/NoopBulkAction.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
import org.elasticsearch.action.Action;
2222
import org.elasticsearch.action.bulk.BulkRequest;
2323
import org.elasticsearch.action.bulk.BulkResponse;
24-
import org.elasticsearch.client.ElasticsearchClient;
2524

26-
public class NoopBulkAction extends Action<BulkRequest, BulkResponse, NoopBulkRequestBuilder> {
25+
public class NoopBulkAction extends Action<BulkRequest, BulkResponse> {
2726
public static final String NAME = "mock:data/write/bulk";
2827

2928
public static final NoopBulkAction INSTANCE = new NoopBulkAction();
@@ -32,11 +31,6 @@ private NoopBulkAction() {
3231
super(NAME);
3332
}
3433

35-
@Override
36-
public NoopBulkRequestBuilder newRequestBuilder(ElasticsearchClient client) {
37-
return new NoopBulkRequestBuilder(client, this);
38-
}
39-
4034
@Override
4135
public BulkResponse newResponse() {
4236
return new BulkResponse(null, 0);

client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/bulk/NoopBulkRequestBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import org.elasticsearch.common.unit.TimeValue;
3636
import org.elasticsearch.common.xcontent.XContentType;
3737

38-
public class NoopBulkRequestBuilder extends ActionRequestBuilder<BulkRequest, BulkResponse, NoopBulkRequestBuilder>
38+
public class NoopBulkRequestBuilder extends ActionRequestBuilder<BulkRequest, BulkResponse>
3939
implements WriteRequestBuilder<NoopBulkRequestBuilder> {
4040

4141
public NoopBulkRequestBuilder(ElasticsearchClient client, NoopBulkAction action) {

client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/NoopSearchAction.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,15 @@
2121
import org.elasticsearch.action.Action;
2222
import org.elasticsearch.action.search.SearchRequest;
2323
import org.elasticsearch.action.search.SearchResponse;
24-
import org.elasticsearch.client.ElasticsearchClient;
2524

26-
public class NoopSearchAction extends Action<SearchRequest, SearchResponse, NoopSearchRequestBuilder> {
25+
public class NoopSearchAction extends Action<SearchRequest, SearchResponse> {
2726
public static final NoopSearchAction INSTANCE = new NoopSearchAction();
2827
public static final String NAME = "mock:data/read/search";
2928

3029
public NoopSearchAction() {
3130
super(NAME);
3231
}
3332

34-
@Override
35-
public NoopSearchRequestBuilder newRequestBuilder(ElasticsearchClient client) {
36-
return new NoopSearchRequestBuilder(client, this);
37-
}
38-
3933
@Override
4034
public SearchResponse newResponse() {
4135
return new SearchResponse();

client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/NoopSearchRequestBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import java.util.Arrays;
4343
import java.util.List;
4444

45-
public class NoopSearchRequestBuilder extends ActionRequestBuilder<SearchRequest, SearchResponse, NoopSearchRequestBuilder> {
45+
public class NoopSearchRequestBuilder extends ActionRequestBuilder<SearchRequest, SearchResponse> {
4646

4747
public NoopSearchRequestBuilder(ElasticsearchClient client, NoopSearchAction action) {
4848
super(client, action, new SearchRequest());

client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterClient.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
import org.elasticsearch.action.ActionListener;
2424
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
2525
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
26-
import org.elasticsearch.action.ingest.PutPipelineRequest;
27-
import org.elasticsearch.action.ingest.PutPipelineResponse;
2826

2927
import java.io.IOException;
3028

@@ -65,26 +63,4 @@ public void putSettingsAsync(ClusterUpdateSettingsRequest clusterUpdateSettingsR
6563
restHighLevelClient.performRequestAsyncAndParseEntity(clusterUpdateSettingsRequest, RequestConverters::clusterPutSettings,
6664
ClusterUpdateSettingsResponse::fromXContent, listener, emptySet(), headers);
6765
}
68-
69-
/**
70-
* Add a pipeline or update an existing pipeline in the cluster
71-
* <p>
72-
* See
73-
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/put-pipeline-api.html"> Put Pipeline API on elastic.co</a>
74-
*/
75-
public PutPipelineResponse putPipeline(PutPipelineRequest request, Header... headers) throws IOException {
76-
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::putPipeline,
77-
PutPipelineResponse::fromXContent, emptySet(), headers);
78-
}
79-
80-
/**
81-
* Asynchronously add a pipeline or update an existing pipeline in the cluster
82-
* <p>
83-
* See
84-
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/put-pipeline-api.html"> Put Pipeline API on elastic.co</a>
85-
*/
86-
public void putPipelineAsync(PutPipelineRequest request, ActionListener<PutPipelineResponse> listener, Header... headers) {
87-
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::putPipeline,
88-
PutPipelineResponse::fromXContent, listener, emptySet(), headers);
89-
}
9066
}

client/rest-high-level/src/main/java/org/elasticsearch/client/IndicesClient.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
3535
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
3636
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
37+
import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest;
3738
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
3839
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse;
3940
import org.elasticsearch.action.admin.indices.get.GetIndexRequest;
@@ -269,6 +270,28 @@ public void flushAsync(FlushRequest flushRequest, ActionListener<FlushResponse>
269270
listener, emptySet(), headers);
270271
}
271272

273+
/** Initiate a synced flush manually using the synced flush API
274+
* <p>
275+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-synced-flush.html">
276+
* Synced flush API on elastic.co</a>
277+
*/
278+
public SyncedFlushResponse flushSynced(SyncedFlushRequest syncedFlushRequest, Header... headers) throws IOException {
279+
return restHighLevelClient.performRequestAndParseEntity(syncedFlushRequest, RequestConverters::flushSynced,
280+
SyncedFlushResponse::fromXContent, emptySet(), headers);
281+
}
282+
283+
/**
284+
* Asynchronously initiate a synced flush manually using the synced flush API
285+
* <p>
286+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-synced-flush.html">
287+
* Synced flush API on elastic.co</a>
288+
*/
289+
public void flushSyncedAsync(SyncedFlushRequest syncedFlushRequest, ActionListener<SyncedFlushResponse> listener, Header... headers) {
290+
restHighLevelClient.performRequestAsyncAndParseEntity(syncedFlushRequest, RequestConverters::flushSynced,
291+
SyncedFlushResponse::fromXContent, listener, emptySet(), headers);
292+
}
293+
294+
272295
/**
273296
* Retrieve the settings of one or more indices
274297
* <p>
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* Licensed to Elasticsearch under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.elasticsearch.client;
21+
22+
import org.apache.http.Header;
23+
import org.elasticsearch.action.ActionListener;
24+
import org.elasticsearch.action.ingest.DeletePipelineRequest;
25+
import org.elasticsearch.action.ingest.GetPipelineRequest;
26+
import org.elasticsearch.action.ingest.GetPipelineResponse;
27+
import org.elasticsearch.action.ingest.PutPipelineRequest;
28+
import org.elasticsearch.action.ingest.WritePipelineResponse;
29+
30+
import java.io.IOException;
31+
32+
import static java.util.Collections.emptySet;
33+
34+
/**
35+
* A wrapper for the {@link RestHighLevelClient} that provides methods for accessing the Ingest API.
36+
* <p>
37+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html">Ingest API on elastic.co</a>
38+
*/
39+
public final class IngestClient {
40+
41+
private final RestHighLevelClient restHighLevelClient;
42+
43+
IngestClient(RestHighLevelClient restHighLevelClient) {
44+
this.restHighLevelClient = restHighLevelClient;
45+
}
46+
47+
/**
48+
* Add a pipeline or update an existing pipeline
49+
* <p>
50+
* See
51+
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/put-pipeline-api.html"> Put Pipeline API on elastic.co</a>
52+
*/
53+
public WritePipelineResponse putPipeline(PutPipelineRequest request, Header... headers) throws IOException {
54+
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::putPipeline,
55+
WritePipelineResponse::fromXContent, emptySet(), headers);
56+
}
57+
58+
/**
59+
* Asynchronously add a pipeline or update an existing pipeline
60+
* <p>
61+
* See
62+
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/put-pipeline-api.html"> Put Pipeline API on elastic.co</a>
63+
*/
64+
public void putPipelineAsync(PutPipelineRequest request, ActionListener<WritePipelineResponse> listener, Header... headers) {
65+
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::putPipeline,
66+
WritePipelineResponse::fromXContent, listener, emptySet(), headers);
67+
}
68+
69+
/**
70+
* Get an existing pipeline
71+
* <p>
72+
* See
73+
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/get-pipeline-api.html"> Get Pipeline API on elastic.co</a>
74+
*/
75+
public GetPipelineResponse getPipeline(GetPipelineRequest request, Header... headers) throws IOException {
76+
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::getPipeline,
77+
GetPipelineResponse::fromXContent, emptySet(), headers);
78+
}
79+
80+
/**
81+
* Asynchronously get an existing pipeline
82+
* <p>
83+
* See
84+
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/get-pipeline-api.html"> Get Pipeline API on elastic.co</a>
85+
*/
86+
public void getPipelineAsync(GetPipelineRequest request, ActionListener<GetPipelineResponse> listener, Header... headers) {
87+
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::getPipeline,
88+
GetPipelineResponse::fromXContent, listener, emptySet(), headers);
89+
}
90+
91+
/**
92+
* Delete an existing pipeline
93+
* <p>
94+
* See
95+
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-pipeline-api.html">
96+
* Delete Pipeline API on elastic.co</a>
97+
*/
98+
public WritePipelineResponse deletePipeline(DeletePipelineRequest request, Header... headers) throws IOException {
99+
return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::deletePipeline,
100+
WritePipelineResponse::fromXContent, emptySet(), headers);
101+
}
102+
103+
/**
104+
* Asynchronously delete an existing pipeline
105+
* <p>
106+
* See
107+
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-pipeline-api.html">
108+
* Delete Pipeline API on elastic.co</a>
109+
*/
110+
public void deletePipelineAsync(DeletePipelineRequest request, ActionListener<WritePipelineResponse> listener, Header... headers) {
111+
restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::deletePipeline,
112+
WritePipelineResponse::fromXContent, listener, emptySet(), headers);
113+
}
114+
}

0 commit comments

Comments
 (0)