Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more contexts to painless execute api #30511

Merged

Commits on May 22, 2018

  1. [Painless] Add more contexts to painless execute api

    This change adds two contexts the execute scripts against:
    
    * SEARCH_SCRIPT: Allows to run scripts in a search script context.
    This context is used in `function_score` query's script function,
    script fields, script sorting and `terms_set` query.
    
    * FILTER_SCRIPT: Allows to run scripts in a filter script context.
    This context is used in the `script` query.
    
    In both contexts a index name needs to be specified and a sample document.
    The document is needed to create an in-memory index that the script can
    access via the `doc[...]` and other notations. The index name is needed
    because a mapping is needed to index the document.
    
    Examples:
    
    ```
    POST /_scripts/painless/_execute
    {
      "script": {
        "source": "doc['field'].value.length()"
      },
      "context" : {
        "search_script": {
          "document": {
            "field": "four"
          },
          "index": "my-index"
        }
      }
    }
    ```
    
    Returns:
    
    ```
    {
      "result": 4
    }
    ```
    
    POST /_scripts/painless/_execute
    {
      "script": {
        "source": "doc['field'].value.length() <= params.max_length",
        "params": {
          "max_length": 4
        }
      },
      "context" : {
        "filter_script": {
          "document": {
            "field": "four"
          },
          "index": "my-index"
        }
      }
    }
    
    Returns:
    
    ```
    {
      "result": true
    }
    ```
    martijnvg committed May 22, 2018
    Configuration menu
    Copy the full SHA
    3e78138 View commit details
    Browse the repository at this point in the history

Commits on May 23, 2018

  1. Configuration menu
    Copy the full SHA
    e86764a View commit details
    Browse the repository at this point in the history
  2. changed PainlessExecuteAction.TransportAction to use TransportSingleS…

    …hardAction
    
    instead of HandledAction, because now in case score or filter contexts are used
    the request needs to be redirected to a node that has an active IndexService
    for the index being referenced (a node with a shard copy for that index).
    martijnvg committed May 23, 2018
    Configuration menu
    Copy the full SHA
    d965597 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2018

  1. Configuration menu
    Copy the full SHA
    636ad34 View commit details
    Browse the repository at this point in the history
  2. rename

    martijnvg committed May 24, 2018
    Configuration menu
    Copy the full SHA
    539abde View commit details
    Browse the repository at this point in the history
  3. fixed typo

    martijnvg committed May 24, 2018
    Configuration menu
    Copy the full SHA
    7bc755c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    65bbaf8 View commit details
    Browse the repository at this point in the history

Commits on May 25, 2018

  1. Configuration menu
    Copy the full SHA
    f82c307 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fd3fb41 View commit details
    Browse the repository at this point in the history
  3. fixed docs

    martijnvg committed May 25, 2018
    Configuration menu
    Copy the full SHA
    caf6f26 View commit details
    Browse the repository at this point in the history
  4. fixed docs for real

    martijnvg committed May 25, 2018
    Configuration menu
    Copy the full SHA
    6da0dc7 View commit details
    Browse the repository at this point in the history

Commits on Jul 4, 2018

  1. Configuration menu
    Copy the full SHA
    e3437cf View commit details
    Browse the repository at this point in the history
  2. iter

    martijnvg committed Jul 4, 2018
    Configuration menu
    Copy the full SHA
    95300fe View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f3eab3f View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3afa5d0 View commit details
    Browse the repository at this point in the history

Commits on Jul 18, 2018

  1. Configuration menu
    Copy the full SHA
    9b3b67e View commit details
    Browse the repository at this point in the history