Skip to content

Anchored DateMath no longer serializes time zone information for local DateTime #3899

Closed
@jonyadamit

Description

@jonyadamit

NEST/Elasticsearch.Net version:
7.0.0
Elasticsearch version:
7.2.0
Description of the problem including expected versus actual behavior:
Given the query

var result = client.Search<object>(s => s
                .Index("test")
                .Query(q => q
                    .DateRange(dr => dr
                        .GreaterThanOrEquals(DateTime.Now)
                        .Field("some_field"))));

Nest 6.8.0 generates the following query: (my local time is UTC + 3)
{"query":{"range":{"some_field":{"gte":"2019-07-01T17:16:18.1266967+03:00"}}}}

Nest 7.0.0 generates the following query:
{"query":{"range":{"some_field":{"gte":"2019-07-01T17:16:18.1266967"}}}}

As a workaround for now I guess I have to either manually convert dates to UTC or add the TimeZone property (either of which adds unnecessary complexity).

Metadata

Metadata

Assignees

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