Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic_date_formats ignore 'basicDateTimeNoMillis' date format #11260

Closed
PolinaMash opened this issue May 20, 2015 · 1 comment
Closed

dynamic_date_formats ignore 'basicDateTimeNoMillis' date format #11260

PolinaMash opened this issue May 20, 2015 · 1 comment

Comments

@PolinaMash
Copy link

In my app I strongly use dynamic nature of ElasticSearch, but for dates it looks like not working properly. In my app all dates are stored in yyyyMMdd’T'HHmmssZ format, so I simply want dynamic date detection to use basicDateTimeNoMillis format. But neither dynamic_date_formats nor dynamic template for dates doesn't work. Dates are simply ignored and detected as strings. Here is part of mapping for default type:

       "_default_" : {
            "dynamic_date_formats":"basicDateTimeNoMillis",     
            "properties" : {
                "uri" : {
                    "type" : "string"
                },
                "sn" : {
                    "type" : "string"
                },
                "acl" : {
                    "type" : "object"
                }               
            },
            "dynamic_templates": [
                { "date": {
                    "path_match": "*",
                    "match_mapping_type": "date",
                    "mapping": {
                    "type": "date",
                    "format": "basicDateTimeNoMillis"
                }
                }}
            ]
        }

It doesn't work for basicDate also, but works as expected for simple UTC formats like yyyy/MM/dd. Also it works fine if I put date fields description directly to type mapping, like this:

      "DirectoryRepository_Contact" : {
            "properties" : {
                "properties" : {
                    "type" : "object",
                    "properties" : {
                        "bday": {
                            "type": "date",
                            "format": "basicDateTimeNoMillis"
                        }
                    }
                }
            }
        }

So looks like ISO formats are ignored in dynamic_date_formats setting.

@clintongormley
Copy link

Hi @PolinaMash

This is a known issue (see #1694). The problem at the moment is that date-time parsing is not strict enough, so eg 1T could be detected as the year 0001.

We'd like to make this date detection stricter and thus more reliable in 2.0. Here's the issue to track these changes: #10971

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants