Skip to content

Commit a5d2d2d

Browse files
committed
[ES|QL] s/autocompleteHint/hint
1 parent cf823f8 commit a5d2d2d

File tree

5 files changed

+23
-24
lines changed

5 files changed

+23
-24
lines changed

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.

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -611,23 +611,23 @@ public static String normalizeName(String name) {
611611

612612
public static class ArgSignature {
613613

614-
public record AutocompleteHint(String entityType, Map<String, String> constraints) {}
614+
public record Hint(String entityType, Map<String, String> constraints) {}
615615

616616
protected final String name;
617617
protected final String[] type;
618618
protected final String description;
619619
protected final boolean optional;
620620
protected final boolean variadic;
621621
protected final DataType targetDataType;
622-
protected final AutocompleteHint autocompleteHint;
622+
protected final Hint hint;
623623

624624
public ArgSignature(
625625
String name,
626626
String[] type,
627627
String description,
628628
boolean optional,
629629
boolean variadic,
630-
AutocompleteHint autocompleteHint,
630+
Hint hint,
631631
DataType targetDataType
632632
) {
633633
this.name = name;
@@ -636,18 +636,18 @@ public ArgSignature(
636636
this.optional = optional;
637637
this.variadic = variadic;
638638
this.targetDataType = targetDataType;
639-
this.autocompleteHint = autocompleteHint;
639+
this.hint = hint;
640640
}
641641

642642
public ArgSignature(
643643
String name,
644644
String[] type,
645645
String description,
646646
boolean optional,
647-
AutocompleteHint autocompleteHint,
647+
Hint hint,
648648
boolean variadic
649649
) {
650-
this(name, type, description, optional, variadic, autocompleteHint, UNSUPPORTED);
650+
this(name, type, description, optional, variadic, hint, UNSUPPORTED);
651651
}
652652

653653
public ArgSignature(String name, String[] type, String description, boolean optional, boolean variadic, DataType targetDataType) {
@@ -838,12 +838,11 @@ public static ArgSignature param(Param param, boolean variadic) {
838838
String[] type = removeUnderConstruction(param.type());
839839
String desc = param.description().replace('\n', ' ');
840840
DataType targetDataType = getTargetType(type);
841-
ArgSignature.AutocompleteHint autocompleteHint = null;
842-
if (param.autocompleteHint() != null && param.autocompleteHint().entityType() != Param.AutocompleteHint.ENTITY_TYPE.NONE) {
843-
Map<String, String> constraints = Arrays.stream(param.autocompleteHint().constraints())
844-
.collect(Collectors.toMap(Param.AutocompleteHint.Constraint::name, Param.AutocompleteHint.Constraint::value));
845-
autocompleteHint = new ArgSignature.AutocompleteHint(
846-
param.autocompleteHint().entityType().name().toLowerCase(Locale.ROOT),
841+
ArgSignature.Hint hint = null;
842+
if (param.hint() != null && param.hint().entityType() != Param.Hint.ENTITY_TYPE.NONE) {
843+
Map<String, String> constraints = Arrays.stream(param.hint().constraints())
844+
.collect(Collectors.toMap(Param.Hint.Constraint::name, Param.Hint.Constraint::value));
845+
hint = new ArgSignature.Hint(param.hint().entityType().name().toLowerCase(Locale.ROOT),
847846
constraints
848847
);
849848
}
@@ -854,7 +853,7 @@ public static ArgSignature param(Param param, boolean variadic) {
854853
desc,
855854
param.optional(),
856855
variadic,
857-
autocompleteHint,
856+
hint,
858857
targetDataType
859858
);
860859
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
boolean optional() default false;
3030

3131
@Nullable
32-
AutocompleteHint autocompleteHint() default @AutocompleteHint(entityType = AutocompleteHint.ENTITY_TYPE.NONE);
32+
Hint hint() default @Hint(entityType = Hint.ENTITY_TYPE.NONE);
3333

3434
@Retention(RetentionPolicy.RUNTIME)
3535
@Target(ElementType.PARAMETER)
36-
@interface AutocompleteHint {
36+
@interface Hint {
3737
enum ENTITY_TYPE {
3838
NONE,
3939
INFERENCE_ENDPOINT,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public TextEmbedding(
6666
description = "Identifier of an existing inference endpoint the that will generate the embeddings. "
6767
+ "The inference endpoint must have the `text_embedding` task type and should use the same model "
6868
+ "that was used to embed your indexed data.",
69-
autocompleteHint = @Param.AutocompleteHint(
70-
entityType = Param.AutocompleteHint.ENTITY_TYPE.INFERENCE_ENDPOINT,
71-
constraints = { @Param.AutocompleteHint.Constraint(name = "task_type", value = "text_embedding") }
69+
hint = @Param.Hint(
70+
entityType = Param.Hint.ENTITY_TYPE.INFERENCE_ENDPOINT,
71+
constraints = { @Param.Hint.Constraint(name = "task_type", value = "text_embedding") }
7272
)
7373
) Expression inferenceId
7474
) {

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/DocsV3Support.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,12 +1383,12 @@ void renderKibanaFunctionDefinition(
13831383
builder.field("optional", arg.optional());
13841384
String cleanedParamDesc = removeAppliesToBlocks(arg.description());
13851385
builder.field("description", cleanedParamDesc);
1386-
if (arg.autocompleteHint != null) {
1387-
builder.startObject("autocompleteHint");
1388-
builder.field("entityType", arg.autocompleteHint.entityType());
1389-
if (arg.autocompleteHint.constraints() != null && arg.autocompleteHint.constraints().size() > 0) {
1386+
if (arg.hint != null) {
1387+
builder.startObject("hint");
1388+
builder.field("entityType", arg.hint.entityType());
1389+
if (arg.hint.constraints() != null && arg.hint.constraints().size() > 0) {
13901390
builder.startObject("constraints");
1391-
for (Map.Entry<String, String> constraint : arg.autocompleteHint.constraints().entrySet()) {
1391+
for (Map.Entry<String, String> constraint : arg.hint.constraints().entrySet()) {
13921392
builder.field(constraint.getKey(), constraint.getValue());
13931393
}
13941394
builder.endObject();

0 commit comments

Comments
 (0)