Skip to content

Conversation

@ioanatia
Copy link
Contributor

@ioanatia ioanatia commented Mar 25, 2025

related: #115103
This is a tech debt cleanup PR.

When we initially added the SEMANTIC_TEXT data type in ES|QL, we did not foresee that as part of making semantic text GA we will want to change the field caps response for semantic_text fields to simply be reported as text.

Just as a recap, semantic search and semantic_text support in ES|QL is done through the following components:

  • field caps reports semantic_text as text, meaning that ES|QL will use DataType.TEXT for semantic_text fields
  • semantic search is done through the match function, which translates to a match query which supports querying semantic_text fields
  • for Lucene translatable expressions, ES|QL now has a PreMapper step where do query builder rewriting on the coordinator. This is needed for the MatchQueryBuilder (that the match function uses) in order to get the embeddings of the query string when doing semantic search.

We remove the DataType.SEMANTIC_TEXT and the EsqlCorePlugin.SEMANTIC_TEXT_FEATURE_FLAG.
Most of the code we remove is not actually reachable, not in snapshot or non-snapshot builds.
This is because we never actually get to translate a field from a queried index to an EsField that is using DataType.SEMANTIC_TEXT.

Semantic search and semantic_text support continue to work even with these changes.
We continue to have code coverage for these in csv tests, for example:

  • semantic_text.csv-spec has many tests that cover using semantic_text fields with most of the functions and commands that support text/keyword
  • match-function.csv-spec, scoring.csv-spec and match-operator.csv-spec have tests that do semantic search

@ioanatia ioanatia added >non-issue Team:Search Meta label for search team >tech debt :Search Relevance/Search Catch all for Search Relevance v9.1.0 labels Mar 25, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Mar 25, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

Copy link
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@carlosdelest carlosdelest left a comment

Choose a reason for hiding this comment

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

Nice cleanup! 🧹

I think we can remove the feature flag in EsqlCorePlugin as well


/**
* support for aggregations on semantic_text
*/
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to remove the feature flag in EsqlCorePlugin as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ha! I thought I already did - thanks for catching this! added another commit to address this

@ioanatia ioanatia merged commit 47edd0a into elastic:main Apr 2, 2025
18 checks passed
@ioanatia ioanatia mentioned this pull request Apr 2, 2025
16 tasks
andreidan pushed a commit to andreidan/elasticsearch that referenced this pull request Apr 9, 2025
ioanatia added a commit to ioanatia/elasticsearch that referenced this pull request Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :Search Relevance/Search Catch all for Search Relevance Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch >tech debt v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants