Skip to content

Commit 799eaa7

Browse files
committed
Merge branch 'master' into feature/searchable-snapshots
2 parents d6220c5 + 075fee2 commit 799eaa7

File tree

298 files changed

+6045
-1934
lines changed

Some content is hidden

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

298 files changed

+6045
-1934
lines changed

benchmarks/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ dependencies {
4141
runtime 'org.apache.commons:commons-math3:3.2'
4242
}
4343

44-
compileJava.options.compilerArgs << "-Xlint:-cast,-rawtypes,-unchecked,-processing"
4544
// enable the JMH's BenchmarkProcessor to generate the final benchmark classes
4645
// needs to be added separately otherwise Gradle will quote it and javac will fail
4746
compileJava.options.compilerArgs.addAll(["-processor", "org.openjdk.jmh.generators.BenchmarkProcessor"])

buildSrc/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
elasticsearch = 8.0.0
2-
lucene = 8.5.0-snapshot-d62f6307658
2+
lucene = 8.5.0-snapshot-b01d7cb
33

44
bundled_jdk_vendor = adoptopenjdk
55
bundled_jdk = 13.0.2+8

client/client-benchmark-noop-api-plugin/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ assemble.enabled = false
3333
dependencyLicenses.enabled = false
3434
dependenciesInfo.enabled = false
3535

36-
compileJava.options.compilerArgs << "-Xlint:-cast,-rawtypes,-unchecked"
37-
3836
// no unit tests
3937
test.enabled = false
4038
integTest.enabled = false

client/rest-high-level/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.elasticsearch.gradle.test.RestIntegTestTask
2+
import org.elasticsearch.gradle.info.BuildParams
23

