As a simple illustration, try translating the following DSL query which
implements basic multi-select faceting.
http://docs.fullscale.co/translator
var colors = ejs.TermsFilter('color', ['green', 'red']),
shapes = ejs.TermsFilter('shape', ['square']),
tags = ejs.TermsFilter('tags', ['tag2', 'tag4']),
keywords = ejs.TermsFilter('keywords',['keyword2', 'keyword3'])
ejs.Request()
.query(ejs.MatchAllQuery())
.filter(ejs.AndFilter([colors, shapes, tags, keywords]))
.facet(
ejs.TermsFacet('shapeFacet')
.field('shape')
.allTerms(true)
.facetFilter(ejs.AndFilter([colors, tags, keywords])))
.facet(
ejs.TermsFacet('colorFacet')
.field('color')
.allTerms(true)
.facetFilter(ejs.AndFilter([shapes, tags, keywords])))
.facet(
ejs.TermsFacet('tagsFacet')
.field('tags')
.allTerms(true)
.facetFilter(ejs.AndFilter([colors, shapes, keywords])))
.facet(
ejs.TermsFacet('keywordsFacet')
.field('keywords')
.allTerms(true)
.facetFilter(ejs.AndFilter([shapes, tags, keywords])))
This generates a pretty gnarly chunk of JSON that would be difficult to
otherwise construct (and this just uses a simple MatchAllQuery). The DSL
version is more readable and reusable.
It's an ideal language for exposing the full power of Lucene and
elasticsearch to domain experts who want/need to execute advanced searches.
The composable nature also makes it easy to share and extend queries which
is something we've seen a lot of in scientific related industries.
On Tuesday, January 15, 2013 12:34:41 PM UTC-5, Matt Weber wrote:
FullScale Labs would like to announce Elastic.js which is a JavaScript
implementation of the Elasticsearch Query DSL and Core API. The goal of the
project is to provide a JavaScript based DSL similar to the Java
QueryBuilder/FilterBuilder APIs. This allows us to generate structured
documentation and provide a more terse syntax.
The code is client/server agnostic so it can be used with node.js, etc.
There's an interface that allows you to plug in an appropriate client.
Right now, we have a pure jQuery client as well as Angular.js and node.js
clients (see the guide).
We've also put together a simple query translator that converts this DSL
syntax into pure REST requests. This might be useful for constructing more
sophisticated queries that can then be translated for use via curl or some
other client library.
The code is up to date with the latest version of Elasticsearch (including
the latest Lucene 4.0 functionality found in the master branch).
Contributions are welcome.
Project Home
GitHub - fullscale/elastic.js: A JavaScript implementation of the elasticsearch Query DSL
API Documentation
The domain name Fullscale.co is for sale | Dan.com
Guide
The domain name Fullscale.co is for sale | Dan.com
Translator
The domain name Fullscale.co is for sale | Dan.com
Examples
https://github.com/fullscale/elastic.js/tree/master/examples
--