Skip to content

[FEATURE] Handle epoch field in string format #2489

@penghuo

Description

@penghuo

Is your feature request related to a problem?
SQL query field if origin date field in string format (epoch value).

A) Create index

PUT sample-index

B) Put index mapping :

PUT /sample-index/_mapping
{
  "properties": {
    "message": {
      "properties":{
        "timestamp_received":{
          "type":"date"
        }
      }
    }
  }
}

Kindly note we have not provided any format (like "strict_date_optional_time" or "epoch_millis") type in above mapping

C) Inserted the doc :

POST sample-index/_doc/1
{
    "message" : {
      "timestamp_received" : "1705642934886"
    }
}

D) Try running SQL query :

POST _plugins/_sql
{
  "query" : "SELECT message.timestamp_received FROM sample-index"
}
{
  "error": {
    "type": "IllegalStateException",
    "reason": "There was internal problem at backend",
    "details": "Construct ExprTimestampValue from \"1705642934886\" failed, unsupported date format."
  },
  "status": 503
}

What solution would you like?
Query should works as epoch value in long format.

What alternatives have you considered?
n/a

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions