Skip to content

Nest.Time string convertion error for "month" #1880

Closed
@jcaspes

Description

@jcaspes

Hi,

With Elasticsearch.Net 2.0.2.0 and Nest, the Time string convertion do not work for "month" like specified in documentation here: https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units

Here the results from console i have for each documented units:
(new Nest.Time("1y")).Milliseconds give: 31536000000
(new Nest.Time("1M")).Milliseconds give:1 ==> only 1 milliseconds for 1 month !!
(new Nest.Time("1w")).Milliseconds give:604800000
(new Nest.Time("1d")).Milliseconds give:86400000
(new Nest.Time("1h")).Milliseconds give:3600000
(new Nest.Time("1m")).Milliseconds give:60000
(new Nest.Time("1s")).Milliseconds give:1000
(new Nest.Time("1ms")).Milliseconds give:1

Other strange thing, When i use "2M" to define TTL on my mapping it result to a TTL of 120000 (2 minutes), here the code:

esClient.CreateIndex("MyIndex", index => index
    .Mappings(mapping => mapping
        .Map<MyType>(m => m
        // TTL Configuration
            .TtlField(ttl => ttl
                .Enable(true)
                .Default("2M")
            )
        )
    )
);

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