TypeScript で elastic cloud に接続する方法のメモ。
import { Client } from '@elastic/elasticsearch'; (async () => { const client = new Client({ node: '{ノード (https://...)}', cloud: { id: '{Cloud ID}' }, auth: { username: '{ユーザ名}', password: '{パスワード}', } }); const cond = { index: '...', query: { match_all: {} }, size: 10 }; const res = await client.search(cond); console.log(res); })();