Skip to content

Commit 389ab82

Browse files
committed
License check for ES|QL categorize
1 parent 591fa87 commit 389ab82

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
import org.elasticsearch.common.io.stream.StreamInput;
1212
import org.elasticsearch.common.io.stream.StreamOutput;
1313
import org.elasticsearch.compute.operator.EvalOperator.ExpressionEvaluator;
14+
import org.elasticsearch.license.License;
15+
import org.elasticsearch.license.XPackLicenseState;
16+
import org.elasticsearch.xpack.esql.LicenseAware;
1417
import org.elasticsearch.xpack.esql.core.expression.Expression;
1518
import org.elasticsearch.xpack.esql.core.expression.Nullability;
1619
import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
@@ -21,6 +24,7 @@
2124
import org.elasticsearch.xpack.esql.expression.function.FunctionType;
2225
import org.elasticsearch.xpack.esql.expression.function.Param;
2326
import org.elasticsearch.xpack.esql.io.stream.PlanStreamInput;
27+
import org.elasticsearch.xpack.ml.MachineLearning;
2428

2529
import java.io.IOException;
2630
import java.util.List;
@@ -37,7 +41,7 @@
3741
* For the implementation, see {@link org.elasticsearch.compute.aggregation.blockhash.CategorizeBlockHash}
3842
* </p>
3943
*/
40-
public class Categorize extends GroupingFunction {
44+
public class Categorize extends GroupingFunction implements LicenseAware {
4145
public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(
4246
Expression.class,
4347
"Categorize",
@@ -134,4 +138,9 @@ public Expression field() {
134138
public String toString() {
135139
return "Categorize{field=" + field + "}";
136140
}
141+
142+
@Override
143+
public boolean licenseCheck(XPackLicenseState state) {
144+
return MachineLearning.CATEGORIZE_TEXT_AGG_FEATURE.check(state);
145+
}
137146
}

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ public class MachineLearning extends Plugin
525525
License.OperationMode.PLATINUM
526526
);
527527

528-
private static final LicensedFeature.Momentary CATEGORIZE_TEXT_AGG_FEATURE = LicensedFeature.momentary(
528+
public static final LicensedFeature.Momentary CATEGORIZE_TEXT_AGG_FEATURE = LicensedFeature.momentary(
529529
MachineLearningField.ML_FEATURE_FAMILY,
530530
"categorize-text-agg",
531531
License.OperationMode.PLATINUM

0 commit comments

Comments
 (0)