elastic_filter

0.1.0 • Public • Published

elastic_filter

Elastic Search plugin for generating filtered queries.

Standalone

var ElasticFilter = require('elastic_filter');
var elastic = new ElasticFilter({
  "host": "localhost:9200",
  "log": "error"

  /** see elasticsearch.js docs for more options **/
});

var searchOptions = {
    fields: [],
    type: 'person',
    index: 'person',
    pagenum: 1,
    pagesize: 20,
    sort: ["age"],
    result_fields: ["id", "first_name", "last_name", "created_date", "other_property"],
    filters: {
    	first_name: "Bill"
    	/** supports multiple filters **/
  	}
  };

elastic.search('optional free form term', searchOptions, function(err, data) {
    console.log(err, data);  
});

With Mixdown App

var App = require('mixdown-app').App;
var ElasticFilter = require('elastic_filter');

var app = new App();
app.use(new ElasticFilter({
  "host": "localhost:9200",
  "log": "error"

  /** see elasticsearch.js docs for more options **/
}), 'elastic');

var searchOptions = {
    fields: [],
    type: 'person',
    index: 'person',
    pagenum: 1,
    pagesize: 20,
    sort: ["age"],
    result_fields: ["id", "first_name", "last_name", "created_date", "other_property"],
    filters: {
    	first_name: "Bill"
    	/** supports multiple filters **/
  	}
  };

app.elastic.search('optional free form term', searchOptions, function(err, data) {
    console.log(err, data);  
});

Dependencies (4)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i elastic_filter

    Weekly Downloads

    4

    Version

    0.1.0

    License

    none

    Last publish

    Collaborators

    • tommydudebreaux