AntonShuvaev/elasticsearch4idea

Add syntax highlighter to the painless scripts.

spaduret opened this issue · 1 comments

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
      """
  }
}

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