penta
penta

Reputation: 2596

failed to parse date field Elasticsearch

I have an index in elasticsearch 6.2.4, for which i created a new index in new elasticsearch cluster 7.6.1.

I have copied the mapping for this index from 6.2.4 to 7.6.1, but when i tried to _reindex from 6.2.4 to 7.6.1.

I get the below error.

  "failures" : [
{
  "index" : "newindex",
  "type" : "_doc",
  "id" : "someid",
  "cause" : {
    "type" : "mapper_parsing_exception",
    "reason" : "failed to parse field [UPDATES.when] of type [date] in document with id 'someid'. Preview of field's value: '1.528501444E9'",
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "failed to parse date field [1.528501444E9] with format [epoch_second]",
      "caused_by" : {
        "type" : "date_time_parse_exception",
        "reason" : "Failed to parse with all enclosed parsers"
      }
    }
  },
  "status" : 400
}

_reindex call done at 7.6.1's kibana

POST _reindex/?pretty
{
  "source": {
    "remote": {
      "host": "http://oldserver:9200"

    },
    "index": "oldindex",
    "query": {
      "match_all": {}
    }
  },
  "dest": {
    "index": "newindex"
  }
}

Mapping of updates field is same in both places

"UPDATES" : {
          "properties" : {
            "key" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "when" : {
              "type" : "date",
              "format" : "epoch_second"
            }

What am I missing here ?

Upvotes: 2

Views: 2488

Answers (1)

user11935734
user11935734

Reputation:

I guess the timestamp which is appearing in one of your date feild 1.528501444E9 is UNIX timestamp in scientific notation.

But Elasticsearch fails because it can't parse 1.528501444E9 since I suppose as per you exception the format that you have given for this field is epoch_second which does not take this format.

You can read futher related to this format from here https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html

Upvotes: 2

Related Questions