code: def find_uuid(es_url, index):
      
  
      uid_field = None
  
      # Get the first item to detect the data source and raw/enriched type
      res = requests.get('%s/%s/_search?size=1' % (es_url, index))
      first_item = res.json()['hits']['hits'][0]['_source']
      fields = first_item.keys()
  
      if 'uuid' in fields:
          uid_field = 'uuid'
      else:
          # Non perceval backend
          uuid_value = res.json()['hits']['hits'][0]['_id']
          logging.debug("Finding unique id for %s with value %s", index, uuid_value)
          for field in fields:
              if first_item[field] == uuid_value:
                  logging.debug("Found unique id for %s: %s", index, field)
                  uid_field = field
                  break
  
      if not uid_field:
          logging.error("Can not find uid field for %s. Can not copy the index.", index)
          logging.error("Try to copy it directly with elasticdump or similar.")
          sys.exit(1)
  
      return uid_field
docs: Find the unique identifier field for a given index