Skip to content

date_detection not working with not_analyzed fields #17012

@palmerabollo

Description

@palmerabollo

Elasticsearch version: 2.2.0

JVM version: Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

OS version: OSX 10.11.1

Description of the problem including expected versus actual behavior:

If you enable both date_detection: true and index: not_analyzed in a dynamic template, dates are not detected.

Steps to reproduce:

  1. Create a template with a PUT to _template/reproducebug and the following body (date_detection: true and index:not_analyzed):
{
    "template": "*",
    "mappings": {
        "_default_": {
            "date_detection": true,
            "_all": {
                "enabled": false
            },
            "dynamic_templates": [
                {
                    "template1": {
                        "mapping": {
                            "index": "not_analyzed",
                            "type": "{dynamic_type}"
                        },
                        "match": "*"
                    }
                }
            ],
            "properties": {
                "msg": {
                    "type": "string",
                    "index": "analyzed"
                }
            }
        }
    }
}
  1. Index the following document, that contains a ISO8601 date: {"foo":"bar", "time":"2016-03-08T09:52:09.097Z"}
  2. Check that the field time is indexed as a not_analyzed string.

Provide logs (if relevant):
No relevant logs.

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