0

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":

details["start_time"] = project_detail.get("start_time", "null")

In this case, I am getting the following error:

***search.BadRequestError: BadRequestError(400, 'mapper_parsing_exception', "failed to parse field [start_time] of type [date] in document with id '1'. Preview of field's value: 'null'")

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

0

1 Answer 1

1

"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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.