Skip to content

Commit 89f96e4

Browse files
committed
Rename EMBED_TEXT function to TEXT_EMBEDDING and update all references
1 parent efa0839 commit 89f96e4

File tree

14 files changed

+111
-91
lines changed

14 files changed

+111
-91
lines changed

docs/reference/query-languages/esql/images/functions/embed_text.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/reference/query-languages/esql/images/functions/text_embedding.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/reference/query-languages/esql/kibana/definition/functions/embed_text.json renamed to docs/reference/query-languages/esql/kibana/definition/functions/text_embedding.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/docs/functions/embed_text.md renamed to docs/reference/query-languages/esql/kibana/docs/functions/text_embedding.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,9 +1246,9 @@ public enum Cap {
12461246
AGGREGATE_METRIC_DOUBLE_AVG(AGGREGATE_METRIC_DOUBLE_FEATURE_FLAG),
12471247

12481248
/**
1249-
* Support for the {@code EMBED_TEXT} function for generating dense vector embeddings.
1249+
* Support for the {@code TEXT_EMBEDDING} function for generating dense vector embeddings.
12501250
*/
1251-
EMBED_TEXT_FUNCTION(Build.current().isSnapshot()),
1251+
TEXT_EMBEDDING_FUNCTION(Build.current().isSnapshot()),
12521252

12531253
/**
12541254
* Forbid usage of brackets in unquoted index and enrich policy names

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/ExpressionWritables.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import org.elasticsearch.xpack.esql.expression.function.UnsupportedAttribute;
1414
import org.elasticsearch.xpack.esql.expression.function.aggregate.AggregateWritables;
1515
import org.elasticsearch.xpack.esql.expression.function.fulltext.FullTextWritables;
16-
import org.elasticsearch.xpack.esql.expression.function.inference.EmbedText;
16+
import org.elasticsearch.xpack.esql.expression.function.inference.TextEmbedding;
1717
import org.elasticsearch.xpack.esql.expression.function.scalar.ScalarFunctionWritables;
1818
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.FromBase64;
1919
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToAggregateMetricDouble;
@@ -268,8 +268,8 @@ private static List<NamedWriteableRegistry.Entry> vector() {
268268
}
269269

270270
private static List<NamedWriteableRegistry.Entry> inference() {
271-
if (EsqlCapabilities.Cap.EMBED_TEXT_FUNCTION.isEnabled()) {
272-
return List.of(EmbedText.ENTRY);
271+
if (EsqlCapabilities.Cap.TEXT_EMBEDDING_FUNCTION.isEnabled()) {
272+
return List.of(TextEmbedding.ENTRY);
273273
}
274274
return List.of();
275275
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
import org.elasticsearch.xpack.esql.expression.function.fulltext.Term;
5353
import org.elasticsearch.xpack.esql.expression.function.grouping.Bucket;
5454
import org.elasticsearch.xpack.esql.expression.function.grouping.Categorize;
55-
import org.elasticsearch.xpack.esql.expression.function.inference.EmbedText;
55+
import org.elasticsearch.xpack.esql.expression.function.inference.TextEmbedding;
5656
import org.elasticsearch.xpack.esql.expression.function.scalar.conditional.Case;
5757
import org.elasticsearch.xpack.esql.expression.function.scalar.conditional.Greatest;
5858
import org.elasticsearch.xpack.esql.expression.function.scalar.conditional.Least;
@@ -480,7 +480,7 @@ private static FunctionDefinition[][] snapshotFunctions() {
480480
def(FirstOverTime.class, uni(FirstOverTime::new), "first_over_time"),
481481
def(Term.class, bi(Term::new), "term"),
482482
def(Knn.class, Knn::new, "knn"),
483-
def(EmbedText.class, EmbedText::new, "embed_text"),
483+
def(TextEmbedding.class, TextEmbedding::new, "text_embedding"),
484484
def(StGeohash.class, StGeohash::new, "st_geohash"),
485485
def(StGeohashToLong.class, StGeohashToLong::new, "st_geohash_to_long"),
486486
def(StGeohashToString.class, StGeohashToString::new, "st_geohash_to_string"),
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,21 @@
2626
import java.util.List;
2727
import java.util.Objects;
2828

29-
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.*;
3029
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.ParamOrdinal.FIRST;
3130
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.ParamOrdinal.SECOND;
31+
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isFoldable;
32+
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isNotNull;
33+
import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isString;
3234

3335
/**
34-
* EMBED_TEXT function that generates dense vector embeddings for text using a specified inference deployment.
36+
* TEXT_EMBEDDING function that generates dense vector embeddings for text using a specified inference deployment.
3537
*/
36-
public class EmbedText extends InferenceFunction<EmbedText> {
38+
public class TextEmbedding extends InferenceFunction<TextEmbedding> {
3739

3840
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(
3941
Expression.class,
40-
"EmbedText",
41-
EmbedText::new
42+
"TextEmbedding",
43+
TextEmbedding::new
4244
);
4345

4446
private final Expression inferenceId;
@@ -50,7 +52,7 @@ public class EmbedText extends InferenceFunction<EmbedText> {
5052
appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.DEVELOPMENT) },
5153
preview = true
5254
)
53-
public EmbedText(
55+
public TextEmbedding(
5456
Source source,
5557
@Param(name = "text", type = { "keyword", "text" }, description = "Text to embed") Expression inputText,
5658
@Param(
@@ -64,7 +66,7 @@ public EmbedText(
6466
this.inputText = inputText;
6567
}
6668

67-
private EmbedText(StreamInput in) throws IOException {
69+
private TextEmbedding(StreamInput in) throws IOException {
6870
this(Source.readFrom((PlanStreamInput) in), in.readNamedWriteable(Expression.class), in.readNamedWriteable(Expression.class));
6971
}
7072

@@ -129,31 +131,31 @@ public TaskType taskType() {
129131
}
130132

131133
@Override
132-
public EmbedText withInferenceResolutionError(String inferenceId, String error) {
133-
return new EmbedText(source(), inputText, new UnresolvedAttribute(inferenceId().source(), inferenceId, error));
134+
public TextEmbedding withInferenceResolutionError(String inferenceId, String error) {
135+
return new TextEmbedding(source(), inputText, new UnresolvedAttribute(inferenceId().source(), inferenceId, error));
134136
}
135137

136138
@Override
137139
public Expression replaceChildren(List<Expression> newChildren) {
138-
return new EmbedText(source(), newChildren.get(0), newChildren.get(1));
140+
return new TextEmbedding(source(), newChildren.get(0), newChildren.get(1));
139141
}
140142

141143
@Override
142144
protected NodeInfo<? extends Expression> info() {
143-
return NodeInfo.create(this, EmbedText::new, inputText, inferenceId);
145+
return NodeInfo.create(this, TextEmbedding::new, inputText, inferenceId);
144146
}
145147

146148
@Override
147149
public String toString() {
148-
return "EMBED_TEXT(" + inputText + ", " + inferenceId + ")";
150+
return "TEXT_EMBEDDING(" + inputText + ", " + inferenceId + ")";
149151
}
150152

151153
@Override
152154
public boolean equals(Object o) {
153155
if (o == null || getClass() != o.getClass()) return false;
154156
if (super.equals(o) == false) return false;
155-
EmbedText embedText = (EmbedText) o;
156-
return Objects.equals(inferenceId, embedText.inferenceId) && Objects.equals(inputText, embedText.inputText);
157+
TextEmbedding textEmbedding = (TextEmbedding) o;
158+
return Objects.equals(inferenceId, textEmbedding.inferenceId) && Objects.equals(inputText, textEmbedding.inputText);
157159
}
158160

159161
@Override

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/inference/InferenceResolver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public InferenceResolver(EsqlFunctionRegistry functionRegistry, Client client) {
5151
* extracting their deployment IDs for subsequent validation. Currently, supports:
5252
* <ul>
5353
* <li>{@link InferencePlan} objects (Completion, etc.)</li>
54-
* <li>{@link InferenceFunction} objects (EmbedText, etc.)</li>
54+
* <li>{@link InferenceFunction} objects (TextEmbedding, etc.)</li>
5555
* </ul>
5656
*
5757
* @param plan The logical plan to scan for inference operations
@@ -113,9 +113,9 @@ private void resolveInferenceIds(Set<String> inferenceIds, ActionListener<Infere
113113
* Collects inference IDs from inference function calls within the logical plan.
114114
* <p>
115115
* This method scans the logical plan for {@link UnresolvedFunction} instances that represent
116-
* inference functions (e.g., EMBED_TEXT). For each inference function found:
116+
* inference functions (e.g., TEXT_EMBEDDING). For each inference function found:
117117
* <ol>
118-
* <li>Resolves the function definition through the function registry and checks if the function implements {@link InferenceFunction}</li>
118+
* <li>Resolves the function definition through the registry and checks if the function implements {@link InferenceFunction}</li>
119119
* <li>Extracts the inference deployment ID from the function arguments</li>
120120
* </ol>
121121
* <p>

0 commit comments

Comments
 (0)