34
/*
45
* Licensed to Elasticsearch under one or more contributor
@@ -70,6 +71,7 @@ dependencies {
7071
testCompile(project(':x-pack:plugin:core')) {
7172
exclude group: 'org.elasticsearch', module: 'elasticsearch-rest-high-level-client'
7273
}
74+
testCompile(project(':x-pack:plugin:eql'))
7375

7476
restSpec project(':rest-api-spec')
7577
}
@@ -128,6 +130,10 @@ testClusters.all {
128130
setting 'xpack.security.authc.api_key.enabled', 'true'
129131
setting 'xpack.security.http.ssl.enabled', 'false'
130132
setting 'xpack.security.transport.ssl.enabled', 'false'
133+
if (BuildParams.isSnapshotBuild() == false) {
134+
systemProperty 'es.eql_feature_flag_registered', 'true'
135+
}
136+
setting 'xpack.eql.enabled', 'true'
131137
// Truststore settings are not used since TLS is not enabled. Included for testing the get certificates API
132138
setting 'xpack.security.http.ssl.certificate_authorities', 'testnode.crt'
133139
setting 'xpack.security.transport.ssl.truststore.path', 'testnode.jks'
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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.elasticsearch.action.ActionListener;
23+
import org.elasticsearch.client.eql.EqlSearchRequest;
24+
import org.elasticsearch.client.eql.EqlSearchResponse;
25+
26+
import java.io.IOException;
27+
import java.util.Collections;
28+
29+
/**
30+
* A wrapper for the {@link RestHighLevelClient} that provides methods for
31+
* accessing the Elastic EQL related functions
32+
* <p>
33+
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/eql.html">
34+
* EQL APIs on elastic.co</a> for more information.
35+
*/
36+
public final class EqlClient {
37+
38+
private final RestHighLevelClient restHighLevelClient;
39+
40+
EqlClient(RestHighLevelClient restHighLevelClient) {
41+
this.restHighLevelClient = restHighLevelClient;
42+
}
43+
44+
/**
45+
* Executes the eql search query.
46+
* <p>
47+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search.html">
48+
* the docs</a> for more.
49+
*
50+
* @param request the request
51+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
52+
* @return the response
53+
* @throws IOException in case there is a problem sending the request or parsing back the response
54+
*/
55+
public EqlSearchResponse search(EqlSearchRequest request, RequestOptions options) throws IOException {
56+
return restHighLevelClient.performRequestAndParseEntity(
57+
request,
58+
EqlRequestConverters::search,
59+
options,
60+
EqlSearchResponse::fromXContent,
61+
Collections.emptySet()
62+
);
63+
}
64+
65+
/**
66+
* Asynchronously executes the eql search query.
67+
* <p>
68+
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/eql-search.html">
69+
* the docs</a> for more.
70+
*
71+
* @param request the request
72+
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
73+
* @param listener the listener to be notified upon request completion
74+
* @return cancellable that may be used to cancel the request
75+
*/
76+
public Cancellable searchAsync(EqlSearchRequest request,
77+
RequestOptions options,
78+
ActionListener<EqlSearchResponse> listener) {
79+
return restHighLevelClient.performRequestAsyncAndParseEntity(
80+
request,
81+
EqlRequestConverters::search,
82+
options,
83+
EqlSearchResponse::fromXContent,
84+
listener,
85+
Collections.emptySet()
86+
);
87+
}
88+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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.client.methods.HttpGet;
23+
import org.elasticsearch.client.eql.EqlSearchRequest;
24+
25+
import java.io.IOException;
26+
27+
import static org.elasticsearch.client.RequestConverters.REQUEST_BODY_CONTENT_TYPE;
28+
import static org.elasticsearch.client.RequestConverters.createEntity;
29+
30+
final class EqlRequestConverters {
31+
32+
static Request search(EqlSearchRequest eqlSearchRequest) throws IOException {
33+
String endpoint = new RequestConverters.EndpointBuilder()
34+
.addCommaSeparatedPathParts(eqlSearchRequest.indices())
35+
.addPathPartAsIs("_eql", "search")
36+
.build();
37+
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
38+
RequestConverters.Params parameters = new RequestConverters.Params();
39+
parameters.withIndicesOptions(eqlSearchRequest.indicesOptions());
40+
request.setEntity(createEntity(eqlSearchRequest, REQUEST_BODY_CONTENT_TYPE));
41+
request.addParameters(parameters.asMap());
42+
return request;
43+
}
44+
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,6 @@ static Request termVectors(TermVectorsRequest tvrequest) throws IOException {
698698
Params params = new Params();
699699
params.withRouting(tvrequest.getRouting());
700700
params.withPreference(tvrequest.getPreference());
701-
params.withFields(tvrequest.getFields());
702701
params.withRealtime(tvrequest.getRealtime());
703702
request.addParameters(params.asMap());
704703
request.setEntity(createEntity(tvrequest, REQUEST_BODY_CONTENT_TYPE));

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ public class RestHighLevelClient implements Closeable {
264264
private final CcrClient ccrClient = new CcrClient(this);
265265
private final TransformClient transformClient = new TransformClient(this);
266266
private final EnrichClient enrichClient = new EnrichClient(this);
267+
private final EqlClient eqlClient = new EqlClient(this);
267268

268269
/**
269270
* Creates a {@link RestHighLevelClient} given the low level {@link RestClientBuilder} that allows to build the
@@ -492,6 +493,20 @@ public EnrichClient enrich() {
492493
return enrichClient;
493494
}
494495

496+
/**
497+
* Provides methods for accessing the Elastic EQL APIs that
498+
* are shipped with the Elastic Stack distribution of Elasticsearch. All of
499+
* these APIs will 404 if run against the OSS distribution of Elasticsearch.
500+
* <p>
501+
* See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/eql.html">
502+
* EQL APIs on elastic.co</a> for more information.
503+
*
504+
* @return the client wrapper for making Data Frame API calls
505+
*/
506+
public final EqlClient eql() {
507+
return eqlClient;
508+
}
509+
495510
/**
496511
* Executes a bulk request using the Bulk API.
497512
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html">Bulk API on elastic.co</a>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
258258
builder.field("_type", type);
259259
}
260260
if (id != null) builder.field("_id", id);
261+
if (fields != null) builder.field("fields", fields);
261262
// set values only when different from defaults
262263
if (requestPositions == false) builder.field("positions", false);
263264
if (requestPayloads == false) builder.field("payloads", false);

0 commit comments

Comments
 (0)