-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'es/master' into ccr
* es/master: (24 commits) Add missing_bucket option in the composite agg (#29465) Rename index_prefix to index_prefixes (#30932) Rename methods in PersistentTasksService (#30837) [DOCS] Fix watcher file location Update the version checks around range bucket keys, now that the change was backported. Use dedicated ML APIs in tests (#30941) [DOCS] Remove reference to platinum Docker image (#30916) Minor clean-up in InternalRange. (#30886) stable filemode for zip distributions (#30854) [DOCS] Adds missing TLS settings for auditing (#30822) [test] packaging: use shell when running commands (#30852) Fix location of AbstractHttpServerTransport (#30888) [test] packaging test logging for suse distros Moved keyword tokenizer to analysis-common module (#30642) Upgrade to Lucene-7.4-snapshot-1cbadda4d3 (#30928) Limit the scope of BouncyCastle dependency (#30358) [DOCS] Reset edit links (#30909) Fix IndexTemplateMetaData parsing from xContent (#30917) Remove log traces in AzureStorageServiceImpl and fix test (#30924) Deprecate accepting malformed requests in stored script API (#28939) ...
- Loading branch information
Showing
409 changed files
with
7,656 additions
and
2,631 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
client/rest-high-level/src/main/java/org/elasticsearch/client/TasksClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* 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; | ||
|
||
import org.apache.http.Header; | ||
import org.elasticsearch.action.ActionListener; | ||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest; | ||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse; | ||
|
||
import java.io.IOException; | ||
|
||
import static java.util.Collections.emptySet; | ||
|
||
/** | ||
* A wrapper for the {@link RestHighLevelClient} that provides methods for accessing the Tasks API. | ||
* <p> | ||
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html">Task Management API on elastic.co</a> | ||
*/ | ||
public class TasksClient { | ||
private final RestHighLevelClient restHighLevelClient; | ||
|
||
TasksClient(RestHighLevelClient restHighLevelClient) { | ||
this.restHighLevelClient = restHighLevelClient; | ||
} | ||
|
||
/** | ||
* Get current tasks using the Task Management API | ||
* <p> | ||
* See | ||
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html"> Task Management API on elastic.co</a> | ||
*/ | ||
public ListTasksResponse list(ListTasksRequest request, Header... headers) throws IOException { | ||
return restHighLevelClient.performRequestAndParseEntity(request, RequestConverters::listTasks, ListTasksResponse::fromXContent, | ||
emptySet(), headers); | ||
} | ||
|
||
/** | ||
* Asynchronously get current tasks using the Task Management API | ||
* <p> | ||
* See | ||
* <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html"> Task Management API on elastic.co</a> | ||
*/ | ||
public void listAsync(ListTasksRequest request, ActionListener<ListTasksResponse> listener, Header... headers) { | ||
restHighLevelClient.performRequestAsyncAndParseEntity(request, RequestConverters::listTasks, ListTasksResponse::fromXContent, | ||
listener, emptySet(), headers); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
client/rest-high-level/src/test/java/org/elasticsearch/client/TasksIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* 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; | ||
|
||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest; | ||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse; | ||
import org.elasticsearch.action.admin.cluster.node.tasks.list.TaskGroup; | ||
import org.elasticsearch.tasks.TaskInfo; | ||
|
||
import java.io.IOException; | ||
|
||
import static java.util.Collections.emptyList; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.greaterThanOrEqualTo; | ||
import static org.hamcrest.Matchers.notNullValue; | ||
|
||
public class TasksIT extends ESRestHighLevelClientTestCase { | ||
|
||
public void testListTasks() throws IOException { | ||
ListTasksRequest request = new ListTasksRequest(); | ||
ListTasksResponse response = execute(request, highLevelClient().tasks()::list, highLevelClient().tasks()::listAsync); | ||
|
||
assertThat(response, notNullValue()); | ||
assertThat(response.getNodeFailures(), equalTo(emptyList())); | ||
assertThat(response.getTaskFailures(), equalTo(emptyList())); | ||
// It's possible that there are other tasks except 'cluster:monitor/tasks/lists[n]' and 'action":"cluster:monitor/tasks/lists' | ||
assertThat(response.getTasks().size(), greaterThanOrEqualTo(2)); | ||
boolean listTasksFound = false; | ||
for (TaskGroup taskGroup : response.getTaskGroups()) { | ||
TaskInfo parent = taskGroup.getTaskInfo(); | ||
if ("cluster:monitor/tasks/lists".equals(parent.getAction())) { | ||
assertThat(taskGroup.getChildTasks().size(), equalTo(1)); | ||
TaskGroup childGroup = taskGroup.getChildTasks().iterator().next(); | ||
assertThat(childGroup.getChildTasks().isEmpty(), equalTo(true)); | ||
TaskInfo child = childGroup.getTaskInfo(); | ||
assertThat(child.getAction(), equalTo("cluster:monitor/tasks/lists[n]")); | ||
assertThat(child.getParentTaskId(), equalTo(parent.getTaskId())); | ||
listTasksFound = true; | ||
} | ||
} | ||
assertTrue("List tasks were not found", listTasksFound); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.