Skip to content

Commit

Permalink
Merge branch 'main' into fixTileBoundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Oct 17, 2023
2 parents 8ed5587 + 2529264 commit 5f75f49
Show file tree
Hide file tree
Showing 121 changed files with 611 additions and 862 deletions.
10 changes: 5 additions & 5 deletions docs/reference/inference/get-inference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Retrieves {infer} model information.
[[get-inference-api-desc]]
==== {api-description-title}

You can get information in a single API request for:
You can get information in a single API request for:

* a single {infer} model by providing the task type and the model ID,
* all of the {infer} models for a certain task type by providing the task type
* all of the {infer} models for a certain task type by providing the task type
and a wildcard expression,
* all of the {infer} models by using a wildcard expression.

Expand All @@ -50,7 +50,7 @@ The type of {infer} task that the model performs.
[[get-inference-api-example]]
==== {api-examples-title}

The following API call retrives information about the `my-elser-model` {infer}
The following API call retrives information about the `my-elser-model` {infer}
model that can perform `sparse_embedding` tasks.


Expand All @@ -68,12 +68,12 @@ The API returns the following response:
{
"model_id": "my-elser-model",
"task_type": "sparse_embedding",
"service": "elser_mlnode",
"service": "elser",
"service_settings": {
"num_allocations": 1,
"num_threads": 1
},
"task_settings": {}
}
------------------------------------------------------------
// NOTCONSOLE
// NOTCONSOLE
17 changes: 8 additions & 9 deletions docs/reference/inference/put-inference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Creates a model to perform an {infer} task.
[[put-inference-api-desc]]
==== {api-description-title}

The create {infer} API enables you to create and configure an {infer} model to
perform a specific {infer} task.
The create {infer} API enables you to create and configure an {infer} model to
perform a specific {infer} task.


[discrete]
Expand All @@ -50,32 +50,31 @@ The type of the {infer} task that the model will perform. Available task types:
(Required, string)
The type of service supported for the specified task type.
Available services:
* `elser`,
* `elser_mlnode`.
* `elser`

`service_settings`::
(Required, object)
Settings used to install the {infer} model. These settings are specific to the
Settings used to install the {infer} model. These settings are specific to the
`service` you specified.

`task_settings`::
(Optional, object)
Settings to configure the {infer} task. These settings are specific to the
Settings to configure the {infer} task. These settings are specific to the
`<task_type>` you specified.


[discrete]
[[put-inference-api-example]]
==== {api-examples-title}

The following example shows how to create an {infer} model called
The following example shows how to create an {infer} model called
`my-elser-model` to perform a `sparse_embedding` task type.

[source,console]
------------------------------------------------------------
PUT _inference/sparse_embedding/my-elser-model
{
"service": "elser_mlnode",
"service": "elser",
"service_settings": {
"num_allocations": 1,
"num_threads": 1
Expand All @@ -93,7 +92,7 @@ Example response:
{
"model_id": "my-elser-model",
"task_type": "sparse_embedding",
"service": "elser_mlnode",
"service": "elser",
"service_settings": {
"num_allocations": 1,
"num_threads": 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.FailedNodeException;
import org.elasticsearch.action.support.TransportAction;
import org.elasticsearch.action.support.nodes.BaseNodeResponse;
import org.elasticsearch.action.support.nodes.BaseNodesRequest;
import org.elasticsearch.action.support.nodes.BaseNodesResponse;
Expand Down Expand Up @@ -44,10 +45,6 @@ public Request() {
super((String[]) null);
}

public Request(StreamInput in) throws IOException {
super(in);
}

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
Expand All @@ -71,16 +68,19 @@ public boolean equals(Object obj) {
}
return true;
}

@Override
public void writeTo(StreamOutput out) {
TransportAction.localOnly();
}
}

public static class NodeRequest extends TransportRequest {
public NodeRequest(StreamInput in) throws IOException {
super(in);
}

public NodeRequest(Request request) {

}
public NodeRequest() {}
}

public static class Response extends BaseNodesResponse<NodeResponse> implements Writeable, ToXContentObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ public GeoIpDownloaderStatsTransportAction(
) {
super(
GeoIpDownloaderStatsAction.NAME,
threadPool,
clusterService,
transportService,
actionFilters,
Request::new,
NodeRequest::new,
threadPool.executor(ThreadPool.Names.MANAGEMENT)
);
Expand All @@ -66,7 +64,7 @@ protected Response newResponse(Request request, List<NodeResponse> nodeResponses

@Override
protected NodeRequest newNodeRequest(Request request) {
return new NodeRequest(request);
return new NodeRequest();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ setup:

---
"pre_filter_shard_size with shards that have no hit":
- skip:
version: all
reason: "AwaitsFix https://github.com/elastic/elasticsearch/issues/92058"
- do:
index:
index: index_1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ public void testEquivalentDeletesAreDeduplicated() throws Exception {
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/99355")
public void testMasterFailoverOnFinalizationLoop() throws Exception {
internalCluster().startMasterOnlyNodes(3);
final String dataNode = internalCluster().startDataOnlyNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
package org.elasticsearch.action.admin.cluster.node.hotthreads;

import org.elasticsearch.action.ActionType;
import org.elasticsearch.common.io.stream.Writeable;

public class NodesHotThreadsAction extends ActionType<NodesHotThreadsResponse> {

public static final NodesHotThreadsAction INSTANCE = new NodesHotThreadsAction();
public static final String NAME = "cluster:monitor/nodes/hot_threads";

private NodesHotThreadsAction() {
super(NAME, NodesHotThreadsResponse::new);
super(NAME, Writeable.Reader.localOnly());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.elasticsearch.action.admin.cluster.node.hotthreads;

import org.elasticsearch.action.FailedNodeException;
import org.elasticsearch.action.support.TransportAction;
import org.elasticsearch.action.support.nodes.BaseNodesResponse;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.common.collect.Iterators;
Expand All @@ -26,10 +27,6 @@

public class NodesHotThreadsResponse extends BaseNodesResponse<NodeHotThreads> {

public NodesHotThreadsResponse(StreamInput in) throws IOException {
super(in);
}

public NodesHotThreadsResponse(ClusterName clusterName, List<NodeHotThreads> nodes, List<FailedNodeException> failures) {
super(clusterName, nodes, failures);
}
Expand All @@ -52,7 +49,7 @@ protected List<NodeHotThreads> readNodesFrom(StreamInput in) throws IOException

@Override
protected void writeNodesTo(StreamOutput out, List<NodeHotThreads> nodes) throws IOException {
out.writeCollection(nodes);
TransportAction.localOnly();
}

private static class LinesIterator implements Iterator<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ public TransportNodesHotThreadsAction(
) {
super(
NodesHotThreadsAction.NAME,
threadPool,
clusterService,
transportService,
actionFilters,
NodesHotThreadsRequest::new,
NodeRequest::new,
threadPool.executor(ThreadPool.Names.GENERIC)
);
Expand Down Expand Up @@ -87,6 +85,7 @@ protected NodeHotThreads nodeOperation(NodeRequest request, Task task) {

public static class NodeRequest extends TransportRequest {

// TODO don't wrap the whole top-level request, it contains heavy and irrelevant DiscoveryNode things; see #100878
NodesHotThreadsRequest request;

public NodeRequest(StreamInput in) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
package org.elasticsearch.action.admin.cluster.node.info;

import org.elasticsearch.action.ActionType;
import org.elasticsearch.common.io.stream.Writeable;

public class NodesInfoAction extends ActionType<NodesInfoResponse> {

public static final NodesInfoAction INSTANCE = new NodesInfoAction();
public static final String NAME = "cluster:monitor/nodes/info";

private NodesInfoAction() {
super(NAME, NodesInfoResponse::new);
super(NAME, Writeable.Reader.localOnly());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
public class NodesInfoRequest extends BaseNodesRequest<NodesInfoRequest> {

private NodesInfoMetrics nodesInfoMetrics;
private final NodesInfoMetrics nodesInfoMetrics;

/**
* Create a new NodeInfoRequest from a {@link StreamInput} object.
Expand Down Expand Up @@ -118,20 +118,6 @@ public void writeTo(StreamOutput out) throws IOException {
nodesInfoMetrics.writeTo(out);
}

/**
* Helper method for creating NodesInfoRequests with desired metrics
* @param metrics the metrics to include in the request
* @return
*/
public static NodesInfoRequest requestWithMetrics(NodesInfoMetrics.Metric... metrics) {
NodesInfoRequest nodesInfoRequest = new NodesInfoRequest();
nodesInfoRequest.clear();
for (var metric : metrics) {
nodesInfoRequest.addMetric(metric.metricName());
}
return nodesInfoRequest;
}

public NodesInfoMetrics getNodesInfoMetrics() {
return nodesInfoMetrics;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.elasticsearch.action.admin.cluster.node.info;

import org.elasticsearch.action.FailedNodeException;
import org.elasticsearch.action.support.TransportAction;
import org.elasticsearch.action.support.nodes.BaseNodesResponse;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
Expand All @@ -34,22 +35,18 @@

public class NodesInfoResponse extends BaseNodesResponse<NodeInfo> implements ToXContentFragment {

public NodesInfoResponse(StreamInput in) throws IOException {
super(in);
}

public NodesInfoResponse(ClusterName clusterName, List<NodeInfo> nodes, List<FailedNodeException> failures) {
super(clusterName, nodes, failures);
}

@Override
protected List<NodeInfo> readNodesFrom(StreamInput in) throws IOException {
return in.readCollectionAsList(NodeInfo::new);
return TransportAction.localOnly();
}

@Override
protected void writeNodesTo(StreamOutput out, List<NodeInfo> nodes) throws IOException {
out.writeCollection(nodes);
TransportAction.localOnly();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ public TransportNodesInfoAction(
) {
super(
NodesInfoAction.NAME,
threadPool,
clusterService,
transportService,
actionFilters,
NodesInfoRequest::new,
NodeInfoRequest::new,
threadPool.executor(ThreadPool.Names.MANAGEMENT)
);
Expand Down Expand Up @@ -97,7 +95,7 @@ protected NodeInfo nodeOperation(NodeInfoRequest nodeRequest, Task task) {

public static class NodeInfoRequest extends TransportRequest {

private NodesInfoMetrics nodesInfoMetrics;
private final NodesInfoMetrics nodesInfoMetrics;

public NodeInfoRequest(StreamInput in) throws IOException {
super(in);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
package org.elasticsearch.action.admin.cluster.node.reload;

import org.elasticsearch.action.ActionType;
import org.elasticsearch.common.io.stream.Writeable;

public class NodesReloadSecureSettingsAction extends ActionType<NodesReloadSecureSettingsResponse> {

public static final NodesReloadSecureSettingsAction INSTANCE = new NodesReloadSecureSettingsAction();
public static final String NAME = "cluster:admin/nodes/reload_secure_settings";

private NodesReloadSecureSettingsAction() {
super(NAME, NodesReloadSecureSettingsResponse::new);
super(NAME, Writeable.Reader.localOnly());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ public void close() {
}

public static class NodeRequest extends TransportRequest implements Releasable {

// TODO don't wrap the whole top-level request, it contains heavy and irrelevant DiscoveryNode things; see #100878
NodesReloadSecureSettingsRequest request;

NodeRequest(StreamInput in) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.FailedNodeException;
import org.elasticsearch.action.support.TransportAction;
import org.elasticsearch.action.support.nodes.BaseNodeResponse;
import org.elasticsearch.action.support.nodes.BaseNodesResponse;
import org.elasticsearch.cluster.ClusterName;
Expand All @@ -30,22 +31,18 @@ public class NodesReloadSecureSettingsResponse extends BaseNodesResponse<NodesRe
implements
ToXContentFragment {

public NodesReloadSecureSettingsResponse(StreamInput in) throws IOException {
super(in);
}

public NodesReloadSecureSettingsResponse(ClusterName clusterName, List<NodeResponse> nodes, List<FailedNodeException> failures) {
super(clusterName, nodes, failures);
}

@Override
protected List<NodesReloadSecureSettingsResponse.NodeResponse> readNodesFrom(StreamInput in) throws IOException {
return in.readCollectionAsList(NodeResponse::new);
return TransportAction.localOnly();
}

@Override
protected void writeNodesTo(StreamOutput out, List<NodesReloadSecureSettingsResponse.NodeResponse> nodes) throws IOException {
out.writeCollection(nodes);
TransportAction.localOnly();
}

@Override
Expand Down
Loading

0 comments on commit 5f75f49

Please sign in to comment.