Skip to content

Ingest Date Processor does not apply the Locale parameter #25513

@dadoonet

Description

@dadoonet

I came to this while working on a discuss problem

Here is a recreation script (tested on 5.4.2):

POST _ingest/pipeline/_simulate
{
  "pipeline": {
    "processors": [
      {
        "date": {
          "field": "date",
          "locale": "FRENCH",
          "formats": [
            "MMM y"
          ]
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
        "date": "May 2017"
      }
    },
    {
      "_source": {
        "date": "Mai 2017"
      }
    }
  ]
}

First date is in english and the second one is in french.
It gives:

{
  "docs": [
    {
      "doc": {
        "_index": "_index",
        "_type": "_type",
        "_id": "_id",
        "_source": {
          "date": "May 2017",
          "@timestamp": "2017-05-01T00:00:00.000Z"
        },
        "_ingest": {
          "timestamp": "2017-07-03T10:15:05.671Z"
        }
      }
    },
    {
      "error": {
        "root_cause": [
          {
            "type": "exception",
            "reason": "java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: unable to parse date [Mai 2017]",
            "header": {
              "processor_type": "date"
            }
          }
        ],
        "type": "exception",
        "reason": "java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: unable to parse date [Mai 2017]",
        "caused_by": {
          "type": "illegal_argument_exception",
          "reason": "java.lang.IllegalArgumentException: unable to parse date [Mai 2017]",
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "unable to parse date [Mai 2017]",
            "caused_by": {
              "type": "illegal_argument_exception",
              "reason": """Invalid format: "Mai 2017""""
            }
          }
        },
        "header": {
          "processor_type": "date"
        }
      }
    }
  ]
}

Where I'd expect the opposite as I defined the locale "FRENCH". Note that I tried other locales like fr but then all docs are failing which makes me think that FRENCH was the right option to use. Kibana Console proposed for this field "ENGLISH" as the default.

{
  "docs": [
    {
      "error": {
        "root_cause": [
          {
            "type": "exception",
            "reason": "java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: unable to parse date [May 2017]",
            "header": {
              "processor_type": "date"
            }
          }
        ],
        "type": "exception",
        "reason": "java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: unable to parse date [May 2017]",
        "caused_by": {
          "type": "illegal_argument_exception",
          "reason": "java.lang.IllegalArgumentException: unable to parse date [May 2017]",
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "unable to parse date [May 2017]",
            "caused_by": {
              "type": "illegal_argument_exception",
              "reason": """Invalid format: "May 2017""""
            }
          }
        },
        "header": {
          "processor_type": "date"
        }
      }
    },
    {
      "error": {
        "root_cause": [
          {
            "type": "exception",
            "reason": "java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: unable to parse date [Mai 2017]",
            "header": {
              "processor_type": "date"
            }
          }
        ],
        "type": "exception",
        "reason": "java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: unable to parse date [Mai 2017]",
        "caused_by": {
          "type": "illegal_argument_exception",
          "reason": "java.lang.IllegalArgumentException: unable to parse date [Mai 2017]",
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "unable to parse date [Mai 2017]",
            "caused_by": {
              "type": "illegal_argument_exception",
              "reason": """Invalid format: "Mai 2017""""
            }
          }
        },
        "header": {
          "processor_type": "date"
        }
      }
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions