The script code here causes errors in the index if the Searcher is set to "Date Time Range Picker" for the custom field which is defined as a "Date Time".
When the database is reindexed the log is flooded with this error:
Attempts to add a new issue fail with "unexpected error" messages.
- Create a new script field with a Template of "Date Time".
- By default, that script is going to have global scope and have a default Searcher of "Free Text Searcher".
- Run background reindex.
- Logs shows this:
Background reindex doesn't seem to clean things up. It requires a locked reindex, which is disruptive in a large system.