Skip to content

feats/meteor-easy-elasticsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quadric's EasySearch-Elasticsearch

Note: This package is a fork of the easysearch:elasticsearch package with changes to make it compatible with Elasticsearch 2.1+.

This package adds an EasySearch.ElasticSearch engine to EasySearch. EasySearch synchronizes documents to an index called easysearch, with types based on the collection name.

// On Client and Server
let Players = new Meteor.Collection('players'),
  PlayersIndex = new EasySearch.Index({
    collection: Players,
    fields: ['name'],
    engine: new EasySearch.ElasticSearch({
      body: () => { ... } // modify the body that's sent when searching
    })
  });

Configuration

The client doesn't require any configuration if ElasticSearch runs locally on port 9200. The configuration options that can be passed to EasSearch.ElasticSearch as an object are following.

  • client: Object of client configuration (such as the host and so on)
  • fieldsToIndex: Array of document fields to index, by default all fields
  • query(searchObject, options): Function that returns the query, by default a fuzzy multi_match query
  • sort(searchObject, options): Function that returns the sort parameter, by default the index fields
  • getElasticSearchDoc(doc, fields): Function that returns the document to index, fieldsToIndex by default
  • body(body): Function that returns the ElasticSearch body to send when searching

Mapping, Analyzers and so on

To make changes to the mapping and other custom ElasticSearch actions you can use the exposed nodejs client on your index.

index.config.elasticSearchClient.putMapping({
  // define custom mapping
});

How to run ElasticSearch

# Install Elastic Search through brew.
brew install elasticsearch
# Start the service, runs on http://localhost:9200 by default.
elasticsearch -f -D es.config=/usr/local/opt/elasticsearch/config/elasticsearch.yml

How to install

cd /path/to/project
meteor add quadric:easy-elasticsearch

About

Elasticsearch 2.1+ Engine for EasySearch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published