Kolesar
Kolesar

Reputation: 1283

Elasticsearch do not want to accept null for date

My Index looks like:

      "valid_to": {
        "type": "date",
        "null_value": "null",
        "format": "date_time"
      }

But when I want to index my data and some data does not have a date I get error exception instead to accept it as null.

"reason":"failed to parse [valid_from]","caused_by":{"type":"illegal_argument_exception","reason":"Invalid format: \"\""}}

Any hint, please?

Upvotes: 0

Views: 53

Answers (1)

Val
Val

Reputation: 217274

You need to add the ignore_malformed parameter (false by default), like this:

  "valid_to": {
    "type": "date",
    "null_value": "null",
    "format": "date_time",
    "ignore_malformed": true
  }

Or make sure to either always send a valid date or null

Upvotes: 1

Related Questions