Skip to content

New 8.15.0 range query "format" serialization scheme incompatible to ElasticSearch 8.15.0 #863

Closed
@os-cas

Description

@os-cas

Java API client version

8.15.0

Java version

21.0.3

Elasticsearch Version

8.15.0

Problem description

Hi there,

with the introduction of the new DateRangeQuery.java and UntypedRangeQuery.java the serialization scheme changed in a breaking way, i.e. you can't use a range query format with a 8.15.0 client against a 8.15.0 ElasticSearch.

Before:

"range": {
  "timestampfilter": {
    "boost": 1.0,
    "gte": "2015-01-01T00:00:00.000+0000||/d",
    "lt": "2021-01-01T00:00:00.000+0000||/d",
    "format": "yyyy-MM-dd'T'HH:mm:ss.SSSZZ"
  }
}

After:

"range": {
  "timestampfilter": {
    "boost": 1.0,
    "gte": "2015-01-01T00:00:00.000+0000||/d",
    "lt": "2021-01-01T00:00:00.000+0000||/d"
  },
  "format": "yyyy-MM-dd'T'HH:mm:ss.SSSZZ"
}

Sending the new format in the _search API results in:

{
    "error": {
        "root_cause": [
            {
                "type": "parsing_exception",
                "reason": "[range] query does not support [format]",
                "line": 72,
                "col": 43
            }
        ],
        "type": "x_content_parse_exception",
        "reason": "[72:43] [bool] failed to parse field [filter]",
        "caused_by": {
            "type": "parsing_exception",
            "reason": "[range] query does not support [format]",
            "line": 72,
            "col": 43
        }
    },
    "status": 400
}

I tracked it down to this change and the new serializeInternal method in DateRangeQuery and UntypedRangeQuery:
c605efa#diff-2d69567066997f3f5134ccd95c6544b2775f49e9c18a11cce309d7114117adb1R109

I'd be happy to provide further details where needed or a full request example. Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions