I'm curious as to what approaches folks have used (if any) for wrapping ES
services.
The objectives I have are:
- Isolate browser clients from raw ES search syntax
- Provide a server-side Java service that converts untrusted web requests
with basic user criteria (e.g. keywords, date ranges etc) into trusted ES
json query DSL and call ES then return results.
The service in 2) however should use a form of templating so that it is
possible for admin staff to modify the query logic (e.g. prefix-lengths,
boosts etc ) in a simple text file containing the query template rather
than needing to edit and recompile Java code to tweak query logic.
This is similar to the design practice of externalizing SQL statements used
by a database app into a text file or using Lucene's XML query syntax and
storing template queries as XSLT files that can be easily edited.
While XSLT served me well with Lucene apps I'm not sure what the
alternatives are for the JSON-based syntax used by ES.
The templating options I can think of are:
- Velocity
- .js Javascript functions interpreted by Rhino
- Groovy scripts
Velocity seems more suited to generating mark up like HTML and I expect
using it would make butt-ugly JSON templates.
Javascript functions would be a more natural language for JSON construction
but any library dependencies e.g. date-formatting routines like moment.js
would need pre-loading into Rhino environment.
Groovy has the advantage that is Java-based and can access any number of
libraries in the JVM through imports but its JSON-builder syntax has some
subtle syntax differences to JSON that may be annoying in practice if you
cut-and-paste example JSON from the ES docs and paste into your templates.
If JSON templating is too messy another option is create an XML wrapper for
all ES functions only so that we can continue use of XSLT for templating.
Anyone else have any thoughts on this?
Cheers
Mark
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.