Awesome
elastic.js can be used with elasticsearch 2.x and lower. There were several breaking changes in the 5.x release for the Query DSL.
You can try elastic-builder for elasticsearch version >= 5.x.
doc is here : https://cdn.rawgit.com/ErwanPigneul/elastic.js/master/dist/docs/ejs.html
elastic.js
A JavaScript implementation of the ElasticSearch DSL for use with the official elasticsearch javascript client.
Documentation
You can find the official documentation at the following locations:
You will also be able to find unofficial documentation and examples on on our blog and GitHub Gist pages here and here.
Examples
Search
client.search({
index: 'myindex',
body: ejs.Request()
.query(ejs.MatchQuery('title', 'test'))
.facet(ejs.TermsFacet('tags').field('tags'))
}, function (error, response) {
// handle response
});
Suggest
client.suggest({
index: 'myindex',
body: ejs.TermSuggester('mysuggester')
.text('tset')
.field('title')
}, function (error, response) {
// handle suggestion response
});
Multi-Search
client.msearch({
body: [
{}
ejs.Request().query(ejs.MatchAllQuery()),
{ index: 'myindex', type: 'mytype' },
ejs.Request().query(ejs.QueryStringQuery('"Test 1"'))
]
});
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
Also, please don't edit elastic.js and elastic.min.js files as they are generated via grunt. You'll find source code in the "src" subdirectory!
Some tips (memo)
cd docs/ ./build.sh
License
Copyright (c) 2012-2014 FullScale Labs, LLC Licensed under the MIT license.