Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/elasticsearch into fix/50…
Browse files Browse the repository at this point in the history
…152-painless-limit-per-context__06__remove
  • Loading branch information
stu-elastic committed Jun 17, 2020
2 parents 64f9350 + de05b57 commit fa64c2d
Show file tree
Hide file tree
Showing 132 changed files with 1,908 additions and 567 deletions.
2 changes: 1 addition & 1 deletion benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ run.executable = "${BuildParams.runtimeJavaHome}/bin/java"
disableTasks('forbiddenApisMain')

// No licenses for our benchmark deps (we don't ship benchmarks)
dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false

thirdPartyAudit.ignoreViolations(
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ dependencies {
compile 'com.netflix.nebula:nebula-publishing-plugin:4.4.4'
compile 'com.netflix.nebula:gradle-info-plugin:7.1.3'
compile 'org.apache.rat:apache-rat:0.11'
compile "org.elasticsearch:jna:4.5.1"
compile "org.elasticsearch:jna:5.5.0"
compile 'com.github.jengelman.gradle.plugins:shadow:5.1.0'
compile 'de.thetaphi:forbiddenapis:3.0'
compile 'com.avast.gradle:gradle-docker-compose-plugin:0.8.12'
Expand Down Expand Up @@ -168,7 +168,7 @@ if (project != rootProject) {
groovydoc.enabled = false

// build-tools is not ready for primetime with these...
dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false
disableTasks('forbiddenApisMain', 'forbiddenApisMinimumRuntime',
'forbiddenApisTest', 'forbiddenApisIntegTest', 'forbiddenApisTestFixtures')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;

import org.gradle.api.DefaultTask;
import org.gradle.api.file.FileTree;
Expand All @@ -50,6 +52,8 @@ public ConcatFilesTask() {

private File target;

private List<String> additionalLines = new ArrayList<>();

public void setFiles(FileTree files) {
this.files = files;
}
Expand Down Expand Up @@ -78,6 +82,15 @@ public File getTarget() {
return target;
}

@Input
public List<String> getAdditionalLines() {
return additionalLines;
}

public void setAdditionalLines(List<String> additionalLines) {
this.additionalLines = additionalLines;
}

@TaskAction
public void concatFiles() throws IOException {
if (getHeaderLine() != null) {
Expand All @@ -90,6 +103,10 @@ public void concatFiles() throws IOException {
uniqueLines.addAll(Files.readAllLines(f.toPath(), StandardCharsets.UTF_8));
}
Files.write(getTarget().toPath(), uniqueLines, StandardCharsets.UTF_8, StandardOpenOption.APPEND);

for (String additionalLine : additionalLines) {
Files.write(getTarget().toPath(), (additionalLine + '\n').getBytes(StandardCharsets.UTF_8), StandardOpenOption.APPEND);
}
}

}
2 changes: 1 addition & 1 deletion buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ slf4j = 1.6.2
ecsLogging = 0.1.3

# when updating the JNA version, also update the version in buildSrc/build.gradle
jna = 4.5.1
jna = 5.5.0

netty = 4.1.49.Final
joda = 2.10.4
Expand Down
2 changes: 1 addition & 1 deletion client/benchmark/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ dependencies {
}

// No licenses for our benchmark deps (we don't ship benchmarks)
dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false
2 changes: 1 addition & 1 deletion client/client-benchmark-noop-api-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ esplugin {
// Not published so no need to assemble
assemble.enabled = false

dependencyLicenses.enabled = false
tasks.named("dependencyLicenses").configure { it.enabled = false }
dependenciesInfo.enabled = false

// no unit tests
Expand Down
8 changes: 0 additions & 8 deletions client/rest-high-level/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ processTestResources {
from(project(':client:rest-high-level').file('src/test/resources'))
}

dependencyLicenses {
// Don't check licenses for dependency that are part of the elasticsearch project
// But any other dependency should have its license/notice/sha1
dependencies = project.configurations.runtime.fileCollection {
it.group.startsWith('org.elasticsearch') == false
}
}

tasks.named('forbiddenApisMain').configure {
// core does not depend on the httpclient for compile so we add the signatures here. We don't add them for test as they are already
// specified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,29 @@
import org.elasticsearch.client.indices.AnalyzeResponse;
import org.elasticsearch.client.indices.CloseIndexRequest;
import org.elasticsearch.client.indices.CloseIndexResponse;
import org.elasticsearch.client.indices.ComposableIndexTemplateExistRequest;
import org.elasticsearch.client.indices.CreateDataStreamRequest;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.CreateIndexResponse;
import org.elasticsearch.client.indices.DeleteAliasRequest;
import org.elasticsearch.client.indices.DeleteComposableIndexTemplateRequest;
import org.elasticsearch.client.indices.DeleteDataStreamRequest;
import org.elasticsearch.client.indices.FreezeIndexRequest;
import org.elasticsearch.client.indices.GetComposableIndexTemplateRequest;
import org.elasticsearch.client.indices.GetComposableIndexTemplatesResponse;
import org.elasticsearch.client.indices.GetDataStreamRequest;
import org.elasticsearch.client.indices.GetDataStreamResponse;
import org.elasticsearch.client.indices.GetFieldMappingsRequest;
import org.elasticsearch.client.indices.GetFieldMappingsResponse;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.client.indices.GetIndexResponse;
import org.elasticsearch.client.indices.GetComposableIndexTemplateRequest;
import org.elasticsearch.client.indices.GetIndexTemplatesRequest;
import org.elasticsearch.client.indices.GetIndexTemplatesResponse;
import org.elasticsearch.client.indices.GetComposableIndexTemplatesResponse;
import org.elasticsearch.client.indices.GetMappingsRequest;
import org.elasticsearch.client.indices.GetMappingsResponse;
import org.elasticsearch.client.indices.ComposableIndexTemplateExistRequest;
import org.elasticsearch.client.indices.IndexTemplatesExistRequest;
import org.elasticsearch.client.indices.PutIndexTemplateRequest;
import org.elasticsearch.client.indices.PutComposableIndexTemplateRequest;
import org.elasticsearch.client.indices.PutIndexTemplateRequest;
import org.elasticsearch.client.indices.PutMappingRequest;
import org.elasticsearch.client.indices.ReloadAnalyzersRequest;
import org.elasticsearch.client.indices.ReloadAnalyzersResponse;
Expand Down Expand Up @@ -155,6 +159,106 @@ public Cancellable createAsync(CreateIndexRequest createIndexRequest,
CreateIndexResponse::fromXContent, listener, emptySet());
}

/**
* Creates a data stream using the Create Data Stream API.
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-data-streams.html">
* Data Streams API on elastic.co</a>
*
* @param createDataStreamRequest the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be
* customized
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public AcknowledgedResponse createDataStream(CreateDataStreamRequest createDataStreamRequest,
RequestOptions options) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(createDataStreamRequest, IndicesRequestConverters::putDataStream, options,
AcknowledgedResponse::fromXContent, emptySet());
}

/**
* Asynchronously creates a data stream using the Create Data Stream API.
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-data-streams.html">
* Data Streams API on elastic.co</a>
*
* @param createDataStreamRequest the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be
* customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public Cancellable createDataStreamAsync(CreateDataStreamRequest createDataStreamRequest,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(createDataStreamRequest, IndicesRequestConverters::putDataStream,
options, AcknowledgedResponse::fromXContent, listener, emptySet());
}

/**
* Deletes a data stream using the Delete Data Stream API.
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-data-streams.html">
* Data Streams API on elastic.co</a>
*
* @param deleteDataStreamRequest the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be
* customized
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public AcknowledgedResponse deleteDataStream(DeleteDataStreamRequest deleteDataStreamRequest,
RequestOptions options) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(deleteDataStreamRequest, IndicesRequestConverters::deleteDataStream,
options, AcknowledgedResponse::fromXContent, emptySet());
}

/**
* Asynchronously deletes a data stream using the Delete Data Stream API.
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-data-streams.html">
* Data Streams API on elastic.co</a>
*
* @param deleteDataStreamRequest the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be
* customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public Cancellable deleteDataStreamAsync(DeleteDataStreamRequest deleteDataStreamRequest, RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(deleteDataStreamRequest, IndicesRequestConverters::deleteDataStream,
options, AcknowledgedResponse::fromXContent, listener, emptySet());
}

/**
* Gets one or more data streams using the Get Data Stream API.
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html"> Data Streams API on
* elastic.co</a>
*
* @param dataStreamRequest the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public GetDataStreamResponse getDataStream(GetDataStreamRequest dataStreamRequest, RequestOptions options) throws IOException {
return restHighLevelClient.performRequestAndParseEntity(dataStreamRequest, IndicesRequestConverters::getDataStreams, options,
GetDataStreamResponse::fromXContent, emptySet());
}

/**
* Asynchronously gets one or more data streams using the Get Data Stream API.
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html"> Data Streams API on
* elastic.co</a>
*
* @param dataStreamRequest the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public Cancellable getDataStreamAsync(GetDataStreamRequest dataStreamRequest, RequestOptions options,
ActionListener<GetDataStreamResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(dataStreamRequest, IndicesRequestConverters::getDataStreams, options,
GetDataStreamResponse::fromXContent, listener, emptySet());
}

/**
* Updates the mappings on an index using the Put Mapping API.
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest;
import org.elasticsearch.client.indices.AnalyzeRequest;
import org.elasticsearch.client.indices.CloseIndexRequest;
import org.elasticsearch.client.indices.CreateDataStreamRequest;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.GetDataStreamRequest;
import org.elasticsearch.client.indices.DeleteAliasRequest;
import org.elasticsearch.client.indices.DeleteComposableIndexTemplateRequest;
import org.elasticsearch.client.indices.DeleteDataStreamRequest;
import org.elasticsearch.client.indices.FreezeIndexRequest;
import org.elasticsearch.client.indices.GetFieldMappingsRequest;
import org.elasticsearch.client.indices.GetIndexRequest;
Expand All @@ -68,6 +71,28 @@ final class IndicesRequestConverters {

private IndicesRequestConverters() {}

static Request putDataStream(CreateDataStreamRequest createDataStreamRequest) {
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_data_stream")
.addPathPart(createDataStreamRequest.getName()).build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
return request;
}

static Request deleteDataStream(DeleteDataStreamRequest deleteDataStreamRequest) {
String name = deleteDataStreamRequest.getName();
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_data_stream").addPathPart(name).build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
return request;
}

static Request getDataStreams(GetDataStreamRequest dataStreamRequest) {
final String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_data_stream")
.addPathPart(dataStreamRequest.getName())
.build();
return new Request(HttpGet.METHOD_NAME, endpoint);
}

static Request deleteIndex(DeleteIndexRequest deleteIndexRequest) {
String endpoint = RequestConverters.endpoint(deleteIndexRequest.indices());
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you 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 org.elasticsearch.client.indices;

import org.elasticsearch.client.Validatable;

public class CreateDataStreamRequest implements Validatable {

private final String name;

public CreateDataStreamRequest(String name) {
if (name == null) {
throw new IllegalArgumentException("The data stream name cannot be null.");
}
this.name = name;
}

public String getName() {
return name;
}
}
Loading

0 comments on commit fa64c2d

Please sign in to comment.