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

Ingest Date Processor does not apply the Locale parameter #25513

Closed
dadoonet opened this issue Jul 3, 2017 · 2 comments
Closed

Ingest Date Processor does not apply the Locale parameter #25513

dadoonet opened this issue Jul 3, 2017 · 2 comments
Labels
>bug :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP

Comments

@dadoonet
Copy link
Member

dadoonet commented Jul 3, 2017

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"
        }
      }
    }
  ]
}
@dadoonet dadoonet added :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >bug labels Jul 3, 2017
@dadoonet
Copy link
Member Author

dadoonet commented Jul 3, 2017

It's confirmed as per #25515 that the locale in mapping is defined as fr and not FRENCH.
Isn't that strange that we don't use the same definition for a Locale for different APIs?

@talevy
Copy link
Contributor

talevy commented Mar 15, 2018

Fixed in #27089

@talevy talevy closed this as completed Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP
Projects
None yet
Development

No branches or pull requests

2 participants