Skip to content

[API] Updates source code docs to 6a749236ec86e65b50e31dc888c727c0aede67a3 #2737

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 29, 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
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ steps:
transport: main
env:
RUBY_VERSION: '{{ matrix.ruby }}'
STACK_VERSION: 9.0.3-SNAPSHOT
STACK_VERSION: 9.0.5-SNAPSHOT
ES_YAML_TESTS_BRANCH: '9.0'
TRANSPORT_VERSION: '{{ matrix.transport }}'
RUBY_SOURCE: '{{ matrix.ruby_source }}'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/9.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
sudo sysctl -w vm.max_map_count=262144
- uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 9.0.3-SNAPSHOT
stack-version: 9.0.5-SNAPSHOT
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
Expand All @@ -39,4 +39,4 @@ jobs:
- name: elasticsearch
run: cd elasticsearch && bundle exec rake test:all
- name: elasticsearch-api
run: rake es:download_artifacts[9.0.3-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:all
run: rake es:download_artifacts[9.0.5-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:all
4 changes: 2 additions & 2 deletions .github/workflows/otel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
sudo sysctl -w vm.max_map_count=262144
- uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 9.0.3-SNAPSHOT
stack-version: 9.0.5-SNAPSHOT
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
Expand All @@ -41,4 +41,4 @@ jobs:
- name: elasticsearch
run: cd elasticsearch && bundle exec rake test:all
- name: elasticsearch-api
run: rake es:download_artifacts[9.0.3-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:all
run: rake es:download_artifacts[9.0.5-SNAPSHOT] && cd elasticsearch-api && bundle exec rake test:all
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# 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 custom inference endpoint.
# The custom service gives more control over how to interact with external inference services that aren't explicitly supported through dedicated integrations.
# The custom service gives you the ability to define the headers, url, query parameters, request body, and secrets.
# The custom service supports the template replacement functionality, which enables you to define a template that can be replaced with the value associated with that key.
# Templates are portions of a string that start with `${` and end with `}`.
# The parameters `secret_parameters` and `task_settings` are checked for keys for template replacement. Template replacement is supported in the `request`, `headers`, `url`, and `query_parameters`.
# If the definition (key) is not found for a template, an error message is returned.
# In case of an endpoint definition like the following:
#
# ```
# PUT _inference/text_embedding/test-text-embedding
# {
# "service": "custom",
# "service_settings": {
# "secret_parameters": {
# "api_key": "<some api key>"
# },
# "url": "...endpoints.huggingface.cloud/v1/embeddings",
# "headers": {
# "Authorization": "Bearer ${api_key}",
# "Content-Type": "application/json"
# },
# "request": "{\"input\": ${input}}",
# "response": {
# "json_parser": {
# "text_embeddings":"$.data[*].embedding[*]"
# }
# }
# }
# }
# ```
#
# To replace `${api_key}` the `secret_parameters` and `task_settings` are checked for a key named `api_key`.
#
# @option arguments [String] :task_type The type of the inference task that the model will perform. (*Required*)
# @option arguments [String] :custom_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-custom
#
def put_custom(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'inference.put_custom' }

defined_params = [:task_type, :custom_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[:custom_inference_id]
raise ArgumentError,
"Required argument 'custom_inference_id' missing"
end

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

body = arguments.delete(:body)

_task_type = arguments.delete(:task_type)

_custom_inference_id = arguments.delete(:custom_inference_id)

method = Elasticsearch::API::HTTP_PUT
path = "_inference/#{Utils.listify(_task_type)}/#{Utils.listify(_custom_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
1 change: 1 addition & 0 deletions elasticsearch-api/lib/elasticsearch/api/actions/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module API
module Actions
# Get cluster info.
# Get basic build, version, and cluster information.
# ::: In Serverless, this API is retained for backward compatibility only. Some response fields, such as the version number, should be ignored.
#
# @option arguments [Boolean] :error_trace When set to `true` Elasticsearch will include the full stack trace of errors
# when they occur.
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.0.3'.freeze
ES_SPECIFICATION_COMMIT = '896e37f76add4e8878e9f04205dd8628c7263219'.freeze
ES_SPECIFICATION_COMMIT = '6a749236ec86e65b50e31dc888c727c0aede67a3'.freeze
end
end
36 changes: 36 additions & 0 deletions elasticsearch-api/spec/unit/actions/inference/put_custom_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_custom' do
let(:expected_args) do
[
'PUT',
'_inference/foo/baz',
{},
nil,
{},
{ defined_params: { custom_inference_id: 'baz', task_type: 'foo' },
endpoint: 'inference.put_custom' }
]
end

it 'performs the request' do
expect(client_double.inference.put_custom(task_type: 'foo', custom_inference_id: 'baz')).to be_a Elasticsearch::API::Response
end
end