Skip to content

[BUG] _render Operation is not working in OS_2.11 #3861

@niravpi

Description

@niravpi

What is the bug?
OpenSearch provide support for _render operation which helps to validate stored template, attached reference documents below.

But for OS_2.11 FGAC enabled domains _render operation is not working as it is failing with the following exception

    {
        "type": "security_exception",
        "reason": "Unexpected exception indices:data/read/search/template"
      }

While analyzing further observed that the issue might be related to recent PR

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Create FGAC enabled OS_2.11 domain
  2. Then perform the following operations on the domain
  3. First save search template as a script
POST _scripts/play_search_template
{
  "script": {
    "lang": "mustache",
    "source": {
      "from": "{{from}}{{^from}}0{{/from}}",
      "size": "{{size}}{{^size}}10{{/size}}",
      "query": {
        "match": {
          "play_name": ""
        }
      }
    },
    "params": {
      "play_name": "Henry IV"
    }
  }
}

4.Then try to perform render operation to validate saved template

POST _render/template
{
  "id": "play_search_template",
  "params": {
    "play_name": "Henry IV"
  }
}
  1. See error as below
{
  "error": {
    "root_cause": [
      {
        "type": "security_exception",
        "reason": "Unexpected exception indices:data/read/search/template"
      }
    ],
    "type": "security_exception",
    "reason": "Unexpected exception indices:data/read/search/template"
  },
  "status": 500
}

What is the expected behavior?
render operation should have worked and the output for the above reproduction steps should be as follow instead of exception

{
  "template_output": {
    "from": "0",
    "size": "10",
    "query": {
      "match": {
        "play_name": "Henry IV"
      }
    }
  }
}

What is your host/environment?

  • OpenSearch version OS_2.11

Do you have any screenshots?
Screenshot 2023-12-18 at 3 51 05 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguntriagedRequire the attention of the repository maintainers and may need to be prioritized

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions