Skip to content

[Gem] Fixes header conflict on Serverless#2984

Merged
picandocodigo merged 3 commits into
mainfrom
fix_2983
Jun 17, 2026
Merged

[Gem] Fixes header conflict on Serverless#2984
picandocodigo merged 3 commits into
mainfrom
fix_2983

Conversation

@picandocodigo

Copy link
Copy Markdown
Contributor

When a client also sets the Elastic-Api-Version header (required for Elasticsearch Serverless), serverless rejects the request with HTTP 400: The request includes both the [Elastic-Api-Version] header and a [compatible-with] parameter, but it is not valid to include both of these in a request

These two versioning mechanisms serve different deployment models and are mutually exclusive on the server side:

  • compatible-with=N: REST API compatibility for self-managed/hosted major version upgrades
  • Elastic-Api-Version: 2023-10-31: date-based API versioning for serverless

With this change, set_content_type! checks if Elastic-Api-Version is already present in transport_options[:headers] for adding compatible-with headers.

Addresses #2983

When a client also sets the Elastic-Api-Version header (required for
Elasticsearch Serverless), serverless rejects the request with HTTP
400: The request includes both the [Elastic-Api-Version] header and a
[compatible-with] parameter, but it is not valid to include both of
these in a request

These two versioning mechanisms serve different deployment models and
are mutually exclusive on the server side:

* compatible-with=N: REST API compatibility for self-managed/hosted major version upgrades
* Elastic-Api-Version: 2023-10-31: date-based API versioning for serverless

With this change, set_content_type! checks if Elastic-Api-Version is
already present in transport_options[:headers]  for adding
compatible-with headers.

Addresses #2983
Comment thread elasticsearch/lib/elasticsearch.rb Outdated

@kaisecheng kaisecheng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thank you for the quick fix. Red CI is unrelated to this change.

@picandocodigo

Copy link
Copy Markdown
Contributor Author

@kaisecheng thanks! Yes, the issue is with the dependency on JBuilder and specifically JRuby 9.4.15.0. I'll look into it and try to get a green build or skip for this particular version of JRuby in the meantime.

There is a dependency issue with JBuilder and JRuby 9.4.15.0 at the
moment. This breaks the build unrelated to recent changes. A patch
release is needed, so will investigate.

NoMethodError: undefined method `[]' for Fiber:Class
@picandocodigo
picandocodigo merged commit 43c2a33 into main Jun 17, 2026
16 checks passed
@picandocodigo
picandocodigo deleted the fix_2983 branch June 17, 2026 14:22
picandocodigo added a commit that referenced this pull request Jun 17, 2026
When a client also sets the Elastic-Api-Version header (required for
Elasticsearch Serverless), serverless rejects the request with HTTP
400: The request includes both the [Elastic-Api-Version] header and a
[compatible-with] parameter, but it is not valid to include both of
these in a request

These two versioning mechanisms serve different deployment models and
are mutually exclusive on the server side:

* compatible-with=N: REST API compatibility for self-managed/hosted major version upgrades
* Elastic-Api-Version: 2023-10-31: date-based API versioning for serverless

With this change, set_content_type! checks if Elastic-Api-Version is
already present in transport_options[:headers]  for adding
compatible-with headers.

Addresses #2983

Use safe navigation operator to check for API version header

Co-authored-by: Kaise <[email protected]>

[Tests] Skips jbuilder for specific version of JRuby

There is a dependency issue with JBuilder and JRuby 9.4.15.0 at the
moment. This breaks the build unrelated to recent changes. A patch
release is needed, so will investigate.

NoMethodError: undefined method `[]' for Fiber:Class
picandocodigo added a commit that referenced this pull request Jun 17, 2026
When a client also sets the Elastic-Api-Version header (required for
Elasticsearch Serverless), serverless rejects the request with HTTP
400: The request includes both the [Elastic-Api-Version] header and a
[compatible-with] parameter, but it is not valid to include both of
these in a request

These two versioning mechanisms serve different deployment models and
are mutually exclusive on the server side:

* compatible-with=N: REST API compatibility for self-managed/hosted major version upgrades
* Elastic-Api-Version: 2023-10-31: date-based API versioning for serverless

With this change, set_content_type! checks if Elastic-Api-Version is
already present in transport_options[:headers]  for adding
compatible-with headers.

Addresses #2983

Use safe navigation operator to check for API version header

Co-authored-by: Kaise <[email protected]>

[Tests] Skips jbuilder for specific version of JRuby

There is a dependency issue with JBuilder and JRuby 9.4.15.0 at the
moment. This breaks the build unrelated to recent changes. A patch
release is needed, so will investigate.

NoMethodError: undefined method `[]' for Fiber:Class
picandocodigo added a commit that referenced this pull request Jun 17, 2026
When a client also sets the Elastic-Api-Version header (required for
Elasticsearch Serverless), serverless rejects the request with HTTP
400: The request includes both the [Elastic-Api-Version] header and a
[compatible-with] parameter, but it is not valid to include both of
these in a request

These two versioning mechanisms serve different deployment models and
are mutually exclusive on the server side:

* compatible-with=N: REST API compatibility for self-managed/hosted major version upgrades
* Elastic-Api-Version: 2023-10-31: date-based API versioning for serverless

With this change, set_content_type! checks if Elastic-Api-Version is
already present in transport_options[:headers]  for adding
compatible-with headers.

Addresses #2983

Use safe navigation operator to check for API version header

Co-authored-by: Kaise <[email protected]>

[Tests] Skips jbuilder for specific version of JRuby

There is a dependency issue with JBuilder and JRuby 9.4.15.0 at the
moment. This breaks the build unrelated to recent changes. A patch
release is needed, so will investigate.

NoMethodError: undefined method `[]' for Fiber:Class
picandocodigo added a commit that referenced this pull request Jun 17, 2026
When a client also sets the Elastic-Api-Version header (required for
Elasticsearch Serverless), serverless rejects the request with HTTP
400: The request includes both the [Elastic-Api-Version] header and a
[compatible-with] parameter, but it is not valid to include both of
these in a request

These two versioning mechanisms serve different deployment models and
are mutually exclusive on the server side:

* compatible-with=N: REST API compatibility for self-managed/hosted major version upgrades
* Elastic-Api-Version: 2023-10-31: date-based API versioning for serverless

With this change, set_content_type! checks if Elastic-Api-Version is
already present in transport_options[:headers]  for adding
compatible-with headers.

Addresses #2983

Use safe navigation operator to check for API version header

Co-authored-by: Kaise <[email protected]>

[Tests] Skips jbuilder for specific version of JRuby

There is a dependency issue with JBuilder and JRuby 9.4.15.0 at the
moment. This breaks the build unrelated to recent changes. A patch
release is needed, so will investigate.

NoMethodError: undefined method `[]' for Fiber:Class
picandocodigo added a commit that referenced this pull request Jun 17, 2026
When a client also sets the Elastic-Api-Version header (required for
Elasticsearch Serverless), serverless rejects the request with HTTP
400: The request includes both the [Elastic-Api-Version] header and a
[compatible-with] parameter, but it is not valid to include both of
these in a request

These two versioning mechanisms serve different deployment models and
are mutually exclusive on the server side:

* compatible-with=N: REST API compatibility for self-managed/hosted major version upgrades
* Elastic-Api-Version: 2023-10-31: date-based API versioning for serverless

With this change, set_content_type! checks if Elastic-Api-Version is
already present in transport_options[:headers]  for adding
compatible-with headers.

Addresses #2983

Use safe navigation operator to check for API version header

Co-authored-by: Kaise <[email protected]>

[Tests] Skips jbuilder for specific version of JRuby

There is a dependency issue with JBuilder and JRuby 9.4.15.0 at the
moment. This breaks the build unrelated to recent changes. A patch
release is needed, so will investigate.

NoMethodError: undefined method `[]' for Fiber:Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants