Skip to content

[FEATURE] allow keywords like dateTime to be used as field names #672

Closed

Description

@joshuali925

Is your feature request related to a problem?
Create a doc

POST test-index/_doc
{
  "dateTime": "1"
}

see error

POST _plugins/_ppl
{
  "query": "source = test-index | where dateTime = '1'"
}
{
  "error": {
    "reason": "Invalid Query",
    "details": "Failed to parse query due to offending symbol [dateTime] at: 'source = test-index | where dateTime' <--- HERE... More details: Expecting tokens in {'D', 'NOT', 'TRUE', 'FALSE', 'INTERVAL', 'MICROSECOND', 'MILLISECOND', 'SECOND', 'MINUTE', 'HOUR', 'DAY', 'WEEK', 'MONTH', 'QUARTER', 'YEAR', '.', '+', '-', '(', '`', 'AVG', 'COUNT', 'MAX', 'MIN', 'SUM', 'VAR_SAMP', 'VAR_POP', 'STDDEV_SAMP', 'STDDEV_POP', 'FIRST', 'LAST', 'ABS', 'CEIL', 'CEILING', 'CONV', 'CRC32', 'E', 'EXP', 'FLOOR', 'LN', 'LOG', 'LOG10', 'LOG2', 'MOD', 'PI', 'POW', 'POWER', 'RAND', 'ROUND', 'SIGN', 'SQRT', 'TRUNCATE', 'ACOS', 'ASIN', 'ATAN', 'ATAN2', 'COS', 'COT', 'DEGREES', 'RADIANS', 'SIN', 'TAN', 'ADDDATE', 'DATE', 'DATE_ADD', 'DATE_SUB', 'DAYOFMONTH', 'DAYOFWEEK', 'DAYOFYEAR', 'DAYNAME', 'FROM_DAYS', 'MONTHNAME', 'SUBDATE', 'TIME', 'TIME_TO_SEC', 'TIMESTAMP', 'DATE_FORMAT', 'TO_DAYS', 'SUBSTR', 'SUBSTRING', 'LTRIM', 'RTRIM', 'TRIM', 'LOWER', 'UPPER', 'CONCAT', 'CONCAT_WS', 'LENGTH', 'STRCMP', 'RIGHT', 'LEFT', 'ASCII', 'LOCATE', 'REPLACE', 'LIKE', 'ISNULL', 'ISNOTNULL', 'IFNULL', 'NULLIF', 'IF', 'MATCH', 'SPAN', 'MS', 'S', 'M', 'H', 'W', 'Q', 'Y', ID, INTEGER_LITERAL, DECIMAL_LITERAL, DQUOTA_STRING, SQUOTA_STRING, BQUOTA_STRING}",
    "type": "SyntaxCheckException"
  },
  "status": 400
}

What solution would you like?
Possible to allow keywords as field names?

What alternatives have you considered?
A clear and concise description of any alternative solutions or features you've considered.

Do you have any additional context?
Add any other context or screenshots about the feature request here.

Activity

  1. joshuali925 commented on Jun 30, 2022

    @joshuali925
    MemberAuthor

    closing this issue, escaping using backtick on the field works. will open the issue in observability

    POST _plugins/_ppl
    {
      "query": "source = test-index | where `dateTime` = '1'"
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions