code: def get_last_doc(self):
          
          try:
              result = self.elastic.search(
                  index=self.meta_index_name,
                  body={
                      "query": {"match_all": {}},
                      "sort": [{"_ts": "desc"}],
                  },
                  size=1
              )["hits"]["hits"]
              for r in result:
                  r['_source']['_id'] = r['_id']
                  return r['_source']
          except es_exceptions.RequestError:
              # no documents so ES returns 400 because of undefined _ts mapping
              return None
docs: Get the most recently modified document from Elasticsearch.
  
          This method is used to help define a time window within which documents
          may be in conflict after a MongoDB rollback.