All Implemented Interfaces:
NamedWriteable, Writeable, Resolvable, EvaluatorMapper, ConvertFunction

public class ToText extends AbstractConvertFunction implements EvaluatorMapper
Converts a value to an expression of type TEXT. This is different from the ToString function, which converts to KEYWORD. TEXT and KEYWORD data types are treated in ES|QL almost the same, the main difference is that TEXT is considered to be analyzed, while KEYWORD is not. This matters for functions like Match which will treat these data types differently.
  • Field Details

  • Constructor Details

  • Method Details

    • getWriteableName

      public String getWriteableName()
      Specified by:
      getWriteableName in interface NamedWriteable
    • factories

      Description copied from class: AbstractConvertFunction
      A map from input type to ExpressionEvaluator ctor. Usually implemented like:
      
           private static final Map<DataType, BuildFactory> EVALUATORS = Map.ofEntries(
               Map.entry(BOOLEAN, (field, source) -> field),
               Map.entry(KEYWORD, ToBooleanFromStringEvaluator.Factory::new),
               ...
           );
      
           @Override
           protected Map<DataType, BuildFactory> factories() {
               return EVALUATORS;
           }
       
      Specified by:
      factories in class AbstractConvertFunction
    • dataType

      public DataType dataType()
      Description copied from class: Expression
      The DataType returned by executing the tree rooted at this expression. If Expression.typeResolved() returns an error then the behavior of this method is undefined. It may return a valid type. Or it may throw an exception. Or it may return a totally nonsensical type.
      Overrides:
      dataType in class UnaryScalarFunction
    • replaceChildren

      public Expression replaceChildren(List<Expression> newChildren)
      Specified by:
      replaceChildren in class Node<Expression>
    • info

      protected NodeInfo<? extends Expression> info()
      Description copied from class: Node
      Normally, you want to use one of the static create methods to implement this.

      For QueryPlans, it is very important that the properties contain all of the expressions and references relevant to this node, and that all the properties are used in the provided constructor; otherwise query plan transformations like QueryPlan#transformExpressionsOnly(Function) will not have an effect.

      Specified by:
      info in class Node<Expression>