Skip to content

[BUG] SQL query doesn't support different date formats without date casting #2700

@rupal-bq

Description

@rupal-bq

What is the bug?
Getting below error for user defined date format

"{\n  \"error\": {\n    \"reason\": \"Invalid SQL query\",\n    \"details\": \"date:03-Jan-24 in unsupported format, please use 'yyyy-MM-dd'\",\n    \"type\": \"SemanticCheckException\"\n  },\n  \"status\": 400\n}"

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

PUT testindex
{
  "mappings" : {
    "properties" :  {
      "release_date" : {
        "type" : "date",
        "format" : "dd-MMM-yy"
      }
    }
  }
}
PUT testindex/_doc/21 
{
  "release_date" : "03-Jan-24"
}
POST _plugins/_sql
{
"query":"select release_date from testindex where release_date='03-Jan-24'"
}

What is the expected behavior?
Query should work without date casting

What is your host/environment?

  • OS: [e.g. iOS]
  • Version [e.g. 22]
  • Plugins

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
Add any other context about the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv2.16.0Issues targeting release v2.16.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions