Class ScriptMetadata

org.elasticsearch.script.ScriptMetadata
All Implemented Interfaces:
ClusterState.FeatureAware, Diffable<Metadata.Custom>, Metadata.Custom, NamedDiffable<Metadata.Custom>, NamedWriteable, VersionedNamedWriteable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public final class ScriptMetadata extends implements Metadata.Custom, Writeable, org.elasticsearch.common.xcontent.ToXContentFragment
ScriptMetadata is used to store user-defined scripts as part of the ClusterState using only an id as the key.
  • Field Details

  • Constructor Details

    • ScriptMetadata

      public ScriptMetadata(StreamInput in) throws
      Throws:
  • Method Details

    • fromXContent

      public static ScriptMetadata fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws
      This will parse XContent into ScriptMetadata. The following format will be parsed: { "<id>" : "<{@link StoredScriptSource#fromXContent(XContentParser, boolean)}>", "<id>" : "<{@link StoredScriptSource#fromXContent(XContentParser, boolean)}>", ... } When loading from a source prior to 6.0, if multiple scripts using the old namespace id format of [lang#id] are found to have the same id but different languages an error will occur.
      Throws:
    • readDiffFrom

      public static NamedDiff<Metadata.Custom> readDiffFrom(StreamInput in) throws
      Throws:
    • writeTo

      public void writeTo(StreamOutput out) throws
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      This will write XContent from ScriptMetadata. The following format will be written: { "<id>" : "<{@link StoredScriptSource#toXContent(XContentBuilder, Params)}>", "<id>" : "<{@link StoredScriptSource#toXContent(XContentBuilder, Params)}>", ... }
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
    • diff

      public Diff<Metadata.Custom> diff(Metadata.Custom before)
      Description copied from interface: Diffable
      Returns serializable object representing differences between this and previousState
      Specified by:
      diff in interface Diffable<Metadata.Custom>
    • getWriteableName

      public  getWriteableName()
      Description copied from interface: VersionedNamedWriteable
      Returns the name of the writeable object
      Specified by:
      getWriteableName in interface NamedWriteable
      Specified by:
      getWriteableName in interface VersionedNamedWriteable
    • getMinimalSupportedVersion

      public Version getMinimalSupportedVersion()
      Description copied from interface: VersionedNamedWriteable
      The minimal version of the recipient this object can be sent to
      Specified by:
      getMinimalSupportedVersion in interface VersionedNamedWriteable
    • context

      public <Metadata.XContentContext> context()
      Specified by:
      context in interface Metadata.Custom
    • equals

      public boolean equals( o)
      Overrides:
       in class 
    • hashCode

      public int hashCode()
      Overrides:
       in class 
    • toString

      public  toString()
      Overrides:
       in class