diff --git a/es.js b/es.js index 0095fc8..7ac9693 100644 --- a/es.js +++ b/es.js @@ -17,7 +17,9 @@ function optionsFromQuery(query) { } var opts = {} - + + // FIXME: note that fields are not supported here + // from position if (query.from) { opts["from"] = query.from } @@ -250,6 +252,7 @@ function elasticSearchQuery(params) { if (include_fields) { options.fields ? qs['fields'] = options.fields : ""; options.partial_fields ? qs['partial_fields'] = options.partial_fields : ""; + options.script_fields ? qs["script_fields"] = options.script_fields : ""; } // paging (number of results, and start cursor) @@ -368,7 +371,7 @@ function elasticSearchSuccess(callback) { for (var item = 0; item < data.hits.hits.length; item++) { var res = data.hits.hits[item] if ("fields" in res) { - // partial fields are also included here - no special treatment + // partial_fields and script_fields are also included here - no special treatment resultobj.records.push(res.fields) } else { resultobj.records.push(res._source) diff --git a/jquery.facetview2.js b/jquery.facetview2.js index 55420d5..f10b905 100644 --- a/jquery.facetview2.js +++ b/jquery.facetview2.js @@ -241,6 +241,11 @@ function getUrlVars() { // list of partial fields to be returned by the elasticsearch query. If omitted, full result set is returned "partial_fields" : false, // or an array of partial fields + + // list of script fields to be executed. Note that you should, in general, not pass actual scripts but + // references to stored scripts in the back-end ES. If not false, then an object corresponding to the + // ES script_fields structure + "script_fields" : false, // number of results to display per page (i.e. to retrieve per query) "page_size" : 10,