[BUG] Range queries are inconsistent with documentation
Describe the bug Using opensearch-rest-high-level-client 1.2.0 in java code behaves differently as compared to range query documentation. Using the following code:
boolQueryBuilder.filter(QueryBuilders.rangeQuery("created_at").gte(startDate).lte(endDate));
The query is created as
"filter": [
{
"range": {
"created_at": {
"from": "2022-11-07",
"to": "2023-02-07",
"include_lower": true,
"include_upper": true,
"boost": 1
}
}
}
Expected behavior
Should it be creating as gte and lte ?
Plugins N/A
Screenshots If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
- OS: OpenSearch 1.1 (Amazon opensearch service)
Is this fixed/changed in main? Or with opensearch-java?
@dblock I believe those are equivalent:
"filter": [
{
"range": {
"created_at": {
"gte": "2022-11-07",
"lte": "2023-02-07",
"boost": 1
}
}
}
The gte and lte are transformed to to / from, include_lower / include_upper. Both queries are valid.
@prudhvigodithi If @reta is correct, is this still an issue?
I do feel like if I use gte I'd expect to see gte, and if I use to I'd expect to :)
Hey @reta thanks for clarifying, ya since i used gte in code it should show as gte in the result query, but as long both the queries are valid I'm good, should we consider updating the documentation ?
@dblock @bbarani
should we consider updating the documentation ?
@prudhvigodithi We could add more examples I believe
I can create a PR in documentation website with this example.