-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Description
Elasticsearch version (bin/elasticsearch --version
): OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Version: 7.6.1, Build: default/docker/aa751e09be0a5072e8570670309b1f12348f023b/2020-02-29T00:15:25.529771Z, JVM: 13.0.2
Plugins installed: []
JVM version (java -version
): openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.2+8)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.2+8, mixed mode, sharing)
OS version (uname -a
if on a Unix-like system): Linux ad9271944652 4.19.76-linuxkit #1 SMP Thu Oct 17 19:31:58 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Error is returned when attempting to create a filtered alias that uses a range, with a data_nanos field, using now, and a negative offset (such as now-7d)
This error does not appear when using date fields or when using positive offsets (such as now+7d)
Steps to reproduce:
- Create index with date_nanos field
PUT date_source
{
"mappings": {
"properties": {
"date": {
"type": "date"
},
"date_nanos": {
"type": "date_nanos"
}
}
}
}
- Create a filtered alias, filtering data_nanos field using negative offset (now-7d/d)
PUT date_source/_alias/date_nanos_alias
{
"filter": {
"range": {
"date_nanos": {
"gt": "now-7d/d"
}
}
}
}
- Receive an error:
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "failed to parse filter for alias [date_nanos_alias]"
}
],
"type" : "illegal_argument_exception",
"reason" : "failed to parse filter for alias [date_nanos_alias]",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "date[1969-12-25T23:59:59.999Z] is before the epoch in 1970 and cannot be stored in nanosecond resolution"
}
},
"status" : 400
}
Activity
elasticmachine commentedon Mar 27, 2020
Pinging @elastic/es-search (:Search/Search)
elasticmachine commentedon Mar 27, 2020
Pinging @elastic/es-core-features (:Core/Features/Indices APIs)
gaobinlong commentedon Mar 31, 2020
This issue maybe originated from this line in
MetaDataIndexAliasesService
:elasticsearch/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexAliasesService.java
Line 154 in 5a98fc2
nowInMillis
is set to 0 inQueryShardContext
.jimczi commentedon Mar 31, 2020
This is correct @gaobinlong thanks for looking. Would you like to provide a pull request to fix this since you already found the issue ?
gaobinlong commentedon Apr 1, 2020
@jimczi I'm glad to do that.
Fix creating filtered alias using now in a date_nanos range query fai…
Fix creating filtered alias using now in a date_nanos range query fai…