Skip to content

Add enterprise license check to inference action for semantic text fields #122293

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

Conversation

dan-rubinstein
Copy link
Member

@dan-rubinstein dan-rubinstein commented Feb 11, 2025

Description

The inference API feature is only available to those with at least an enterprise level license. As of 8.18/9.0 we are enforcing this license requirement on all direct interactions with the inference API but we did not add a block for semantic text related inference usage. This change adds a block to the semantic text field inference action so that users are unable to ingest documents into a semantic text field if they do not have the correct license. The cases that we need to block against are:

  1. A user has never had an enterprise license and attempts to use a semantic text field and attempts to create an index with one that utilizes the default inference endpoints. (Note: The user can not use non-default endpoints as creating endpoints will be blocked for them).
  2. A user previously had an enterprise license and created semantic text fields using default or non-default inference endpoints, but their license has since expired.

Testing

  • Unit tests
  • Ran ES locally with a trial license and confirmed that text fields are still usable both with default and non-default inference endpoints..
  • Ran ES locally with a basic license and confirmed that the exception is thrown when ingesting a document into a semantic text field linked to a default inference endpoint.

@elasticsearchmachine
Copy link
Collaborator

Hi @dan-rubinstein, I've created a changelog YAML for you.

@dan-rubinstein dan-rubinstein marked this pull request as ready for review February 11, 2025 21:42
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this @dan-rubinstein . Can we add a rest test that checks that we fail the bulk request entirely if the license is not compliant?

@Mikep86
Copy link
Contributor

Mikep86 commented Feb 18, 2025

@elasticmachine merge upstream

Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the iterations and sorry for the delay in the follow-up review!

assertThat(failure.getCause(), instanceOf(ElasticsearchSecurityException.class));
assertThat(
failure.getMessage(),
containsString(org.elasticsearch.core.Strings.format("current license is non-compliant for [%s]", XPackField.INFERENCE))
Copy link
Member

Choose a reason for hiding this comment

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

Weird, why didn't IntelliJ want to use the already-imported org.elasticsearch.common.Strings?

@dan-rubinstein
Copy link
Member Author

@elasticmachine merge upstream

@dan-rubinstein dan-rubinstein added the auto-backport Automatically create backport pull requests when merged label Feb 20, 2025
@dan-rubinstein dan-rubinstein merged commit 99897b1 into elastic:main Feb 20, 2025
17 checks passed
dan-rubinstein added a commit to dan-rubinstein/elasticsearch that referenced this pull request Feb 20, 2025
…elds (elastic#122293)

* Add enterprise license check to inference action for semantic text fields

* Update docs/changelog/122293.yaml

* Set license to trial in ShardBulkInferenceActionFilterIT

* Move license check to only block semantic_text fields that require inference call

* Cleaning up tests

* Add parameterization on useLegacyFormat back in ShardBulkInferenceActionFilterBasicLicenseIT

---------

Co-authored-by: Elastic Machine <[email protected]>
dan-rubinstein added a commit to dan-rubinstein/elasticsearch that referenced this pull request Feb 20, 2025
…elds (elastic#122293)

* Add enterprise license check to inference action for semantic text fields

* Update docs/changelog/122293.yaml

* Set license to trial in ShardBulkInferenceActionFilterIT

* Move license check to only block semantic_text fields that require inference call

* Cleaning up tests

* Add parameterization on useLegacyFormat back in ShardBulkInferenceActionFilterBasicLicenseIT

---------

Co-authored-by: Elastic Machine <[email protected]>
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.0
8.18
8.x

dan-rubinstein added a commit to dan-rubinstein/elasticsearch that referenced this pull request Feb 20, 2025
…elds (elastic#122293)

* Add enterprise license check to inference action for semantic text fields

* Update docs/changelog/122293.yaml

* Set license to trial in ShardBulkInferenceActionFilterIT

* Move license check to only block semantic_text fields that require inference call

* Cleaning up tests

* Add parameterization on useLegacyFormat back in ShardBulkInferenceActionFilterBasicLicenseIT

---------

Co-authored-by: Elastic Machine <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Feb 20, 2025
…elds (#122293) (#123065)

* Add enterprise license check to inference action for semantic text fields

* Update docs/changelog/122293.yaml

* Set license to trial in ShardBulkInferenceActionFilterIT

* Move license check to only block semantic_text fields that require inference call

* Cleaning up tests

* Add parameterization on useLegacyFormat back in ShardBulkInferenceActionFilterBasicLicenseIT

---------

Co-authored-by: Elastic Machine <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Feb 20, 2025
…elds (#122293) (#123066)

* Add enterprise license check to inference action for semantic text fields

* Update docs/changelog/122293.yaml

* Set license to trial in ShardBulkInferenceActionFilterIT

* Move license check to only block semantic_text fields that require inference call

* Cleaning up tests

* Add parameterization on useLegacyFormat back in ShardBulkInferenceActionFilterBasicLicenseIT

---------

Co-authored-by: Elastic Machine <[email protected]>
afoucret pushed a commit to afoucret/elasticsearch that referenced this pull request Feb 21, 2025
…elds (elastic#122293)

* Add enterprise license check to inference action for semantic text fields

* Update docs/changelog/122293.yaml

* Set license to trial in ShardBulkInferenceActionFilterIT

* Move license check to only block semantic_text fields that require inference call

* Cleaning up tests

* Add parameterization on useLegacyFormat back in ShardBulkInferenceActionFilterBasicLicenseIT

---------

Co-authored-by: Elastic Machine <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Feb 21, 2025
…elds (#122293) (#123064)

* Add enterprise license check to inference action for semantic text fields

* Update docs/changelog/122293.yaml

* Set license to trial in ShardBulkInferenceActionFilterIT

* Move license check to only block semantic_text fields that require inference call

* Cleaning up tests

* Add parameterization on useLegacyFormat back in ShardBulkInferenceActionFilterBasicLicenseIT

---------

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >bug :ml Machine learning Team:ML Meta label for the ML team v8.18.0 v8.19.0 v9.0.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants