Class AbstractFieldScript

org.elasticsearch.script.AbstractFieldScript
Direct Known Subclasses:
AbstractLongFieldScript, BooleanFieldScript, DoubleFieldScript, IpFieldScript, StringFieldScript

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

    Fields
    Modifier and Type
    Field
    Description
    protected
     
     
    static int
    The maximum number of values a script should be allowed to emit.
  • Constructor Summary

    Constructors
    Constructor
    Description
     fieldName, <,​> params, SearchLookup searchLookup, org.apache.lucene.index.LeafReaderContext ctx)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    checkMaxSize​(int currentSize)
    Check if the we can add another value to the list of values.
    protected abstract void
     v)
     
    protected void
     
    abstract void
     
    protected <>
     path)
     
    Expose field data to the script as doc.
    <,​>
    Expose the params of the script to the script itself.
    void
    setDocument​(int docId)
    Set the document to run the script against.

    Methods inherited from class java.lang.

    , , , , , , , , , ,
  • Field Details

    • MAX_VALUES

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

      protected final  fieldName
    • leafSearchLookup

      protected final LeafSearchLookup leafSearchLookup
  • Constructor Details

    • AbstractFieldScript

      public AbstractFieldScript( fieldName, <,​> params, SearchLookup searchLookup, org.apache.lucene.index.LeafReaderContext ctx)
  • Method Details

    • setDocument

      public final void setDocument(int docId)
      Set the document to run the script against.
    • getParams

      public final <,​> getParams()
      Expose the params of the script to the script itself.
    • getDoc

      public final <,​ScriptDocValues<?>> getDoc()
      Expose field data to the script as doc.
    • extractFromSource

      protected <> extractFromSource( path)
    • emitFromObject

      protected abstract void emitFromObject( 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
    • execute

      public abstract void execute()