{"id":47475,"library":"elasticsearch-store","title":"Elasticsearch Index Manager with Migration Support","description":"elasticsearch-store (v2.11.1) is a TypeScript library for managing Elasticsearch indices with versioning and migration support. It provides a structured API to create, update, and migrate indices, ensuring schema evolution over time. Released under the Terascope organization, it targets Node.js >=22 and pnpm >=11.3. Key differentiators include built-in migration handling, type-safe index management, and integration with the Teraslice ecosystem. Maintained actively with a focus on reliability.","status":"active","version":"2.11.1","language":"javascript","source_language":"en","source_url":"git@github.com:terascope/teraslice","tags":["javascript","typescript"],"install":[{"cmd":"npm install elasticsearch-store","lang":"bash","label":"npm"},{"cmd":"yarn add elasticsearch-store","lang":"bash","label":"yarn"},{"cmd":"pnpm add elasticsearch-store","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Official Elasticsearch client for Node.js","package":"@elastic/elasticsearch","optional":false}],"imports":[{"note":"ESM-only since v2. Default export not available.","wrong":"const IndexStore = require('elasticsearch-store')","symbol":"IndexStore","correct":"import { IndexStore } from 'elasticsearch-store'"},{"note":"Named export, not default.","wrong":"import Migration from 'elasticsearch-store'","symbol":"Migration","correct":"import { Migration } from 'elasticsearch-store'"},{"note":"Use type import for TypeScript interfaces.","wrong":"import { StoreConfig } from 'elasticsearch-store'","symbol":"StoreConfig","correct":"import type { StoreConfig } from 'elasticsearch-store'"}],"quickstart":{"code":"import { Client } from '@elastic/elasticsearch';\nimport { IndexStore } from 'elasticsearch-store';\n\nasync function main() {\n  const client = new Client({ node: process.env.ELASTICSEARCH_URL ?? 'http://localhost:9200' });\n  const store = new IndexStore(client, {\n    name: 'my-index',\n    version: 1,\n    mappings: {\n      properties: {\n        name: { type: 'text' },\n        age: { type: 'integer' }\n      }\n    }\n  });\n  await store.initialize();\n  await store.indexDocument({ name: 'John', age: 30 });\n  const doc = await store.getDocument('some-id');\n  console.log(doc);\n}\nmain().catch(console.error);","lang":"typescript","description":"Initializes an IndexStore with client, defines mapping and version, creates index, indexes a document, and retrieves it."},"warnings":[{"fix":"Upgrade Node.js to v22+ and pnpm to v11.3+.","message":"Requires Node.js >=22.0.0 and pnpm >=11.3.0. Older versions are not supported.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure to call `store.migrate()` after `store.initialize()` if migrations are defined.","message":"Index migrations must be explicitly applied after initialization.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass client inside options as `{ client }`.","message":"The `IndexStore` constructor no longer accepts `client` as second argument in v2. Use options object.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Use `store.indexDocument<MyType>(doc)` to ensure type safety.","message":"TypeScript strict mode may require explicit type annotations for generic methods.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use `import` syntax or dynamic `import()`.","message":"ESM-only module: CommonJS `require()` will fail.","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'11.3':51 '22':48 'activ':72 'api':28 'built':56 'built-in':55 'creat':30 'differenti':53 'ecosystem':70 'elasticsearch':1,8,17 'elasticsearch-stor':7 'ensur':35 'evolut':37 'focus':75 'handl':59 'includ':54 'index':2,63 'indic':18,34 'integr':66 'javascript':78 'key':52 'librari':14 'maintain':71 'manag':3,16,64 'migrat':5,22,33,58 'node.js':47 'organ':44 'pnpm':50 'provid':25 'releas':40 'reliabl':77 'safe':62 'schema':36 'store':9 'structur':27 'support':6,23 'target':46 'terascop':43 'teraslic':69 'time':39 'type':61 'type-saf':60 'typescript':13,79 'updat':31 'v2.11.1':10 'version':20","created_at":"2026-06-07T16:51:42.458610+00:00","updated_at":"2026-06-07T16:51:42.458610+00:00","problems":[{"fix":"Install @elastic/elasticsearch@8 or higher.","cause":"Incorrect @elastic/elasticsearch version (v7 vs v8 API change)","error":"TypeError: client.helpers.bulk is not a function"},{"fix":"Add `mappings: { properties: {...} }` to configuration.","cause":"Missing `mappings` option in IndexStore constructor","error":"Error: No index mappings provided"},{"fix":"Change to import statement or use dynamic import().","cause":"Using CommonJS require() on ESM-only package","error":"ERR_REQUIRE_ESM: require() of ES Module not supported"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/terascope/teraslice/tree/master/packages/elasticsearch-store#readme","github":"git@github.com:terascope/teraslice","docs":null,"changelog":null,"pypi":null,"npm":"elasticsearch-store","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}