async function loadCacheForRepo()

in index.js [143:164]


async function loadCacheForRepo(owner, repo) {
	const { body } = await client.search({
		index: CACHE_INDEX,
		_source: ['page', 'key'],
		size: 10000,
		body: {
			query: {
				bool: {
					filter: [
						{ match: { owner } },
						{ match: { repo } }
					]
				}
			}
		}
	});

	return body.hits.hits.reduce((cache, entry) => {
		cache[entry._source.page] = entry._source.key;
		return cache;
	}, {});
}