Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/panthershark/elastic_filter

Elastic Search plugin for generating filtered queries.
https://github.com/panthershark/elastic_filter

Last synced: about 2 months ago
JSON representation

Elastic Search plugin for generating filtered queries.

Awesome Lists containing this project

README

        

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);
});
```