Skip to content

TimeUnit week ("w") inconsistency #2818

@lekrus

Description

@lekrus

Hello,

In the latest NEST (5.5) and Elasticsearch (5.5):
Trying to use TimeUnit as in the code below:

.ExponentialDate(gd => gd
     .Field("update_date")
     .Origin(DateMath.Now)
     .Offset(TimeSpan.FromDays(60))

Offset expects Time type.
When I specify Offset("60d") above the query works fine, as "d" is supported by Elasticsearch.
When I specify Offset(TimeSpan.FromDays(60)), NEST transforms that to the following JSON:

"exp": {
    "update_date": {
    "origin": "now",
    "scale": "8.57142857142857w"

and as soon as "w" (week) seems like not supported for TimeUnits the exception is thrown.

Supported TimeUnits:
https://www.elastic.co/guide/en/elasticsearch/reference/5.5/common-options.html#time-units
NEST Time:
https://www.elastic.co/guide/en/elasticsearch/client/net-api/5.x/time-units.html

Please update, thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions