private int updateExecutable(DescriptionManager manager, ExecutableRecord exeRecord,
			List<FunctionDescription> badFunctions) throws ElasticException, LSHException {
		JsonObject row = queryMd5ExeMatch(exeRecord.getMd5());
		if (row == null) {
			return -1; // Indicate that we couldn't find the executable
		}
		ExecutableRecord erec_db = makeExecutableRecordTemp(row);
		DescriptionManager dbmanage = new DescriptionManager();
		erec_db = dbmanage.transferExecutable(erec_db);
		ExecutableRecord.Update exe_update = new ExecutableRecord.Update();
		boolean has_exe_update = exeRecord.diffForUpdate(exe_update, erec_db);

		// Load all the functions in the database under this executable
		RowKeyElastic eKey = (RowKeyElastic) erec_db.getRowId();
		String exeId = eKey.generateExeIdString();
		List<FunctionDescription> funclist = new ArrayList<>();
		queryAllFunc(funclist, erec_db, exeId, dbmanage, 0);

		// Create a map from address to executables
		Map<Long, FunctionDescription> addrmap =
			FunctionDescription.createAddressToFunctionMap(funclist.iterator());

		// Match new functions to old functions via the address
		List<FunctionDescription.Update> updatelist;
		updatelist = FunctionDescription.generateUpdates(manager.listFunctions(exeRecord), addrmap,
			badFunctions);

		if (!has_exe_update && updatelist.isEmpty()) {
			return 0; // All updates are in place already
		}

		// Do the actual database updates
		if (has_exe_update) {
			updateExecutable(exe_update, exeId);
		}
		Iterator<FunctionDescription.Update> iter = updatelist.iterator();
		while (iter.hasNext()) {
			updateFunctions(iter, exeId, MAX_FUNCTIONUPDATE_WINDOW);
		}
		int val = has_exe_update ? 1 : 0;
		val += 2 * updatelist.size();
		return val;
	}
Update metadata for the executable -erec- and all its functions (in manager)
@param manager is the collection of functions to update
@param exeRecord is the root executable
@param badFunctions collects references to functions with update info that could not be identified
@return -1 if the executable could not be found, otherwise return 2*# of
        update functions + 1 if the executable metadata is also updated
@throws ElasticException for communication problems with the server
@throws LSHException for problems grouping records
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java