我有时会在扫描文档进行导出时收到此错误:
elasticsearch_dsl.exceptions:ValidationException:
Could not parse date from the value (u'2016-11-03T21:46:09.278914+00:00')
回溯:
File "/usr/local/lib/python2.7/dist-packages/elasticsearch_dsl/search.py", line 666, in scan
File "/usr/local/lib/python2.7/dist-packages/elasticsearch_dsl/document.py", line 216, in from_es
File "/usr/local/lib/python2.7/dist-packages/elasticsearch_dsl/document.py", line 108, in __init__
File "/usr/local/lib/python2.7/dist-packages/elasticsearch_dsl/utils.py", line 339, in __init__
File "/usr/local/lib/python2.7/dist-packages/elasticsearch_dsl/field.py", line 76, in deserialize
File "/usr/local/lib/python2.7/dist-packages/elasticsearch_dsl/field.py", line 224, in _deserialize
使用:
任何想法为什么以及如何解决它?
修改:解析日期有效,如下面的示例中所示,取自官方elasticsearch_dls repo https://github.com/elastic/elasticsearch-dsl-py/blob/master/elasticsearch_dsl/field.py#L222:
from dateutil import parser
x = '2016-11-03T21:46:09.278914+00:00'
print parser.parse(x) # will output 2016-11-03 21:46:09.278914+00:00