Class AbstractFieldScript

java.lang.Object
org.elasticsearch.script.DocBasedScript
org.elasticsearch.script.AbstractFieldScript
Direct Known Subclasses:
AbstractLongFieldScript, BooleanFieldScript, CompositeFieldScript, DoubleFieldScript, GeometryFieldScript, GeoPointFieldScript, IpFieldScript, StringFieldScript

public abstract class AbstractFieldScript extends DocBasedScript
Abstract base for scripts to execute to build scripted fields. Inspired by AggregationScript but hopefully with less historical baggage.
  • Field Details

    • MAX_VALUES

      public static final int MAX_VALUES
      The maximum number of values a script should be allowed to emit.
      See Also:
    • fieldName

      protected final String fieldName
    • source

      protected final Supplier<Source> source
  • Constructor Details

  • Method Details

    • newContext

      protected static <F> ScriptContext<F> newContext(String name, Class<F> factoryClass)
    • getParams

      public final Map<String,Object> getParams()
      Expose the params of the script to the script itself.
    • extractFromSource

      protected List<Object> extractFromSource(String path)
    • emitFromCompositeScript

      protected final void emitFromCompositeScript(CompositeFieldScript compositeFieldScript)
    • emitValueFromCompositeScript

      protected void emitValueFromCompositeScript(Object value)
    • emitFromObject

      protected abstract void emitFromObject(Object v)
    • emitFromSource

      protected final void emitFromSource()
    • checkMaxSize

      protected final void checkMaxSize(int currentSize)
      Check if the we can add another value to the list of values.
      Parameters:
      currentSize - the current size of the list
    • prepareExecute

      protected abstract void prepareExecute()
    • runForDoc

      public final void runForDoc(int docId)
      Execute the script for the provided docId.
    • execute

      public abstract void execute()