Description
Elasticsearch Version
8.14.3
Installed Plugins
No response
Java Version
bundled
OS Version
elastic cloud or Linux 032a394ea0c9 6.6.32-linuxkit #1 SMP Thu Jun 13 14:13:01 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux.
Problem Description
In a range query I am not getting the results I would expect. Please see below for mapping, docs and query details.
Please note: For the sake of simplicity I will leave out data that is irrelevant here.
Steps to Reproduce
I am doing a range query on a field opening_dates
that has this mapping:
{
"opening_dates": {
"type": "date_range",
"format": "yyyy-MM-dd",
}
}
I have exactly one document in the index with that data:
{
"opening_dates": [
{
"gte": "1900-03-01",
"lte": "1900-10-31"
}
]
}
This is the _search
query I am doing:
{
"query": {
"bool": {
"must": [
{
"range": {
"opening_dates": {
"gte": "1900-03-01",
"lte": "1900-10-31",
"relation": "contains",
"format": "yyyy-MM-dd"
}
}
}
]
}
}
}
Expected result: return the indexed document
Actual result: return no document
It would find the document if I change lte
to lt
in the query and this behavior does not apply for the gte
value.
Am I missing something or is this a bug?
Logs (if relevant)
No response