Skip to content

Updates main #2713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ module Actions
# @option arguments [Boolean] :active_only If `true`, the response only includes ongoing shard recoveries.
# @option arguments [String] :bytes The unit used to display byte values.
# @option arguments [Boolean] :detailed If `true`, the response includes detailed information about shard recoveries.
# @option arguments [String, Array<String>] :h List of columns to appear in the response. Supports simple wildcards.
# @option arguments [String, Array<String>] :s List of columns that determine how the table should be sorted.
# @option arguments [String, Array<String>] :h A comma-separated list of columns names to display.
# It supports simple wildcards. Server default: ip,hp,rp,r,m,n,cpu,l.
# @option arguments [String, Array<String>] :s A comma-separated list of column names or aliases that determines the sort order.
# Sorting defaults to ascending and can be changed by setting `:asc`
# or `:desc` as a suffix to the column name.
# @option arguments [String] :time Unit used to display time values.
# @option arguments [String] :time The unit used to display time values.
# @option arguments [String] :format Specifies the format to return the columnar data in, can be set to
# `text`, `json`, `cbor`, `yaml`, or `smile`. Server default: text.
# @option arguments [Boolean] :help When set to `true` will output available columns. This option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ module Actions
# Supports wildcards (`*`).
# To target all data streams and indices, omit this parameter or use `*` or `_all`.
# @option arguments [String] :bytes The unit used to display byte values.
# @option arguments [String, Array<String>] :h List of columns to appear in the response. Supports simple wildcards.
# @option arguments [String, Array<String>] :s List of columns that determine how the table should be sorted.
# @option arguments [String, Array<String>] :h A comma-separated list of columns names to display.
# It supports simple wildcards. Server default: ip,hp,rp,r,m,n,cpu,l.
# @option arguments [String, Array<String>] :s A comma-separated list of column names or aliases that determines the sort order.
# Sorting defaults to ascending and can be changed by setting `:asc`
# or `:desc` as a suffix to the column name.
# @option arguments [Boolean] :local If `true`, the request computes the list of selected nodes from the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ module Actions
# `_all` returns all repositories.
# If any repository fails during the request, Elasticsearch returns an error.
# @option arguments [Boolean] :ignore_unavailable If `true`, the response does not include information from unavailable snapshots.
# @option arguments [String, Array<String>] :h List of columns to appear in the response. Supports simple wildcards.
# @option arguments [String, Array<String>] :h A comma-separated list of columns names to display.
# It supports simple wildcards. Server default: ip,hp,rp,r,m,n,cpu,l.
# @option arguments [String, Array<String>] :s List of columns that determine how the table should be sorted.
# Sorting defaults to ascending and can be changed by setting `:asc`
# or `:desc` as a suffix to the column name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module Actions
# * Azure AI Studio (`completion`, `text_embedding`)
# * Azure OpenAI (`completion`, `text_embedding`)
# * Cohere (`completion`, `rerank`, `text_embedding`)
# * DeepSeek (`completion`, `chat_completion`)
# * Elasticsearch (`rerank`, `sparse_embedding`, `text_embedding` - this service is for built-in models and models uploaded through Eland)
# * ELSER (`sparse_embedding`)
# * Google AI Studio (`completion`, `text_embedding`)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. 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.
#
# This code was automatically generated from the Elasticsearch Specification
# See https://github.com/elastic/elasticsearch-specification
# See Elasticsearch::ES_SPECIFICATION_COMMIT for commit hash.
module Elasticsearch
module API
module Inference
module Actions
# Create a DeepSeek inference endpoint.
# Create an inference endpoint to perform an inference task with the `deepseek` service.
#
# @option arguments [String] :task_type The type of the inference task that the model will perform. (*Required*)
# @option arguments [String] :deepseek_inference_id The unique identifier of the inference endpoint. (*Required*)
# @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors
# when they occur.
# @option arguments [String, Array<String>] :filter_path Comma-separated list of filters in dot notation which reduce the response
# returned by Elasticsearch.
# @option arguments [Boolean] :human When set to `true` will return statistics in a format suitable for humans.
# For example `"exists_time": "1h"` for humans and
# `"exists_time_in_millis": 3600000` for computers. When disabled the human
# readable values will be omitted. This makes sense for responses being consumed
# only by machines.
# @option arguments [Boolean] :pretty If set to `true` the returned JSON will be "pretty-formatted". Only use
# this option for debugging only.
# @option arguments [Hash] :headers Custom HTTP headers
# @option arguments [Hash] :body request body
#
# @see https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-deepseek
#
def put_deepseek(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'inference.put_deepseek' }

defined_params = [:task_type, :deepseek_inference_id].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
end
request_opts[:defined_params] = defined_params unless defined_params.empty?

raise ArgumentError, "Required argument 'task_type' missing" unless arguments[:task_type]

unless arguments[:deepseek_inference_id]
raise ArgumentError,
"Required argument 'deepseek_inference_id' missing"
end

arguments = arguments.clone
headers = arguments.delete(:headers) || {}

body = arguments.delete(:body)

_task_type = arguments.delete(:task_type)

_deepseek_inference_id = arguments.delete(:deepseek_inference_id)

method = Elasticsearch::API::HTTP_PUT
path = "_inference/#{Utils.listify(_task_type)}/#{Utils.listify(_deepseek_inference_id)}"
params = Utils.process_params(arguments)

Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)
end
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ module Actions
# If you omit the `<snapshot>` request path parameter, the request retrieves information only for currently running snapshots.
# This usage is preferred.
# If needed, you can specify `<repository>` and `<snapshot>` to retrieve information for specific snapshots, even if they're not currently running.
# Note that the stats will not be available for any shard snapshots in an ongoing snapshot completed by a node that (even momentarily) left the cluster.
# Loading the stats from the repository is an expensive operation (see the WARNING below).
# Therefore the stats values for such shards will be -1 even though the "stage" value will be "DONE", in order to minimize latency.
# A "description" field will be present for a shard snapshot completed by a departed node explaining why the shard snapshot's stats results are invalid.
# Consequently, the total stats for the index will be less than expected due to the missing values from these shards.
# WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive.
# The API requires a read from the repository for each shard in each snapshot.
# For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards).
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch-api/lib/elasticsearch/api/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
module Elasticsearch
module API
VERSION = '9.1.0'.freeze
ES_SPECIFICATION_COMMIT = 'cd2d1fba07d3224129ca5a8d6018d86f67004fdf'.freeze
ES_SPECIFICATION_COMMIT = '58fbe0ad87bb94a0870b7df4db76587fbfcaa5b7'.freeze
end
end
36 changes: 36 additions & 0 deletions elasticsearch-api/spec/unit/actions/inference/put_deepseek_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. 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.

require 'spec_helper'

describe 'client#inference.put_deepseek' do
let(:expected_args) do
[
'PUT',
'_inference/foo/bar',
{},
nil,
{},
{ defined_params: { deepseek_inference_id: 'bar', task_type: 'foo' },
endpoint: 'inference.put_deepseek' }
]
end

it 'performs the request' do
expect(client_double.inference.put_deepseek(task_type: 'foo', deepseek_inference_id: 'bar')).to be_a Elasticsearch::API::Response
end
end
26 changes: 21 additions & 5 deletions elasticsearch-api/spec/unit/perform_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
# specific language governing permissions and limitations
# under the License.

require 'spec_helper'
require 'elastic-transport'
require 'spec_helper'

require_relative File.expand_path('../../utils/thor/endpoint_spec', __dir__)
require_relative File.expand_path('../../utils/thor/generator/files_helper', __dir__)

Expand All @@ -28,10 +29,23 @@
# TODO: Once the test suite is migrated to elasticsearch-specification, these should be removed
spec.module_namespace.flatten.first == 'rollup' ||
[
'scroll', 'clear_scroll', 'connector.last_sync', 'knn_search',
'indices.remove_block'
'scroll', 'clear_scroll', 'connector.last_sync', 'knn_search'
].include?(spec.endpoint_name)

# Skip testing if the method hasn't been added to the client yet:
client = Elasticsearch::Client.new
implemented = if spec.module_namespace.empty?
client.public_methods.include?(spec.method_name.to_sym)
else
client.public_methods.include?(spec.module_namespace[0].to_sym) &&
client.send(spec.module_namespace[0]).methods.include?(spec.method_name.to_sym)
end
unless implemented
name = spec.module_namespace.empty? ? spec.method_name : "#{spec.module_namespace[0]}.#{spec.method_name}"
Logger.new($stdout).info("Method #{name} not implemented yet")
next
end

# These are the path parts defined by the user in the method argument
defined_path_parts = spec.path_params.inject({}) do |params, part|
params.merge(part => 'testing')
Expand Down Expand Up @@ -68,7 +82,7 @@
end

if spec.path_parts.empty?
it "passes the endpoint id to the request" do
it 'passes the endpoint id to the request' do
if spec.module_namespace.empty?
client_double.send(spec.method_name, required_params)
else
Expand All @@ -81,7 +95,9 @@
client_double.send(spec.method_name, required_params.merge(defined_path_parts))
else
client_double.send(
spec.module_namespace[0]).send(spec.method_name, required_params.merge(defined_path_parts)
spec.module_namespace[0]
).send(
spec.method_name, required_params.merge(defined_path_parts)
)
end
end
Expand Down