Link Search Menu Expand Document Documentation Menu

You're viewing version 2.17 of the OpenSearch documentation. This version is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.

Get stored script contexts

Introduced 1.0

Retrieves all contexts for stored scripts.

Example request

GET _script_context

Example response

The GET _script_context request returns the following fields:

{
  "contexts" : [
    {
      "name" : "aggregation_selector",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "boolean",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "aggs",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "java.lang.Object",
          "params" : [ ]
        },
        {
          "name" : "getDoc",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "get_score",
          "return_type" : "java.lang.Number",
          "params" : [ ]
        },
        {
          "name" : "get_value",
          "return_type" : "java.lang.Object",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "aggs_combine",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "java.lang.Object",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getState",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "aggs_init",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "void",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getState",
          "return_type" : "java.lang.Object",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "aggs_map",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "void",
          "params" : [ ]
        },
        {
          "name" : "getDoc",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getState",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "get_score",
          "return_type" : "double",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "aggs_reduce",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "java.lang.Object",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getStates",
          "return_type" : "java.util.List",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "analysis",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "boolean",
          "params" : [
            {
              "type" : "org.opensearch.analysis.common.AnalysisPredicateScript$Token",
              "name" : "token"
            }
          ]
        }
      ]
    },
    {
      "name" : "bucket_aggregation",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "java.lang.Number",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "field",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "java.lang.Object",
          "params" : [ ]
        },
        {
          "name" : "getDoc",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "filter",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "boolean",
          "params" : [ ]
        },
        {
          "name" : "getDoc",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "ingest",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "void",
          "params" : [
            {
              "type" : "java.util.Map",
              "name" : "ctx"
            }
          ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "interval",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "boolean",
          "params" : [
            {
              "type" : "org.opensearch.index.query.IntervalFilterScript$Interval",
              "name" : "interval"
            }
          ]
        }
      ]
    },
    {
      "name" : "moving-function",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "double",
          "params" : [
            {
              "type" : "java.util.Map",
              "name" : "params"
            },
            {
              "type" : "double[]",
              "name" : "values"
            }
          ]
        }
      ]
    },
    {
      "name" : "number_sort",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "double",
          "params" : [ ]
        },
        {
          "name" : "getDoc",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "get_score",
          "return_type" : "double",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "painless_test",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "java.lang.Object",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "processor_conditional",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "boolean",
          "params" : [
            {
              "type" : "java.util.Map",
              "name" : "ctx"
            }
          ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "score",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "double",
          "params" : [
            {
              "type" : "org.opensearch.script.ScoreScript$ExplanationHolder",
              "name" : "explanation"
            }
          ]
        },
        {
          "name" : "getDoc",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "get_score",
          "return_type" : "double",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "script_heuristic",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "double",
          "params" : [
            {
              "type" : "java.util.Map",
              "name" : "params"
            }
          ]
        }
      ]
    },
    {
      "name" : "similarity",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "double",
          "params" : [
            {
              "type" : "double",
              "name" : "weight"
            },
            {
              "type" : "org.opensearch.index.similarity.ScriptedSimilarity$Query",
              "name" : "query"
            },
            {
              "type" : "org.opensearch.index.similarity.ScriptedSimilarity$Field",
              "name" : "field"
            },
            {
              "type" : "org.opensearch.index.similarity.ScriptedSimilarity$Term",
              "name" : "term"
            },
            {
              "type" : "org.opensearch.index.similarity.ScriptedSimilarity$Doc",
              "name" : "doc"
            }
          ]
        }
      ]
    },
    {
      "name" : "similarity_weight",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "double",
          "params" : [
            {
              "type" : "org.opensearch.index.similarity.ScriptedSimilarity$Query",
              "name" : "query"
            },
            {
              "type" : "org.opensearch.index.similarity.ScriptedSimilarity$Field",
              "name" : "field"
            },
            {
              "type" : "org.opensearch.index.similarity.ScriptedSimilarity$Term",
              "name" : "term"
            }
          ]
        }
      ]
    },
    {
      "name" : "string_sort",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "java.lang.String",
          "params" : [ ]
        },
        {
          "name" : "getDoc",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "get_score",
          "return_type" : "double",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "template",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "java.lang.String",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "terms_set",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "java.lang.Number",
          "params" : [ ]
        },
        {
          "name" : "getDoc",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "trigger",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "boolean",
          "params" : [
            {
              "type" : "org.opensearch.alerting.script.QueryLevelTriggerExecutionContext",
              "name" : "ctx"
            }
          ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    },
    {
      "name" : "update",
      "methods" : [
        {
          "name" : "execute",
          "return_type" : "void",
          "params" : [ ]
        },
        {
          "name" : "getCtx",
          "return_type" : "java.util.Map",
          "params" : [ ]
        },
        {
          "name" : "getParams",
          "return_type" : "java.util.Map",
          "params" : [ ]
        }
      ]
    }
  ]
}

Response body fields

The GET _script_context request returns the following response fields:

Field Data type Description
contexts List A list of all contexts. See Script object.

Script context

Field Data type Description
name String The context name.
methods List List of the context’s allowable methods. See Script object.

Context methods

Field Data type Description
name String Method name.
name String Type that the method returns (boolean, object, number, and so on).
params List List of the parameters accepted by the method. See Script object.

Method parameters

Field Data type Description
type String Parameter data type.
name String Parameter name.
350 characters left

Have a question? .

Want to contribute? or .