Skip to content
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

Range fields are off by one when default values are used #107282

Open
lkts opened this issue Apr 9, 2024 · 1 comment · May be fixed by #107977
Open

Range fields are off by one when default values are used #107282

lkts opened this issue Apr 9, 2024 · 1 comment · May be fixed by #107977
Labels
>bug :StorageEngine/Mapping The storage related side of mappings Team:StorageEngine

Comments

@lkts
Copy link
Contributor

lkts commented Apr 9, 2024

Elasticsearch Version

8.14

Installed Plugins

No response

Java Version

bundled

OS Version

Problem Description

Discovered in #107081 when adding tests.

When one or both ends of range have default values, they are not correctly stored to correspond to user input in case of open ranges.

Steps to Reproduce

PUT idx
{
  "mappings": {
    "properties": {
      "my_range": { "type": "long_range" }
    }
  }
}

Given:

PUT idx/_doc/1
{
  "my_range": {
    "gt": null,
    "lt": 300
  }
}

This query returns a hit even though the range was specified to exclude the start:

POST idx/_search
"query" : {
  "term" : {
      "my_range" : {
      "value": -9223372036854775808
    }
  }
}

While this correctly returns 0 hits:

POST idx/_search
{
  "query" : {
    "term" : {
        "my_range" : {
            "value": 300
        }
    }
  }
}

Logs (if relevant)

No response

@lkts lkts added >bug needs:triage Requires assignment of a team area label Team:StorageEngine :StorageEngine/Mapping The storage related side of mappings labels Apr 9, 2024
@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Apr 9, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@iverase iverase added :Search/Search Search-related issues that do not fall into other categories and removed :Search/Search Search-related issues that do not fall into other categories labels Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :StorageEngine/Mapping The storage related side of mappings Team:StorageEngine
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants