{"id":48895,"library":"pelias-schema","title":"Pelias Schema","description":"Elasticsearch schema definitions and tooling for the Pelias geocoder. As of v9.1.0, this package provides the Elasticsearch index mappings, settings, and scripts to create, drop, and update indices required by Pelias. It is updated alongside Pelias releases to support latest Elasticsearch versions (compatible with ES 7.x). Key differentiators: ships with pre-tuned analyzers and filters optimized for geocoding (e.g., custom synonym files), and integrates with pelias-config for dynamic index name. Release cadence is tied to Pelias core releases, approximately quarterly.","status":"active","version":"9.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/pelias/schema","tags":["javascript","pelias","schema"],"install":[{"cmd":"npm install pelias-schema","lang":"bash","label":"npm"},{"cmd":"yarn add pelias-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add pelias-schema","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used to read schema.indexName and other Pelias configuration from pelias.json","package":"pelias-config","optional":false},{"reason":"Required by Elasticsearch client used in scripts; may be optional if using @elastic/elasticsearch","package":"elasticsearch","optional":true}],"imports":[{"note":"This package is CJS-only and does not ship ESM. Use require() only.","wrong":"import { createIndex } from 'pelias-schema';","symbol":"createIndex","correct":"const { createIndex } = require('pelias-schema');"},{"note":"dropIndex prompts for confirmation by default. Use --force-yes flag to skip.","symbol":"dropIndex","correct":"const { dropIndex } = require('pelias-schema');"},{"note":"The default export is an object with multiple methods; schema is a named export containing the Elasticsearch mappings object.","wrong":"const schema = require('pelias-schema');","symbol":"schema","correct":"const { schema } = require('pelias-schema');"}],"quickstart":{"code":"const { createIndex, dropIndex, schema } = require('pelias-schema');\n\n// Create the default Pelias index in Elasticsearch\ncreateIndex({ client: require('elasticsearch').Client({ host: 'http://localhost:9200' }) }, (err, resp) => {\n  if (err) console.error(err);\n  else console.log('Index created:', resp);\n});\n\n// Drop the index with confirmation prompt\n// dropIndex({ client: elasticsearchClient });\n\n// Log the schema mapping\nconsole.log(JSON.stringify(schema, null, 2));","lang":"javascript","description":"Shows how to require and use the main functions: createIndex with an Elasticsearch client, dropIndex, and access the schema object."},"warnings":[{"fix":"Upgrade your Elasticsearch cluster to version 7.x before updating pelias-schema to v7+.","message":"v7+ drops support for Elasticsearch 6.x. The schema is now only compatible with Elasticsearch 7.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Instead of calling the exported updateSettings, run node scripts/update_settings.js from the package root.","message":"v9.0.0 removed the 'updateSettings' function; use scripts/update_settings.js directly.","severity":"deprecated","affected_versions":">=9.0.0"},{"fix":"Ensure the index name is correctly set in pelias.json before creating the index. If you need to rename, create a new index and reimport data.","message":"The schema.indexName from pelias-config is only read once at creation; changing it after index creation has no effect.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always pass --force-yes flag when running in scripts or CI: node scripts/drop_index.js --force-yes","message":"Running dropIndex without --force-yes prompts for confirmation via stdin; in non-interactive environments it will hang.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set desired number_of_shards in pelias.json via schema.settings.index.number_of_shards before creating the index.","message":"The number_of_shards cannot be changed after index creation. The default is 5; plan ahead.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'7':48 'alongsid':37 'analyz':57 'approxim':85 'cadenc':78 'compat':45 'config':72 'core':83 'creat':26 'custom':64 'definit':5 'differenti':51 'drop':27 'dynam':74 'e.g':63 'elasticsearch':3,19,43 'es':47 'file':66 'filter':59 'geocod':11,62 'index':20,75 'indic':30 'integr':68 'javascript':87 'key':50 'latest':42 'map':21 'name':76 'optim':60 'packag':16 'pelia':1,10,33,38,71,82,88 'pelias-config':70 'pre':55 'pre-tun':54 'provid':17 'quarter':86 'releas':39,77,84 'requir':31 'schema':2,4,89 'script':24 'set':22 'ship':52 'support':41 'synonym':65 'tie':80 'tool':7 'tune':56 'updat':29,36 'v9.1.0':14 'version':44 'x':49","created_at":"2026-06-07T16:59:00.627561+00:00","updated_at":"2026-06-07T16:59:00.627561+00:00","problems":[{"fix":"Run: npm install pelias-config","cause":"The pelias-schema package requires pelias-config as a peer dependency but it is not installed.","error":"Error: Cannot find module 'pelias-config'"},{"fix":"Ensure you create a valid Elasticsearch client: require('elasticsearch').Client({ host: 'localhost:9200' })","cause":"You passed an Elasticsearch client that does not have the indices namespace (e.g., wrong version or incomplete mock).","error":"TypeError: client.indices.create is not a function"},{"fix":"Start Elasticsearch on localhost:9200 or update host in client configuration.","cause":"Elasticsearch server is not running or the host/port is incorrect.","error":"Error: No Living connections"},{"fix":"Increase client requestTimeout (e.g., new Client({ requestTimeout: 120000 })) or check Elasticsearch health.","cause":"Elasticsearch is slow or unresponsive, or the index creation takes too long.","error":"RequestTimeout: Request timed out after 30000ms"}],"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/pelias/schema","github":"https://github.com/pelias/schema","docs":null,"changelog":null,"pypi":null,"npm":"pelias-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","search"],"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}}