I'm trying to updating my elasticsearch documents with help of python script but after some doc update I got the exception follow:
TransportError(500, u'index_failed_engine_exception', {u'status': 500,
u'error': {u'index': u'catalog', u'root_cause': [{u'index': u'catalog',
u'reason': u'Index failed for [variant#5a61e925ae8bdc45df6939fa]',
u'type': u'index_failed_engine_exception', u'shard': u'3'}],
u'caused_by': {u'reason': u'translog is already closed', u'type':
u'already_closed_exception'}, u'shard': u'3', u'reason': u'Index failed
for [variant#5a61e925ae8bdc45df6939fa]', u'type':
u'index_failed_engine_exception'}})
Please help me to understand why it happens?
Here is my python code:
def updateElasticDoc(sku, facilityId, reason, comment, replaceVariant):
if sku and replaceVariant:
docs = getElasticSearchDoc1(sku, facilityId)
for doc in docs:
docC = doc['_source']
flag = es.update(doc_type='variant', index='catalog',id=docC['facility_variant_id'],
body={"doc": {"replaced_variant": {"pack_type" : replaceVariant['pack_type'],
"pack_size" : replaceVariant['pack_size'],
"drug_strength" : replaceVariant['drug_strength'],
"variant_id" : str(replaceVariant['_id']),
"name" : replaceVariant['name'],
"sku" : replaceVariant['sku']
},
"status": "Retired", "variant_status" : "Retired", "reason" : reason, "variant_reason" : reason, "comment" : comment,
"is_retired" : True, "retired": True}})
if flag:
print (flag)
