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

[Console] Still unable to submit valid request bodies, 400 Bad Request Illegal unquoted character, this time for template variables with defaults #201965

Closed
MichaelRisthausSVA opened this issue Nov 27, 2024 · 2 comments
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more

Comments

@MichaelRisthausSVA
Copy link

MichaelRisthausSVA commented Nov 27, 2024

Kibana version: 8.16.1

Elasticsearch version: 8.16.1

Server OS version: Running in docker container

Browser version: All browsers affected

Browser OS version: win11

Original install method (e.g. download page, yum, from source, etc.): elk container bundle

Describe the bug: In followup to issue #200201 I still have the exact same problem with default values for query template variables. Something like ´{{var}}{{^var}}default value{{/var}}` leads to exact the same error as described in #200201, although I updated my local environment to 8.16.1. As soon as I put an circumflex ^ or a forward slash / in the query template, the parsing error still occurs:

"error": {
    "root_cause": [
      {
        "type": "x_content_parse_exception",
        "reason": "[36:26] [stored script source] failed to parse field [source]"
      }
    ],
    "type": "x_content_parse_exception",
    "reason": "[36:26] [stored script source] failed to parse field [source]",
    "caused_by": {
      "type": "unchecked_i_o_exception",
      "reason": """com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value
 at [Source: (byte[])"{
[...]

Steps to reproduce:

  1. Use elastic/kibaba 8.16.1
  2. create a query tempate with default values for parameters
PUT _scripts/flight-search-template
{
  "script": {
    "lang": "mustache",
    "source": {
      "from": 3,
      "size": 10,
      "fields": [
        "OriginCountry",
        "DestCountry",
        "DestWeather",
        "OriginWeather",
        "DistanceMiles",
        "timestamp",
        "Dest"
      ],
      "_source": false,
      "highlight": {
        "fields": {
          "Dest": {
            "pre_tags": "<strong>",
            "post_tags": "</strong>"
          }
        }
      },
      "query": {
        "bool": {
          "must": [
            {
              "match": {
                "Dest": "{{query_item}}"
              }
            },
            {
              "range": {
                "timestamp": {
                  "gte": "{{start-date}}{{^start-date}}2024-01-01T00:00:00{{/start-date}}",
                  "lte": "{{end-date}}{{^end-date}}now{{/end-date}}"
                }
              }
            }
          ],
          "must_not": [
            {
              "match": {
                "OriginWeather": "Rain"
              }
            }
          ],
          "should": [
            {
              "match": {
                "DestWeather": "Sunny"
              }
            }
          ]
        }
      },
      "sort": [
        {
          "timestamp": "desc"
        }
      ]
    }
  }
}

Expected behavior:

Query template should be accepted as it is (and as eg elastic 8.13.3 does)

Screenshots (if relevant): n/a

Errors in browser console (if relevant): n/a

Provide logs and/or server output (if relevant): n/a

Any additional context: n/a

@MichaelRisthausSVA MichaelRisthausSVA added the bug Fixes for quality problems that affect the customer experience label Nov 27, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Nov 27, 2024
@jsanz jsanz added the Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more label Nov 29, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Nov 29, 2024
@sabarasaba sabarasaba self-assigned this Dec 2, 2024
@sabarasaba
Copy link
Member

We missed the 8.16.1 by just a few days which is why you are still not seeing the change there, it will be included in 8.16.2. I double checked your example and seems to work:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet
Development

No branches or pull requests

4 participants