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 syntax highlighter to the painless scripts. #126

Open
spaduret opened this issue Aug 15, 2023 · 1 comment
Open

Add syntax highlighter to the painless scripts. #126

spaduret opened this issue Aug 15, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@spaduret
Copy link

Is your feature request related to a problem?

At the moment painless script is not highlighted and rendered as a string:

POST _scripts/test_script
{
  "script": {
    "lang": "painless",
    "source": """
        Debug.explain("test");
      """
  }
}

Same for scripted query:

GET index/_search
{
  "query": {
    "script": {
      "script": {
        "source": """
          doc['field'].value > 0;
        """
      }
    }
  }
}

Describe the solution you'd like

Would like to have a syntax highlighter added to the painless scripts. At least what is available in Kibana.

Also, it would be great to have a code-completion feature, at least for JAVA namespaces.

Additional context

Code completion can be added also to document reference using index mapping. I understand that it might be hard to calculate the context, but this can 100% work in runtime_mappings and stored scripts (just need to connect with an index somehow).

POST _scripts/test_script
{
  "script": {
    "lang": "painless",
    "source": """
        ctx._source... // here can use index mapping
      """
  }
}
@spaduret spaduret added the enhancement New feature or request label Aug 15, 2023
@AntonShuvaev
Copy link
Owner

Thank you for the suggestion. I'll consider implementing this in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants