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

Fix issue 2489 #3442

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Fix issue 2489 #3442

wants to merge 2 commits into from

Conversation

penghuo
Copy link
Collaborator

@penghuo penghuo commented Mar 18, 2025

Description

  • Use OpenSearch DateFieldMapper.getDefaultDateTimeFormatter as default format if format is missing.
  • Remove "2015-01-01 12:10:30" related UT, the reaons is not valid OpenSearch date format.
### Create Index
PUT {{baseUrl}}/idx00003
Content-Type: application/x-ndjson

{
  "mappings": {
    "properties": {
      "timestamp": {
        "type":   "date"
      }
    }
  }
}

### Bulk index data
POST {{baseUrl}}/_bulk/
Content-Type: application/x-ndjson

{"index": {"_index": "idx00003"}}
{"timestamp": "2015-01-01 12:10:30"}

### Query Results
{

  "took": 2,
  "errors": true,
  "items": [

    {

      "index": {

        "_index": "idx00003",
        "_id": "wTtUppUBf-E1lLwjwGIJ",
        "status": 400,
        "error": {

          "type": "mapper_parsing_exception",
          "reason": "failed to parse field [timestamp] of type [date] in document with id 'wTtUppUBf-E1lLwjwGIJ'. Preview of field's value: '2015-01-01 12:10:30'",
          "caused_by": {

            "type": "illegal_argument_exception",
            "reason": "failed to parse date field [2015-01-01 12:10:30] with format [strict_date_optional_time||epoch_millis]",
            "caused_by": {

              "type": "date_time_parse_exception",
              "reason": "Failed to parse with all enclosed parsers"
            }
          }
        }
      }
    }
  ]
}

Related Issues

#2489

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Peng Huo <[email protected]>
@penghuo penghuo self-assigned this Mar 18, 2025
Signed-off-by: Peng Huo <[email protected]>
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

Successfully merging this pull request may close these issues.

1 participant