Я использую bulk
API для копирования документов с удаленного поиска в локальный.Я хотел бы применить новое отображение.В первой функции я применяю новое отображение, как показано ниже:
def create_mapping(es, idx, document_type):
mymapping = {"mappings": {document_type: { \
"properties": { \
"prijs": {"type": "integer"},\
"datum": {"type": "date"},\
"kilometerstand": {"type": "integer"}
}}}}
if es.indices.exists(index=idx):
es.indices.delete(index=idx)
es.indices.create(index=idx, body=mymapping)
А во второй функции я использую bulk
для копирования документов:
def copy_index(remote_es, local_es, idx):
....
bulk(local_es, response_list, chunk_size=5000)
Но я получаю ошибку:document(s) failed to index
Редактировать
Если добавить несколько двух документов с помощью bulk
, будет показано:
raise BulkIndexError('%i document(s) failed to index.' % len(errors), errors) BulkIndexError: (u'2 document(s) failed to index.', [{u'index': {u'status': 400, u'_type': u'kliks', u'_index': u'logstash-2018.02.07', u'error': {u'caused_by': {u'reason': u'Invalid format: "2018-02-07 01:00:51" is malformed at " 01:00:51"', u'type': u'illegal_argument_exception'}, u'reason': u'failed to parse [datum]', u'type': u'mapper_parsing_exception'}, ....