Skip to content
Advertisement

How to allow ElasticSearch to accept empty date fields?

I have a Python script that I use to load some data into ElasticSearch.

One of the fields I am loading is a date field, which on some rare occasions can be empty.

In my code, if there is no date, I assign it the string "null":

JavaScript

In this case, I am getting the following error:

JavaScript

How can I make ES accept empty fields for this date field?

Advertisement

Answer

"null" (string) is not the same as null. ES will not be able to parse "null" as a date. You should probably just assign None instead so that the date field will just be missing.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement