-
Notifications
You must be signed in to change notification settings - Fork 142
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
[BUG] Queries with date literals fail if date format does not includeepoch_millis
#1847
Comments
2.5AWS currently offers only 2.5 OpenSearch version. SQL plugin there interpret all = (
ReferenseExpression(
dateField,
TIMESTAMP),
cast_to_timestamp(
DateLiteral(
"2002-03-04"
)
)
) Hereby 2.82.8 behaves the same way as 2.5 in that case. It has improvements for named formats, but custom formats are still not supported. 2.9#1821 brings support of custom formats, so {
"from": 0,
"size": 200,
"timeout": "1m",
"query": {
"term": {
"dateField": {
"value": "2002-03-04",
"boost": 1
}
}
},
"_source": {
"includes": [
"dateField"
],
"excludes": []
},
"sort": [
{
"_doc": {
"order": "asc"
}
}
]
} |
D'oh! Thank you for looking into this @Yury-Fridlyand. While my example was problematic, users can still run into this bug if the field has a custom format that can include time. For example, with |
Lines 28 to 29 in f5031a7
Workaround:
Fix: |
What is the bug?
Timestamp literals are always converted to epoch_millis in OpenSearch DSL. This results in OpenSearch exception if the field does not support
epoch_millis
How can one reproduce the bug?
Create an index with this mapping:
Add some data:
Execute SQL query:
Results in OpenSearch error:
What is the expected behavior?
Query work to return one row.
Additional context
The query executes successfully if
format
fordateField
includesepoch_millis
.The text was updated successfully, but these errors were encountered: