npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pelias-schema

v7.0.0

Published

Elasticsearch schema files and tooling for Pelias

Downloads

336

Readme

Pelias Elasticsearch Schema Definition

This package defines the Elasticsearch schema used by Pelias. Pelias requires quite a few settings for performance and accuracy. This repository contains those settings as well as useful tools to ensure they are applied correctly.

Requirements

See Pelias Software requirements for general Pelias requirements.

Installation

$ npm install pelias-schema

Usage

create index

./bin/create_index                          # quick start

drop index

node scripts/drop_index.js                 # drop everything
node scripts/drop_index.js --force-yes     # skip warning prompt

update settings on an existing index

This is useful when you want to add a new analyser or filter to an existing index.

note: it is impossible to change the number_of_shards for an existing index, this will require a full re-index.

node scripts/update_settings.js          # update index settings

output schema file

Use this script to pretty-print the schema's mappings to stdout.

node scripts/output_mapping.js

check all mandatory elasticsearch plugins are correctly installed

Print a list of which plugins are installed and how to install any that are missing.

node scripts/check_plugins.js

Configuration

Settings from pelias.json

Like the rest of Pelias, the Pelias schema can be configured through a pelias.json file read by pelias-config.

schema.indexName

This allows configuring the name of the index created in Elasticsearch. The default is pelias.

Note: All Pelias importers also use this configuration value to determine what index to write to. Additionally, the Pelias API uses the related api.indexName parameter to determine where to read from.

user customizable synonyms files

You may provide your own custom synonyms by editing files in the ./synonyms/ directory.

$ ls -1 synonyms/custom_*
synonyms/custom_admin.txt
synonyms/custom_name.txt
synonyms/custom_street.txt

You must edit the files before running create_index.js, any changes made to the files will require you to drop and recreate the index before those synonyms are available.

Synonyms are only used at index-time. The filename contains the name of the elasticsearch field which the synonyms will apply. ie. custom_name will apply to the name.* fields, custom_street will apply to the address_parts.name field and custom_admin will apply to the parent.* fields.

see: https://github.com/pelias/schema/pull/273 for more info.

With great power comes great responsibility. Synonyms files are often used as a hammer when a scalpel is required. Please take care with their use and make maintainers aware that you are using custom synonyms when you open support tickets.

NPM Module

The pelias-schema npm module can be found here:

https://npmjs.org/package/pelias-schema

You can pull down a versioned copy of the pelias schema from npm:

var schema = require('pelias-schema');

console.log( JSON.stringify( schema, null, 2 ) );

Contributing

Please fork and pull request against upstream master on a feature branch.

Pretty please; provide unit tests and script fixtures in the test directory.

Running Unit Tests

$ npm test

Running Integration Tests

Requires a running elasticsearch server (no other setup required)

$ npm run integration

Running elasticsearch in Docker (for testing purposes)

Download the image and start an elasticsearch docker container:

$ docker run --rm --name elastic-test -p 9200:9200 pelias/elasticsearch:7.5.1

Continuous Integration

CI tests every release against all supported Node.js versions.