Resulting Error while indexing date values in elasticsearch?


(Kartheek Gummaluri) #1

I Have created date_withdrawn filed of type date in mapping.The problem was while I'm bulk indexing in some documents we have date_withdrawn=" " and it is raising the following error.

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "failed to parse [date_withdrawn]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "failed to parse [date_withdrawn]",
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "Invalid format: \"\""
    }
  },
  "status": 400
}

Please find and help me to accept date field with ""


(David Pilato) #2

Please format your code using </> icon. It will make your post more readable.

"" is not a date and is not parseable.

Don't send the date instead of sending an empty field.

But you can change your mapping and use ignore_malformed field. See https://www.elastic.co/guide/en/elasticsearch/reference/5.0/ignore-malformed.html

If you are using elasticsearch 5.0, you can also define an ingest pipeline to parse the date and in case of exception, remove the date field. But it's definitely easier to do that from your source instead of in elasticsearch.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.