diff --git a/dist/elastic.js b/dist/elastic.js index 94e7146..9503640 100644 --- a/dist/elastic.js +++ b/dist/elastic.js @@ -1,6 +1,6 @@ -/*! elastic.js - v1.1.1 - 2013-12-26 +/*! elastic.js - v1.1.1 - 2014-03-15 * https://github.com/fullscale/elastic.js - * Copyright (c) 2013 FullScale Labs, LLC; Licensed MIT */ + * Copyright (c) 2014 FullScale Labs, LLC; Licensed MIT */ /** @namespace @@ -2650,7 +2650,7 @@ terms. If passed an array, it overwrites all existing values.
@member ejs.TermsFacet - @param {String || Array} exclude A single term to exclude or an + @param {(String|String[])} exclude A single term to exclude or an array of terms to exclude. @returns {Object} returnsthis
so that calls can be chained.
*/
@@ -2794,7 +2794,7 @@
@desc
A container Filter that allows Boolean AND composition of Filters.
- @param {Filter || Array} f A single Filter object or an array of valid
+ @param {(Filter|Filter[])} f A single Filter object or an array of valid
Filter objects.
*/
ejs.AndFilter = function (f) {
@@ -2829,7 +2829,7 @@
of Filters, then they replace all existing filters.
@member ejs.AndFilter
- @param {Filter || Array} fltr A valid filter object or an array of filters.
+ @param {(Filter|Filter[])} fltr A valid filter object or an array of filters.
@returns {Object} returns this
so that calls can be chained.
*/
filters: function (fltr) {
@@ -2896,7 +2896,7 @@
replace all existing filters.
@member ejs.BoolFilter
- @param {Filter || Array} oFilter A valid Filter or array of
+ @param {(Filter|Filter[])} oFilter A valid Filter or array of
Filter objects.
@returns {Object} returns this
so that calls can be chained.
*/
@@ -2936,7 +2936,7 @@
they replace all existing filters.
@member ejs.BoolFilter
- @param {Filter || Array} oFilter A valid Filter or array of
+ @param {(Filter|Filter[])} oFilter A valid Filter or array of
Filter objects.
@returns {Object} returns this
so that calls can be chained.
*/
@@ -2976,7 +2976,7 @@
they replace all existing filters.
@member ejs.BoolFilter
- @param {Filter || Array} oFilter A valid Filter or array of
+ @param {(Filter|Filter[])} oFilter A valid Filter or array of
Filter objects.
@returns {Object} returns this
so that calls can be chained.
*/
@@ -4208,7 +4208,7 @@
@desc
Matches documents with the specified id(s).
- @param {Array || String} ids A single document id or a list of document ids.
+ @param {(String|String[])} ids A single document id or a list of document ids.
*/
ejs.IdsFilter = function (ids) {
@@ -4232,7 +4232,7 @@
array it is set as the document values and replaces any existing values.
@member ejs.IdsFilter
- @param {Array || String} val An single document id or an array of document ids.
+ @param {(String|String[])} val An single document id or an array of document ids.
@returns {Object} returns this
so that calls can be chained.
*/
values: function (val) {
@@ -4258,7 +4258,7 @@
parameter is optional.
@member ejs.IdsFilter
- @param {Array || String} type A type or a list of types
+ @param {(String|String[])} type A type or a list of types
@returns {Object} returns this
so that calls can be chained.
*/
type: function (type) {
@@ -4303,7 +4303,7 @@
A configurable filter that is dependent on the index name.
@param {Object} fltr A valid filter object.
- @param {String || Array} indices a single index name or an array of index
+ @param {(String|String[])} indices a single index name or an array of index
names.
*/
ejs.IndicesFilter = function (fltr, indices) {
@@ -4334,7 +4334,7 @@
an array, it overwites all current indices.
@member ejs.IndicesFilter
- @param {String || Array} i A single index name or an array of index names.
+ @param {(String|String[])} i A single index name or an array of index names.
@returns {Object} returns this
so that calls can be chained.
*/
indices: function (i) {
@@ -4380,7 +4380,7 @@
documents or "all" to match all documents.
@member ejs.IndicesFilter
- @param {Object || String} f A valid Filter object or "none" or "all"
+ @param {(Filter|String)} f A valid Filter object or "none" or "all"
@returns {Object} returns this
so that calls can be chained.
*/
noMatchFilter: function (f) {
@@ -4775,7 +4775,7 @@
@desc
A Filter that only accepts numeric values within a specified range.
- @param {string} fieldName The name of the field to filter on.
+ @param {String} fieldName The name of the field to filter on.
*/
ejs.NumericRangeFilter = function (fieldName) {
@@ -4887,7 +4887,7 @@
include_lower to false,
@member ejs.NumericRangeFilter
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
gt: function (val) {
@@ -4908,7 +4908,7 @@
and include_lower to true.
@member ejs.NumericRangeFilter
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
gte: function (val) {
@@ -4929,7 +4929,7 @@
to false.
@member ejs.NumericRangeFilter
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
lt: function (val) {
@@ -4950,7 +4950,7 @@
and include_upper to true.
@member ejs.NumericRangeFilter
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
lte: function (val) {
@@ -4984,7 +4984,7 @@
@desc
A container Filter that allows Boolean OR composition of filters.
- @param {Filter || Array} filters A valid Filter or array of Filters.
+ @param {(Filter|Filter[])} filters A valid Filter or array of Filters.
*/
ejs.OrFilter = function (filters) {
@@ -5018,7 +5018,7 @@
replace all existing Filters.
@member ejs.OrFilter
- @param {Filter || Array} fltr A Filter or array of Filters
+ @param {(Filter|Filter[])} fltr A Filter or array of Filters
@returns {Object} returns this
so that calls can be chained.
*/
filters: function (fltr) {
@@ -5233,7 +5233,7 @@
The lower bound. Defaults to start from the first.
@member ejs.RangeFilter
- @param {Variable Type} f the lower bound value, type depends on field type
+ @param {*} f the lower bound value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
from: function (f) {
@@ -5249,7 +5249,7 @@
The upper bound. Defaults to unbounded.
@member ejs.RangeFilter
- @param {Variable Type} t the upper bound value, type depends on field type
+ @param {*} t the upper bound value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
to: function (t) {
@@ -5299,7 +5299,7 @@
include_lower to false,
@member ejs.RangeFilter
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
gt: function (val) {
@@ -5316,7 +5316,7 @@
and include_lower to true.
@member ejs.RangeFilter
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
gte: function (val) {
@@ -5333,7 +5333,7 @@
to false.
@member ejs.RangeFilter
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
lt: function (val) {
@@ -5350,7 +5350,7 @@
and include_upper to true.
@member ejs.RangeFilter
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
lte: function (val) {
@@ -5654,7 +5654,7 @@
A Filter that matches documents containing provided terms.
@param {String} field the document field/key to filter against
- @param {String || Array} terms a single term or an array of terms.
+ @param {(String|String[])} terms a single term or an array of terms.
*/
ejs.TermsFilter = function (field, terms) {
@@ -5711,7 +5711,7 @@
existing terms.
@member ejs.TermsFilter
- @param {String || Array} t A single term or an array or terms.
+ @param {(String|String[])} t A single term or an array or terms.
@returns {Object} returns this
so that calls can be chained.
*/
terms: function (t) {
@@ -6657,8 +6657,8 @@
Returned documents matched by the query and scored based on if the document
matched in a filter.
- @param {Object} qry A valid query object.
- @param {Object || Array} filters A single object or array of objects. Each
+ @param {Query} qry A valid query object.
+ @param {(Object|Object[])} filters A single object or array of object. Each
object must have a 'filter' property and either a 'boost' or 'script'
property.
*/
@@ -6740,7 +6740,7 @@
@member ejs.CustomFiltersScoreQuery
- @param {Object || Array} fltrs An object or array of objects
+ @param {(Object|Object[])} fltrs An object or array of objects
contining a filter and either a boost or script property.
@returns {Object} returns this
so that calls can be chained.
*/
@@ -7005,7 +7005,7 @@
replaces all existing values.
@member ejs.DisMaxQuery
- @param {Query || Array} qs A single Query or an array of Queries
+ @param {(Query|Query[])} qs A single Query or an array of Queries
@returns {Object} returns this
so that calls can be chained.
*/
queries: function (qs) {
@@ -8009,7 +8009,7 @@
of field names, it replaces any existing values with the new array.
@member ejs.FuzzyLikeThisQuery
- @param {String || Array} f A single field name or a list of field names.
+ @param {(String|String[])} f A single field name or a list of field names.
@returns {Object} returns this
so that calls can be chained.
*/
fields: function (f) {
@@ -8825,7 +8825,7 @@
@desc
Matches documents with the specified id(s).
- @param {Array || String} ids A single document id or a list of document ids.
+ @param {(String|String[])} ids A single document id or a list of document ids.
*/
ejs.IdsQuery = function (ids) {
@@ -8849,7 +8849,7 @@
array it is set as the document values and replaces any existing values.
@member ejs.IdsQuery
- @param {Array || String} val An single document id or an array of document ids.
+ @param {(String|String[])} val An single document id or an array of document ids.
@returns {Object} returns this
so that calls can be chained.
*/
values: function (val) {
@@ -8875,7 +8875,7 @@
parameter is optional.
@member ejs.IdsQuery
- @param {Array || String} type A type or a list of types
+ @param {(String|String[])} type A type or a list of types
@returns {Object} returns this
so that calls can be chained.
*/
type: function (type) {
@@ -8917,8 +8917,8 @@
@desc
A configurable query that is dependent on the index name.
- @param {Object} qry A valid query object.
- @param {String || Array} indices a single index name or an array of index
+ @param {Query} qry A valid query object.
+ @param {(String|String[])} indices a single index name or an array of index
names.
*/
ejs.IndicesQuery = function (qry, indices) {
@@ -8949,7 +8949,7 @@
an array, it overwites all current indices.
@member ejs.IndicesQuery
- @param {String || Array} i A single index name or an array of index names.
+ @param {(String|String[])} i A single index name or an array of index names.
@returns {Object} returns this
so that calls can be chained.
*/
indices: function (i) {
@@ -8972,7 +8972,7 @@
Sets the query to be executed against the indices specified.
@member ejs.IndicesQuery
- @param {Object} q A valid Query object
+ @param {Query} q A valid Query object
@returns {Object} returns this
so that calls can be chained.
*/
query: function (q) {
@@ -8994,7 +8994,7 @@
documents or "all" to match all documents.
@member ejs.IndicesQuery
- @param {Object || String} q A valid Query object or "none" or "all"
+ @param {(Query|String)} q A valid Query object or "none" or "all"
@returns {Object} returns this
so that calls can be chained.
*/
noMatchQuery: function (q) {
@@ -9700,7 +9700,7 @@
@desc
Constructs a query where each documents returned are “like” provided text
- @param {String || Array} fields A single field or array of fields to run against. + @param {(String|String[])} fields A single field or array of fields to run against. @param {String} likeText The text to find documents like it. */ @@ -9729,7 +9729,7 @@ of field names, it replaces any existing values with the new array. @member ejs.MoreLikeThisQuery - @param {String || Array} f A single field name or a list of field names. + @param {(String|String[])} f A single field name or a list of field names. @returns {Object} returnsthis
so that calls can be chained.
*/
fields: function (f) {
@@ -9976,7 +9976,7 @@
A Query that allow to more easily build a MatchQuery
over multiple fields
- @param {String || Array} fields the single field or array of fields to search across
+ @param {(String|String[])} fields the single field or array of fields to search across
@param {String} qstr the query string
*/
ejs.MultiMatchQuery = function (fields, qstr) {
@@ -10004,7 +10004,7 @@
values, they overwite all existing values.
@member ejs.MultiMatchQuery
- @param {String || Array} f A single field or list of fields names to
+ @param {(String|String[])} f A single field or list of fields names to
search across.
@returns {Object} returns this
so that calls can be
chained. Returns {Array} current value if `f` not specified.
@@ -11191,7 +11191,7 @@
The lower bound. Defaults to start from the first.
@member ejs.RangeQuery
- @param {Variable Type} f the lower bound value, type depends on field type
+ @param {*} f the lower bound value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
from: function (f) {
@@ -11207,7 +11207,7 @@
The upper bound. Defaults to unbounded.
@member ejs.RangeQuery
- @param {Variable Type} t the upper bound value, type depends on field type
+ @param {*} t the upper bound value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
to: function (t) {
@@ -11257,7 +11257,7 @@
include_lower to false,
@member ejs.RangeQuery
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
gt: function (val) {
@@ -11274,7 +11274,7 @@
and include_lower to true.
@member ejs.RangeQuery
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
gte: function (val) {
@@ -11291,7 +11291,7 @@
to false.
@member ejs.RangeQuery
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
lt: function (val) {
@@ -11308,7 +11308,7 @@
and include_upper to true.
@member ejs.RangeQuery
- @param {Variable Type} val the value, type depends on field type
+ @param {*} val the value, type depends on field type
@returns {Object} returns this
so that calls can be chained.
*/
lte: function (val) {
@@ -11662,7 +11662,7 @@
@desc
Matches spans which are near one another.
- @param {Query || Array} clauses A single SpanQuery or array of SpanQueries
+ @param {(Query|Query[])} clauses A single SpanQuery or array of SpanQueries
@param {Integer} slop The number of intervening unmatched positions
*/
@@ -11699,7 +11699,7 @@
SpanQueries, they replace any existing clauses.
@member ejs.SpanNearQuery
- @param {Query || Array} clauses A SpanQuery or array of SpanQueries.
+ @param {(Query|Query[])} clauses A SpanQuery or array of SpanQueries.
@returns {Object} returns this
so that calls can be chained.
*/
clauses: function (clauses) {
@@ -11904,7 +11904,7 @@
SpanQueries, they replace any existing clauses.
@member ejs.SpanOrQuery
- @param {Query || Array} clauses A SpanQuery or array of SpanQueries.
+ @param {(Query|Query[])} clauses A SpanQuery or array of SpanQueries.
@returns {Object} returns this
so that calls can be chained.
*/
clauses: function (clauses) {
@@ -12123,7 +12123,7 @@
A Query that matches documents containing provided terms.
@param {String} field the document field/key to query against
- @param {String || Array} terms a single term or array of "terms" to match
+ @param {(String|String[])} terms a single term or array of "terms" to match
*/
ejs.TermsQuery = function (field, terms) {
@@ -12168,7 +12168,7 @@
existing terms.
@member ejs.TermsQuery
- @param {String || Array} t A single term or an array or terms.
+ @param {(String|String[])} t A single term or an array or terms.
@returns {Object} returns this
so that calls can be chained.
*/
terms: function (t) {
@@ -12707,7 +12707,7 @@
@desc
Allows to highlight search results on one or more fields.
- @param {String || Array} fields An optional field or array of fields to highlight. + @param {(String|String[])} fields An optional field or array of fields to highlight. */ ejs.Highlight = function (fields) { @@ -12745,7 +12745,7 @@ added to the current list of fields. @member ejs.Highlight - @param {String || Array} vals A field name or array of field names. + @param {(String|String[])} vals A field name or array of field names. @returns {Object} returnsthis
so that calls can be chained.
*/
fields: function (vals) {
@@ -12772,7 +12772,7 @@
oField
parameter.
@member ejs.Highlight
- @param {String || Array} tags A single tag or an array of tags.
+ @param {(String|String[])} tags A single tag or an array of tags.
@param {String} oField An optional field name
@returns {Object} returns this
so that calls can be chained.
*/
@@ -12798,7 +12798,7 @@
oField
parameter.
@member ejs.Highlight
- @param {String || Array} tags A single tag or an array of tags.
+ @param {(String|String[])} tags A single tag or an array of tags.
@param {String} oField An optional field name
@returns {Object} returns this
so that calls can be chained.
*/
@@ -13263,19 +13263,19 @@
routing - the shard routing value
*/
ejs.Request = function () {
-
+
/**
The internal query object.
@member ejs.Request
@property {Object} query
*/
var query = {};
-
+
return {
/**
Sets the sorting for the query. This accepts many input formats.
- +sort()
- The current sorting values are returned.sort(fieldName)
- Adds the field to the current list of sorting values.Multi-level sorting is supported so the order in which sort fields +
Multi-level sorting is supported so the order in which sort fields are added to the query requests is relevant.
- +It is recommended to use Sort
objects when possible.
this
so that calls can be chained.
*/
sort: function () {
var i, len;
-
+
if (!has(query, "sort")) {
query.sort = [];
}
@@ -13305,11 +13305,11 @@
if (arguments.length === 0) {
return query.sort;
}
-
+
// if passed a single argument
if (arguments.length === 1) {
var sortVal = arguments[0];
-
+
if (isString(sortVal)) {
// add a single field name
query.sort.push(sortVal);
@@ -13333,12 +13333,12 @@
} else {
// Invalid object type as argument.
throw new TypeError('Argument must be string, Sort, or array');
- }
+ }
} else if (arguments.length === 2) {
// handle the case where a single field name and order are passed
var field = arguments[0],
order = arguments[1];
-
+
if (isString(field) && isString(order)) {
order = order.toLowerCase();
if (order === 'asc' || order === 'desc') {
@@ -13353,7 +13353,7 @@
},
/**
- Enables score computation and tracking during sorting. Be default,
+ Enables score computation and tracking during sorting. Be default,
when sorting scores are not computed.
@member ejs.Request
@@ -13364,11 +13364,11 @@
if (trueFalse == null) {
return query.track_scores;
}
-
+
query.track_scores = trueFalse;
return this;
},
-
+
/**
A search result set could be very large (think Google). Setting the
from
parameter allows you to page through the result set
@@ -13383,11 +13383,11 @@
if (f == null) {
return query.from;
}
-
+
query.from = f;
return this;
},
-
+
/**
Sets the number of results/documents to be returned. This is set on a per page basis.
@@ -13399,18 +13399,18 @@
if (s == null) {
return query.size;
}
-
+
query.size = s;
return this;
},
/**
- A timeout, bounding the request to be executed within the
+ A timeout, bounding the request to be executed within the
specified time value and bail when expired. Defaults to no timeout.
This option is valid during the following operations:
search
and delete by query
this
so that calls can be chained.
@@ -13419,39 +13419,87 @@
if (t == null) {
return query.timeout;
}
-
+
query.timeout = t;
return this;
},
-
-
+
+
/**
By default, searches return full documents, meaning every property or field.
This method allows you to specify which fields you want returned.
-
+
Pass a single field name and it is appended to the current list of
- fields. Pass an array of fields and it replaces all existing
+ fields. Pass an array of fields and it replaces all existing
fields.
@member ejs.Request
- @param {String || Array} s The field as a string or fields as array
+ @param {(String|String[])} s The field as a string or fields as array
@returns {Object} returns this
so that calls can be chained.
*/
fields: function (fieldList) {
if (fieldList == null) {
return query.fields;
}
-
+
if (query.fields == null) {
query.fields = [];
}
-
+
if (isString(fieldList)) {
query.fields.push(fieldList);
} else if (isArray(fieldList)) {
query.fields = fieldList;
} else {
- throw new TypeError('Argument must be string or array');
+ throw new TypeError('Argument must be a string or an array');
+ }
+
+ return this;
+ },
+
+ /**
+ By default, searches return full documents, meaning every property or field.
+ This method allows you to specify which fields you want included and/or which
+ ones you want excluded.
+ You are allowed to call this function multiple times with different partial names.
+ The result will be different sets that are returned by ElasticSearch, only containing
+ the fields you specified for each set. The paths to such a result set looks like this:
+ hits.hits.fields.this
so that calls can be chained.
+ */
+ partialFields: function (partialName, includes, excludes) {
+ if (!isString(partialName)) {
+ throw new TypeError('Argument partialName must be a String');
+ }
+
+ if (includes != null && !isArray(includes) && !isString(includes)) {
+ throw new TypeError('Argument includes must be a string or an array');
+ }
+
+ if (excludes != null && !isArray(excludes) && !isString(excludes)) {
+ throw new TypeError('Argument excludes must be a string or an array');
+ }
+
+ if (query.partial_fields == null) {
+ query.partial_fields = {};
+ }
+
+ if (includes == null && excludes == null) {
+ return query.partial_fields[partialName];
+ }
+
+ query.partial_fields[partialName] = {};
+ if (includes != null) {
+ query.partial_fields[partialName].include = includes;
+ }
+
+ if (excludes != null) {
+ query.partial_fields[partialName].exclude = excludes;
}
return this;
@@ -13491,11 +13539,11 @@
if (someQuery == null) {
return query.query;
}
-
+
if (!isQuery(someQuery)) {
throw new TypeError('Argument must be a Query');
}
-
+
query.query = someQuery.toJSON();
return this;
},
@@ -13512,15 +13560,15 @@
if (facet == null) {
return query.facets;
}
-
+
if (query.facets == null) {
query.facets = {};
}
-
+
if (!isFacet(facet)) {
throw new TypeError('Argument must be a Facet');
}
-
+
extend(query.facets, facet.toJSON());
return this;
@@ -13537,17 +13585,17 @@
if (filter == null) {
return query.filter;
}
-
+
if (!isFilter(filter)) {
throw new TypeError('Argument must be a Filter');
}
-
+
query.filter = filter.toJSON();
return this;
},
/**
- Performs highlighting based on the Highlight
+ Performs highlighting based on the Highlight
settings.
@member ejs.Request
@@ -13558,7 +13606,7 @@
if (h == null) {
return query.highlight;
}
-
+
if (!isHighlight(h)) {
throw new TypeError('Argument must be a Highlight object');
}
@@ -13568,15 +13616,15 @@
},
/**
- Allows you to set the specified suggester on this request object.
- Multiple suggesters can be set, all of which will be returned when
- the search is executed. Global suggestion text can be set by
+ Allows you to set the specified suggester on this request object.
+ Multiple suggesters can be set, all of which will be returned when
+ the search is executed. Global suggestion text can be set by
passing in a string vs. a Suggest
object.
@since elasticsearch 0.90
-
+
@member ejs.Request
- @param {String || Suggest} s A valid Suggest object or a String to
+ @param {(String|Suggest)} s A valid Suggest object or a String to
set as the global suggest text.
@returns {Object} returns this
so that calls can be chained.
*/
@@ -13584,11 +13632,11 @@
if (s == null) {
return query.suggest;
}
-
+
if (query.suggest == null) {
query.suggest = {};
}
-
+
if (isString(s)) {
query.suggest.text = s;
} else if (isSuggest(s)) {
@@ -13599,7 +13647,7 @@
return this;
},
-
+
/**
Computes a document property dynamically based on the supplied ScriptField
.
@@ -13611,19 +13659,19 @@
if (oScriptField == null) {
return query.script_fields;
}
-
+
if (query.script_fields == null) {
query.script_fields = {};
}
-
+
if (!isScriptField(oScriptField)) {
throw new TypeError('Argument must be a ScriptField');
}
-
+
extend(query.script_fields, oScriptField.toJSON());
return this;
},
-
+
/**
Boosts hits in the specified index by the given boost value.
@@ -13640,7 +13688,7 @@
if (arguments.length === 0) {
return query.indices_boost;
}
-
+
query.indices_boost[index] = boost;
return this;
},
@@ -13655,8 +13703,8 @@
explain: function (trueFalse) {
if (trueFalse == null) {
return query.explain;
- }
-
+ }
+
query.explain = trueFalse;
return this;
},
@@ -13672,7 +13720,7 @@
if (trueFalse == null) {
return query.version;
}
-
+
query.version = trueFalse;
return this;
},
@@ -13688,21 +13736,21 @@
if (min == null) {
return query.min_score;
}
-
+
query.min_score = min;
return this;
},
/**
The type of ejs object. For internal use only.
-
+
@member ejs.Request
@returns {String} the type of object
*/
_type: function () {
return 'request';
},
-
+
/**
Retrieves the internal query
object. This is typically used by
internal API functions so use with caution.
@@ -13713,7 +13761,7 @@
toJSON: function () {
return query;
}
-
+
};
};
@@ -15110,7 +15158,7 @@
array of Generators, they replace all existing generators.
@member ejs.PhraseSuggester
- @param {Generator || Array} oGenerator A valid Generator or
+ @param {(Generator|Generator[])} oGenerator A valid Generator or
array of Generator objects.
@returns {Object} returns this
so that calls can be chained.
*/
diff --git a/dist/elastic.min.js b/dist/elastic.min.js
index ae1aaef..e395716 100644
--- a/dist/elastic.min.js
+++ b/dist/elastic.min.js
@@ -1,7 +1,7 @@
-/*! elastic.js - v1.1.1 - 2013-12-26
+/*! elastic.js - v1.1.1 - 2014-03-15
* https://github.com/fullscale/elastic.js
- * Copyright (c) 2013 FullScale Labs, LLC; Licensed MIT */
+ * Copyright (c) 2014 FullScale Labs, LLC; Licensed MIT */
(function(){"use strict";var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x=this,y=x&&x.ejs,z=Array.prototype,A=Object.prototype,B=z.slice,C=A.toString,D=A.hasOwnProperty,E=z.forEach,F=Array.isArray,G=z.indexOf,H={};w="undefined"!=typeof exports?exports:x.ejs={},a=function(a,b){return D.call(a,b)},b=function(b,c,d){if(null!=b)if(E&&b.forEach===E)b.forEach(c,d);else if(b.length===+b.length){for(var e=0,f=b.length;f>e;e++)if(c.call(d,b[e],e,b)===H)return}else for(var g in b)if(a(b,g)&&c.call(d,b[g],g,b)===H)return},c=function(a){return b(B.call(arguments,1),function(b){for(var c in b)a[c]=b[c]}),a},d=function(a,b){if(null==a)return-1;var c=0,d=a.length;if(G&&a.indexOf===G)return a.indexOf(b);for(;d>c;c++)if(a[c]===b)return c;return-1},e=F||function(a){return"[object Array]"===C.call(a)},f=function(a){return a===Object(a)},g=function(a){return"[object String]"===C.call(a)},h=function(a){return"[object Number]"===C.call(a)},i="function"!=typeof/./?function(a){return"function"==typeof a}:function(a){return"[object Function]"===C.call(a)},j=function(b){return f(b)&&a(b,"_type")&&a(b,"toJSON")},k=function(a){return j(a)&&"query"===a._type()},l=function(a){return j(a)&&"rescore"===a._type()},m=function(a){return j(a)&&"filter"===a._type()},n=function(a){return j(a)&&"facet"===a._type()},o=function(a){return j(a)&&"script field"===a._type()},p=function(a){return j(a)&&"geo point"===a._type()},q=function(a){return j(a)&&"indexed shape"===a._type()},r=function(a){return j(a)&&"shape"===a._type()},s=function(a){return j(a)&&"sort"===a._type()},t=function(a){return j(a)&&"highlight"===a._type()},u=function(a){return j(a)&&"suggest"===a._type()},v=function(a){return j(a)&&"generator"===a._type()},w.DirectSettingsMixin=function(a){return{accuracy:function(b){return null==b?a.accuracy:(a.accuracy=b,this)},suggestMode:function(b){return null==b?a.suggest_mode:(b=b.toLowerCase(),("missing"===b||"popular"===b||"always"===b)&&(a.suggest_mode=b),this)},sort:function(b){return null==b?a.sort:(b=b.toLowerCase(),("score"===b||"frequency"===b)&&(a.sort=b),this)},stringDistance:function(b){return null==b?a.string_distance:(b=b.toLowerCase(),("internal"===b||"damerau_levenshtein"===b||"levenstein"===b||"jarowinkler"===b||"ngram"===b)&&(a.string_distance=b),this)},maxEdits:function(b){return null==b?a.max_edits:(a.max_edits=b,this)},maxInspections:function(b){return null==b?a.max_inspections:(a.max_inspections=b,this)},maxTermFreq:function(b){return null==b?a.max_term_freq:(a.max_term_freq=b,this)},prefixLen:function(b){return null==b?a.prefix_len:(a.prefix_len=b,this)},minWordLen:function(b){return null==b?a.min_word_len:(a.min_word_len=b,this)},minDocFreq:function(b){return null==b?a.min_doc_freq:(a.min_doc_freq=b,this)}}},w.FacetMixin=function(a){var b={};return b[a]={},{facetFilter:function(c){if(null==c)return b[a].facet_filter;if(!m(c))throw new TypeError("Argument must be a Filter");return b[a].facet_filter=c.toJSON(),this},global:function(c){return null==c?b[a].global:(b[a].global=c,this)},mode:function(c){return null==c?b[a].mode:(c=c.toLowerCase(),("collector"===c||"post"===c)&&(b[a].mode=c),this)},cacheFilter:function(c){return null==c?b[a].cache_filter:(b[a].cache_filter=c,this)},scope:function(){return this},nested:function(c){return null==c?b[a].nested:(b[a].nested=c,this)},_type:function(){return"facet"},toJSON:function(){return b}}},w.FilterMixin=function(a){var b={};return b[a]={},{name:function(c){return null==c?b[a]._name:(b[a]._name=c,this)},cache:function(c){return null==c?b[a]._cache:(b[a]._cache=c,this)},cacheKey:function(c){return null==c?b[a]._cache_key:(b[a]._cache_key=c,this)},_type:function(){return"filter"},toJSON:function(){return b}}},w.QueryMixin=function(a){var b={};return b[a]={},{boost:function(c){return null==c?b[a].boost:(b[a].boost=c,this)},_type:function(){return"query"},toJSON:function(){return b}}},w.SuggestContextMixin=function(a){return{analyzer:function(b){return null==b?a.analyzer:(a.analyzer=b,this)},field:function(b){return null==b?a.field:(a.field=b,this)},size:function(b){return null==b?a.size:(a.size=b,this)},shardSize:function(b){return null==b?a.shard_size:(a.shard_size=b,this)}}},w.SuggesterMixin=function(a){var b={};return b[a]={},{text:function(c){return null==c?b[a].text:(b[a].text=c,this)},_type:function(){return"suggest"},toJSON:function(){return b}}},w.DateHistogramFacet=function(a){var b=w.FacetMixin(a),d=b.toJSON();return d[a].date_histogram={},c(b,{field:function(b){return null==b?d[a].date_histogram.field:(d[a].date_histogram.field=b,this)},keyField:function(b){return null==b?d[a].date_histogram.key_field:(d[a].date_histogram.key_field=b,this)},valueField:function(b){return null==b?d[a].date_histogram.value_field:(d[a].date_histogram.value_field=b,this)},interval:function(b){return null==b?d[a].date_histogram.interval:(d[a].date_histogram.interval=b,this)},timeZone:function(b){return null==b?d[a].date_histogram.time_zone:(d[a].date_histogram.time_zone=b,this)},preZone:function(b){return null==b?d[a].date_histogram.pre_zone:(d[a].date_histogram.pre_zone=b,this)},preZoneAdjustLargeInterval:function(b){return null==b?d[a].date_histogram.pre_zone_adjust_large_interval:(d[a].date_histogram.pre_zone_adjust_large_interval=b,this)},postZone:function(b){return null==b?d[a].date_histogram.post_zone:(d[a].date_histogram.post_zone=b,this)},preOffset:function(b){return null==b?d[a].date_histogram.pre_offset:(d[a].date_histogram.pre_offset=b,this)},postOffset:function(b){return null==b?d[a].date_histogram.post_offset:(d[a].date_histogram.post_offset=b,this)},factor:function(b){return null==b?d[a].date_histogram.factor:(d[a].date_histogram.factor=b,this)},valueScript:function(b){return null==b?d[a].date_histogram.value_script:(d[a].date_histogram.value_script=b,this)},order:function(b){return null==b?d[a].date_histogram.order:(b=b.toLowerCase(),("time"===b||"count"===b||"total"===b)&&(d[a].date_histogram.order=b),this)},lang:function(b){return null==b?d[a].date_histogram.lang:(d[a].date_histogram.lang=b,this)},params:function(b){return null==b?d[a].date_histogram.params:(d[a].date_histogram.params=b,this)}})},w.FilterFacet=function(a){var b=w.FacetMixin(a),d=b.toJSON();return c(b,{filter:function(b){if(null==b)return d[a].filter;if(!m(b))throw new TypeError("Argument must be a Filter");return d[a].filter=b.toJSON(),this}})},w.GeoDistanceFacet=function(a){var b=w.FacetMixin(a),d=b.toJSON(),e=w.GeoPoint([0,0]),f="location";return d[a].geo_distance={location:e.toJSON(),ranges:[]},c(b,{field:function(b){var c=d[a].geo_distance[f];return null==b?f:(delete d[a].geo_distance[f],f=b,d[a].geo_distance[b]=c,this)},point:function(b){if(null==b)return e;if(!p(b))throw new TypeError("Argument must be a GeoPoint");return e=b,d[a].geo_distance[f]=b.toJSON(),this},addRange:function(b,c){return 0===arguments.length?d[a].geo_distance.ranges:(d[a].geo_distance.ranges.push({from:b,to:c}),this)},addUnboundedFrom:function(b){return null==b?d[a].geo_distance.ranges:(d[a].geo_distance.ranges.push({from:b}),this)},addUnboundedTo:function(b){return null==b?d[a].geo_distance.ranges:(d[a].geo_distance.ranges.push({to:b}),this)},unit:function(b){return null==b?d[a].geo_distance.unit:(b=b.toLowerCase(),("mi"===b||"km"===b)&&(d[a].geo_distance.unit=b),this)},distanceType:function(b){return null==b?d[a].geo_distance.distance_type:(b=b.toLowerCase(),("arc"===b||"plane"===b)&&(d[a].geo_distance.distance_type=b),this)},normalize:function(b){return null==b?d[a].geo_distance.normalize:(d[a].geo_distance.normalize=b,this)},valueField:function(b){return null==b?d[a].geo_distance.value_field:(d[a].geo_distance.value_field=b,this)},valueScript:function(b){return null==b?d[a].geo_distance.value_script:(d[a].geo_distance.value_script=b,this)},lang:function(b){return null==b?d[a].geo_distance.lang:(d[a].geo_distance.lang=b,this)},params:function(b){return null==b?d[a].geo_distance.params:(d[a].geo_distance.params=b,this)}})},w.HistogramFacet=function(a){var b=w.FacetMixin(a),d=b.toJSON();return d[a].histogram={},c(b,{field:function(b){return null==b?d[a].histogram.field:(d[a].histogram.field=b,this)},interval:function(b){return null==b?d[a].histogram.interval:(d[a].histogram.interval=b,this)},timeInterval:function(b){return null==b?d[a].histogram.time_interval:(d[a].histogram.time_interval=b,this)},from:function(b){return null==b?d[a].histogram.from:(d[a].histogram.from=b,this)},to:function(b){return null==b?d[a].histogram.to:(d[a].histogram.to=b,this)},valueField:function(b){return null==b?d[a].histogram.value_field:(d[a].histogram.value_field=b,this)},keyField:function(b){return null==b?d[a].histogram.key_field:(d[a].histogram.key_field=b,this)},valueScript:function(b){return null==b?d[a].histogram.value_script:(d[a].histogram.value_script=b,this)},keyScript:function(b){return null==b?d[a].histogram.key_script:(d[a].histogram.key_script=b,this)},lang:function(b){return null==b?d[a].histogram.lang:(d[a].histogram.lang=b,this)},params:function(b){return null==b?d[a].histogram.params:(d[a].histogram.params=b,this)},order:function(b){return null==b?d[a].histogram.order:(b=b.toLowerCase(),("key"===b||"count"===b||"total"===b)&&(d[a].histogram.order=b),this)}})},w.QueryFacet=function(a){var b=w.FacetMixin(a),d=b.toJSON();return c(b,{query:function(b){if(null==b)return d[a].query;if(!k(b))throw new TypeError("Argument must be a Query");return d[a].query=b.toJSON(),this}})},w.RangeFacet=function(a){var b=w.FacetMixin(a),d=b.toJSON();return d[a].range={ranges:[]},c(b,{field:function(b){return null==b?d[a].range.field:(d[a].range.field=b,this)},keyField:function(b){return null==b?d[a].range.key_field:(d[a].range.key_field=b,this)},valueField:function(b){return null==b?d[a].range.value_field:(d[a].range.value_field=b,this)},valueScript:function(b){return null==b?d[a].range.value_script:(d[a].range.value_script=b,this)},keyScript:function(b){return null==b?d[a].range.key_script:(d[a].range.key_script=b,this)},lang:function(b){return null==b?d[a].range.lang:(d[a].range.lang=b,this)},params:function(b){return null==b?d[a].range.params:(d[a].range.params=b,this)},addRange:function(b,c){return 0===arguments.length?d[a].range.ranges:(d[a].range.ranges.push({from:b,to:c}),this)},addUnboundedFrom:function(b){return null==b?d[a].range.ranges:(d[a].range.ranges.push({from:b}),this)},addUnboundedTo:function(b){return null==b?d[a].range.ranges:(d[a].range.ranges.push({to:b}),this)}})},w.StatisticalFacet=function(a){var b=w.FacetMixin(a),d=b.toJSON();return d[a].statistical={},c(b,{field:function(b){return null==b?d[a].statistical.field:(d[a].statistical.field=b,this)},fields:function(b){if(null==b)return d[a].statistical.fields;if(!e(b))throw new TypeError("Argument must be an array");return d[a].statistical.fields=b,this},script:function(b){return null==b?d[a].statistical.script:(d[a].statistical.script=b,this)},lang:function(b){return null==b?d[a].statistical.lang:(d[a].statistical.lang=b,this)},params:function(b){return null==b?d[a].statistical.params:(d[a].statistical.params=b,this)}})},w.TermStatsFacet=function(a){var b=w.FacetMixin(a),d=b.toJSON();return d[a].terms_stats={},c(b,{valueField:function(b){return null==b?d[a].terms_stats.value_field:(d[a].terms_stats.value_field=b,this)},keyField:function(b){return null==b?d[a].terms_stats.key_field:(d[a].terms_stats.key_field=b,this)},scriptField:function(b){return null==b?d[a].terms_stats.script_field:(d[a].terms_stats.script_field=b,this)},valueScript:function(b){return null==b?d[a].terms_stats.value_script:(d[a].terms_stats.value_script=b,this)},allTerms:function(b){return null==b?d[a].terms_stats.all_terms:(d[a].terms_stats.all_terms=b,this)},lang:function(b){return null==b?d[a].terms_stats.lang:(d[a].terms_stats.lang=b,this)},params:function(b){return null==b?d[a].terms_stats.params:(d[a].terms_stats.params=b,this)},size:function(b){return null==b?d[a].terms_stats.size:(d[a].terms_stats.size=b,this)},order:function(b){return null==b?d[a].terms_stats.order:(b=b.toLowerCase(),("count"===b||"term"===b||"reverse_count"===b||"reverse_term"===b||"total"===b||"reverse_total"===b||"min"===b||"reverse_min"===b||"max"===b||"reverse_max"===b||"mean"===b||"reverse_mean"===b)&&(d[a].terms_stats.order=b),this)}})},w.TermsFacet=function(a){var b=w.FacetMixin(a),d=b.toJSON();return d[a].terms={},c(b,{field:function(b){return null==b?d[a].terms.field:(d[a].terms.field=b,this)},fields:function(b){if(null==b)return d[a].terms.fields;if(!e(b))throw new TypeError("Argument must be an array");return d[a].terms.fields=b,this},scriptField:function(b){return null==b?d[a].terms.script_field:(d[a].terms.script_field=b,this)},size:function(b){return null==b?d[a].terms.size:(d[a].terms.size=b,this)},order:function(b){return null==b?d[a].terms.order:(b=b.toLowerCase(),("count"===b||"term"===b||"reverse_count"===b||"reverse_term"===b)&&(d[a].terms.order=b),this)},allTerms:function(b){return null==b?d[a].terms.all_terms:(d[a].terms.all_terms=b,this)},exclude:function(b){if(null==d[a].terms.exclude&&(d[a].terms.exclude=[]),null==b)return d[a].terms.exclude;if(g(b))d[a].terms.exclude.push(b);else{if(!e(b))throw new TypeError("Argument must be string or array");d[a].terms.exclude=b}return this},regex:function(b){return null==b?d[a].terms.regex:(d[a].terms.regex=b,this)},regexFlags:function(b){return null==b?d[a].terms.regex_flags:(d[a].terms.regex_flags=b,this)},script:function(b){return null==b?d[a].terms.script:(d[a].terms.script=b,this)},lang:function(b){return null==b?d[a].terms.lang:(d[a].terms.lang=b,this)},params:function(b){return null==b?d[a].terms.params:(d[a].terms.params=b,this)},executionHint:function(b){return null==b?d[a].terms.execution_hint:(d[a].terms.execution_hint=b,this)}})},w.AndFilter=function(a){var b,d,f=w.FilterMixin("and"),g=f.toJSON();if(g.and.filters=[],m(a))g.and.filters.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Filter or Array of Filters");for(b=0,d=a.length;d>b;b++){if(!m(a[b]))throw new TypeError("Array must contain only Filter objects");g.and.filters.push(a[b].toJSON())}}return c(f,{filters:function(a){var b,c;if(null==a)return g.and.filters;if(m(a))g.and.filters.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Filter or an Array of Filters");for(g.and.filters=[],b=0,c=a.length;c>b;b++){if(!m(a[b]))throw new TypeError("Array must contain only Filter objects");g.and.filters.push(a[b].toJSON())}}return this}})},w.BoolFilter=function(){var a=w.FilterMixin("bool"),b=a.toJSON();return c(a,{must:function(a){var c,d;if(null==b.bool.must&&(b.bool.must=[]),null==a)return b.bool.must;if(m(a))b.bool.must.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Filter or array of Filters");for(b.bool.must=[],c=0,d=a.length;d>c;c++){if(!m(a[c]))throw new TypeError("Argument must be an array of Filters");b.bool.must.push(a[c].toJSON())}}return this},mustNot:function(a){var c,d;if(null==b.bool.must_not&&(b.bool.must_not=[]),null==a)return b.bool.must_not;if(m(a))b.bool.must_not.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Filter or array of Filters");for(b.bool.must_not=[],c=0,d=a.length;d>c;c++){if(!m(a[c]))throw new TypeError("Argument must be an array of Filters");b.bool.must_not.push(a[c].toJSON())}}return this},should:function(a){var c,d;if(null==b.bool.should&&(b.bool.should=[]),null==a)return b.bool.should;if(m(a))b.bool.should.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Filter or array of Filters");for(b.bool.should=[],c=0,d=a.length;d>c;c++){if(!m(a[c]))throw new TypeError("Argument must be an array of Filters");b.bool.should.push(a[c].toJSON())}}return this}})},w.ExistsFilter=function(a){var b=w.FilterMixin("exists"),d=b.toJSON();return d.exists.field=a,c(b,{field:function(a){return null==a?d.exists.field:(d.exists.field=a,this)}})},w.GeoBboxFilter=function(a){var b=w.FilterMixin("geo_bounding_box"),d=b.toJSON();return d.geo_bounding_box[a]={},c(b,{field:function(b){var c=d.geo_bounding_box[a];return null==b?a:(delete d.geo_bounding_box[a],a=b,d.geo_bounding_box[b]=c,this)},topLeft:function(b){if(null==b)return d.geo_bounding_box[a].top_left;if(!p(b))throw new TypeError("Argument must be a GeoPoint");return d.geo_bounding_box[a].top_left=b.toJSON(),this},bottomRight:function(b){if(null==b)return d.geo_bounding_box[a].bottom_right;if(!p(b))throw new TypeError("Argument must be a GeoPoint");return d.geo_bounding_box[a].bottom_right=b.toJSON(),this},type:function(a){return null==a?d.geo_bounding_box.type:(a=a.toLowerCase(),("memory"===a||"indexed"===a)&&(d.geo_bounding_box.type=a),this)},normalize:function(a){return null==a?d.geo_bounding_box.normalize:(d.geo_bounding_box.normalize=a,this)}})},w.GeoDistanceFilter=function(a){var b=w.FilterMixin("geo_distance"),d=b.toJSON();return d.geo_distance[a]=[0,0],c(b,{field:function(b){var c=d.geo_distance[a];return null==b?a:(delete d.geo_distance[a],a=b,d.geo_distance[b]=c,this)},distance:function(a){if(null==a)return d.geo_distance.distance;if(!h(a))throw new TypeError("Argument must be a numeric value");return d.geo_distance.distance=a,this},unit:function(a){return null==a?d.geo_distance.unit:(a=a.toLowerCase(),("mi"===a||"km"===a)&&(d.geo_distance.unit=a),this)},point:function(b){if(null==b)return d.geo_distance[a];if(!p(b))throw new TypeError("Argument must be a GeoPoint");return d.geo_distance[a]=b.toJSON(),this},distanceType:function(a){return null==a?d.geo_distance.distance_type:(a=a.toLowerCase(),("arc"===a||"plane"===a)&&(d.geo_distance.distance_type=a),this)},normalize:function(a){return null==a?d.geo_distance.normalize:(d.geo_distance.normalize=a,this)},optimizeBbox:function(a){return null==a?d.geo_distance.optimize_bbox:(a=a.toLowerCase(),("memory"===a||"indexed"===a||"none"===a)&&(d.geo_distance.optimize_bbox=a),this)}})},w.GeoDistanceRangeFilter=function(a){var b=w.FilterMixin("geo_distance_range"),d=b.toJSON();return d.geo_distance_range[a]=[0,0],c(b,{field:function(b){var c=d.geo_distance_range[a];return null==b?a:(delete d.geo_distance_range[a],a=b,d.geo_distance_range[b]=c,this)},from:function(a){if(null==a)return d.geo_distance_range.from;if(!h(a))throw new TypeError("Argument must be a numeric value");return d.geo_distance_range.from=a,this},to:function(a){if(null==a)return d.geo_distance_range.to;if(!h(a))throw new TypeError("Argument must be a numeric value");return d.geo_distance_range.to=a,this},includeLower:function(a){return null==a?d.geo_distance_range.include_lower:(d.geo_distance_range.include_lower=a,this)},includeUpper:function(a){return null==a?d.geo_distance_range.include_upper:(d.geo_distance_range.include_upper=a,this)},gt:function(a){if(null==a)return d.geo_distance_range.gt;if(!h(a))throw new TypeError("Argument must be a numeric value");return d.geo_distance_range.gt=a,this},gte:function(a){if(null==a)return d.geo_distance_range.gte;if(!h(a))throw new TypeError("Argument must be a numeric value");return d.geo_distance_range.gte=a,this},lt:function(a){if(null==a)return d.geo_distance_range.lt;if(!h(a))throw new TypeError("Argument must be a numeric value");return d.geo_distance_range.lt=a,this},lte:function(a){if(null==a)return d.geo_distance_range.lte;if(!h(a))throw new TypeError("Argument must be a numeric value");return d.geo_distance_range.lte=a,this},unit:function(a){return null==a?d.geo_distance_range.unit:(a=a.toLowerCase(),("mi"===a||"km"===a)&&(d.geo_distance_range.unit=a),this)},point:function(b){if(null==b)return d.geo_distance_range[a];if(!p(b))throw new TypeError("Argument must be a GeoPoint");return d.geo_distance_range[a]=b.toJSON(),this},distanceType:function(a){return null==a?d.geo_distance_range.distance_type:(a=a.toLowerCase(),("arc"===a||"plane"===a)&&(d.geo_distance_range.distance_type=a),this)},normalize:function(a){return null==a?d.geo_distance_range.normalize:(d.geo_distance_range.normalize=a,this)},optimizeBbox:function(a){return null==a?d.geo_distance_range.optimize_bbox:(a=a.toLowerCase(),("memory"===a||"indexed"===a||"none"===a)&&(d.geo_distance_range.optimize_bbox=a),this)}})},w.GeoPolygonFilter=function(a){var b=w.FilterMixin("geo_polygon"),d=b.toJSON();return d.geo_polygon[a]={points:[]},c(b,{field:function(b){var c=d.geo_polygon[a];return null==b?a:(delete d.geo_polygon[a],a=b,d.geo_polygon[b]=c,this)},points:function(b){var c,f;if(null==b)return d.geo_polygon[a].points;if(p(b))d.geo_polygon[a].points.push(b.toJSON());else{if(!e(b))throw new TypeError("Argument must be a GeoPoint or Array of GeoPoints");for(d.geo_polygon[a].points=[],c=0,f=b.length;f>c;c++){if(!p(b[c]))throw new TypeError("Argument must be Array of GeoPoints");d.geo_polygon[a].points.push(b[c].toJSON())}}return this},normalize:function(a){return null==a?d.geo_polygon.normalize:(d.geo_polygon.normalize=a,this)}})},w.GeoShapeFilter=function(a){var b=w.FilterMixin("geo_shape"),d=b.toJSON();return d.geo_shape[a]={},c(b,{field:function(b){var c=d.geo_shape[a];return null==b?a:(delete d.geo_shape[a],a=b,d.geo_shape[b]=c,this)},shape:function(b){return null==b?d.geo_shape[a].shape:(null!=d.geo_shape[a].indexed_shape&&delete d.geo_shape[a].indexed_shape,d.geo_shape[a].shape=b.toJSON(),this)},indexedShape:function(b){return null==b?d.geo_shape[a].indexed_shape:(null!=d.geo_shape[a].shape&&delete d.geo_shape[a].shape,d.geo_shape[a].indexed_shape=b.toJSON(),this)},relation:function(b){return null==b?d.geo_shape[a].relation:(b=b.toLowerCase(),("intersects"===b||"disjoint"===b||"within"===b)&&(d.geo_shape[a].relation=b),this)},strategy:function(b){return null==b?d.geo_shape[a].strategy:(b=b.toLowerCase(),("recursive"===b||"term"===b)&&(d.geo_shape[a].strategy=b),this)}})},w.HasChildFilter=function(a,b){if(!k(a))throw new TypeError("No Query object found");var d=w.FilterMixin("has_child"),e=d.toJSON();return e.has_child.query=a.toJSON(),e.has_child.type=b,c(d,{query:function(a){if(null==a)return e.has_child.query;if(!k(a))throw new TypeError("Argument must be a Query object");return e.has_child.query=a.toJSON(),this},filter:function(a){if(null==a)return e.has_child.filter;if(!m(a))throw new TypeError("Argument must be a Filter object");return e.has_child.filter=a.toJSON(),this},type:function(a){return null==a?e.has_child.type:(e.has_child.type=a,this)},shortCircuitCutoff:function(a){return null==a?e.has_child.short_circuit_cutoff:(e.has_child.short_circuit_cutoff=a,this)},scope:function(){return this}})},w.HasParentFilter=function(a,b){if(!k(a))throw new TypeError("No Query object found");var d=w.FilterMixin("has_parent"),e=d.toJSON();return e.has_parent.query=a.toJSON(),e.has_parent.parent_type=b,c(d,{query:function(a){if(null==a)return e.has_parent.query;if(!k(a))throw new TypeError("Argument must be a Query object");return e.has_parent.query=a.toJSON(),this},filter:function(a){if(null==a)return e.has_parent.filter;if(!m(a))throw new TypeError("Argument must be a Filter object");return e.has_parent.filter=a.toJSON(),this},parentType:function(a){return null==a?e.has_parent.parent_type:(e.has_parent.parent_type=a,this)},scope:function(){return this}})},w.IdsFilter=function(a){var b=w.FilterMixin("ids"),d=b.toJSON();if(g(a))d.ids.values=[a];else{if(!e(a))throw new TypeError("Argument must be a string or an array");d.ids.values=a}return c(b,{values:function(a){if(null==a)return d.ids.values;if(g(a))d.ids.values.push(a);else{if(!e(a))throw new TypeError("Argument must be a string or an array");d.ids.values=a}return this},type:function(a){if(null==d.ids.type&&(d.ids.type=[]),null==a)return d.ids.type;if(g(a))d.ids.type.push(a);else{if(!e(a))throw new TypeError("Argument must be a string or an array");d.ids.type=a}return this}})},w.IndicesFilter=function(a,b){if(!m(a))throw new TypeError("Argument must be a Filter");var d=w.FilterMixin("indices"),f=d.toJSON();if(f.indices.filter=a.toJSON(),g(b))f.indices.indices=[b];else{if(!e(b))throw new TypeError("Argument must be a string or array");f.indices.indices=b}return c(d,{indices:function(a){if(null==a)return f.indices.indices;if(g(a))f.indices.indices.push(a);else{if(!e(a))throw new TypeError("Argument must be a string or array");f.indices.indices=a}return this},filter:function(a){if(null==a)return f.indices.filter;if(!m(a))throw new TypeError("Argument must be a Filter");return f.indices.filter=a.toJSON(),this},noMatchFilter:function(a){if(null==a)return f.indices.no_match_filter;if(g(a))a=a.toLowerCase(),("none"===a||"all"===a)&&(f.indices.no_match_filter=a);else{if(!m(a))throw new TypeError("Argument must be string or Filter");f.indices.no_match_filter=a.toJSON()}return this}})},w.LimitFilter=function(a){var b=w.FilterMixin("limit"),d=b.toJSON();return d.limit.value=a,c(b,{value:function(a){if(null==a)return d.limit.value;if(!h(a))throw new TypeError("Argument must be a numeric value");return d.limit.value=a,this}})},w.MatchAllFilter=function(){return w.FilterMixin("match_all")},w.MissingFilter=function(a){var b=w.FilterMixin("missing"),d=b.toJSON();return d.missing.field=a,c(b,{field:function(a){return null==a?d.missing.field:(d.missing.field=a,this)},existence:function(a){return null==a?d.missing.existence:(d.missing.existence=a,this)},nullValue:function(a){return null==a?d.missing.null_value:(d.missing.null_value=a,this)}})},w.NestedFilter=function(a){var b=w.FilterMixin("nested"),d=b.toJSON();return d.nested.path=a,c(b,{path:function(a){return null==a?d.nested.path:(d.nested.path=a,this)},query:function(a){if(null==a)return d.nested.query;if(!k(a))throw new TypeError("Argument must be a Query object");return d.nested.query=a.toJSON(),this},filter:function(a){if(null==a)return d.nested.filter;if(!m(a))throw new TypeError("Argument must be a Filter object");return d.nested.filter=a.toJSON(),this},boost:function(a){return null==a?d.nested.boost:(d.nested.boost=a,this)},join:function(a){return null==a?d.nested.join:(d.nested.join=a,this)},scope:function(){return this}})},w.NotFilter=function(a){if(!m(a))throw new TypeError("Argument must be a Filter");var b=w.FilterMixin("not"),d=b.toJSON();return d.not=a.toJSON(),c(b,{filter:function(a){if(null==a)return d.not;if(!m(a))throw new TypeError("Argument must be a Filter");return d.not=a.toJSON(),this}})},w.NumericRangeFilter=function(a){var b=w.FilterMixin("numeric_range"),d=b.toJSON();return d.numeric_range[a]={},c(b,{field:function(b){var c=d.numeric_range[a];return null==b?a:(delete d.numeric_range[a],a=b,d.numeric_range[a]=c,this)},from:function(b){if(null==b)return d.numeric_range[a].from;if(!h(b))throw new TypeError("Argument must be a numeric value");return d.numeric_range[a].from=b,this},to:function(b){if(null==b)return d.numeric_range[a].to;if(!h(b))throw new TypeError("Argument must be a numeric value");return d.numeric_range[a].to=b,this},includeLower:function(b){return null==b?d.numeric_range[a].include_lower:(d.numeric_range[a].include_lower=b,this)},includeUpper:function(b){return null==b?d.numeric_range[a].include_upper:(d.numeric_range[a].include_upper=b,this)},gt:function(b){if(null==b)return d.numeric_range[a].gt;if(!h(b))throw new TypeError("Argument must be a numeric value");return d.numeric_range[a].gt=b,this},gte:function(b){if(null==b)return d.numeric_range[a].gte;if(!h(b))throw new TypeError("Argument must be a numeric value");return d.numeric_range[a].gte=b,this},lt:function(b){if(null==b)return d.numeric_range[a].lt;if(!h(b))throw new TypeError("Argument must be a numeric value");return d.numeric_range[a].lt=b,this},lte:function(b){if(null==b)return d.numeric_range[a].lte;if(!h(b))throw new TypeError("Argument must be a numeric value");return d.numeric_range[a].lte=b,this}})},w.OrFilter=function(a){var b,d,f=w.FilterMixin("or"),g=f.toJSON();if(g.or.filters=[],m(a))g.or.filters.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Filter or array of Filters");for(b=0,d=a.length;d>b;b++){if(!m(a[b]))throw new TypeError("Argument must be array of Filters");g.or.filters.push(a[b].toJSON())}}return c(f,{filters:function(a){var b,c;if(null==a)return g.or.filters;if(m(a))g.or.filters.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Filter or array of Filters");for(g.or.filters=[],b=0,c=a.length;c>b;b++){if(!m(a[b]))throw new TypeError("Argument must be an array of Filters");g.or.filters.push(a[b].toJSON())}}return this}})},w.PrefixFilter=function(a,b){var d=w.FilterMixin("prefix"),e=d.toJSON();return e.prefix[a]=b,c(d,{field:function(b){var c=e.prefix[a];return null==b?a:(delete e.prefix[a],a=b,e.prefix[a]=c,this)},prefix:function(b){return null==b?e.prefix[a]:(e.prefix[a]=b,this)}})},w.QueryFilter=function(a){if(!k(a))throw new TypeError("Argument must be a Query");var b=w.FilterMixin("fquery"),d=b.toJSON();return d.fquery.query=a.toJSON(),c(b,{query:function(a){if(null==a)return d.fquery.query;if(!k(a))throw new TypeError("Argument must be a Query");return d.fquery.query=a.toJSON(),this}})},w.RangeFilter=function(a){var b=w.FilterMixin("range"),d=b.toJSON();return d.range[a]={},c(b,{field:function(b){var c=d.range[a];return null==b?a:(delete d.range[a],a=b,d.range[b]=c,this)},from:function(b){return null==b?d.range[a].from:(d.range[a].from=b,this)},to:function(b){return null==b?d.range[a].to:(d.range[a].to=b,this)},includeLower:function(b){return null==b?d.range[a].include_lower:(d.range[a].include_lower=b,this)},includeUpper:function(b){return null==b?d.range[a].include_upper:(d.range[a].include_upper=b,this)},gt:function(b){return null==b?d.range[a].gt:(d.range[a].gt=b,this)},gte:function(b){return null==b?d.range[a].gte:(d.range[a].gte=b,this)},lt:function(b){return null==b?d.range[a].lt:(d.range[a].lt=b,this)},lte:function(b){return null==b?d.range[a].lte:(d.range[a].lte=b,this)}})},w.RegexpFilter=function(a,b){var d=w.FilterMixin("regexp"),e=d.toJSON();return e.regexp[a]={value:b},c(d,{field:function(b){var c=e.regexp[a];return null==b?a:(delete e.regexp[a],a=b,e.regexp[b]=c,this)},value:function(b){return null==b?e.regexp[a].value:(e.regexp[a].value=b,this)},flags:function(b){return null==b?e.regexp[a].flags:(e.regexp[a].flags=b,this)},flagsValue:function(b){return null==b?e.regexp[a].flags_value:(e.regexp[a].flags_value=b,this)}})},w.ScriptFilter=function(a){var b=w.FilterMixin("script"),d=b.toJSON();return d.script.script=a,c(b,{script:function(a){return null==a?d.script.script:(d.script.script=a,this)},params:function(a){return null==a?d.script.params:(d.script.params=a,this)},lang:function(a){return null==a?d.script.lang:(d.script.lang=a,this)}})},w.TermFilter=function(a,b){var d=w.FilterMixin("term"),e=d.toJSON();return e.term[a]=b,c(d,{field:function(b){var c=e.term[a];return null==b?a:(delete e.term[a],a=b,e.term[a]=c,this)},term:function(b){return null==b?e.term[a]:(e.term[a]=b,this)}})},w.TermsFilter=function(a,b){var d=w.FilterMixin("terms"),f=d.toJSON(),g=function(){e(f.terms[a])||(f.terms[a]=[])},h=function(){e(f.terms[a])&&(f.terms[a]={})};return f.terms[a]=e(b)?b:[b],c(d,{field:function(b){var c=f.terms[a];return null==b?a:(delete f.terms[a],a=b,f.terms[b]=c,this)},terms:function(b){return g(),null==b?f.terms[a]:(e(b)?f.terms[a]=b:f.terms[a].push(b),this)},index:function(b){return h(),null==b?f.terms[a].index:(f.terms[a].index=b,this)},type:function(b){return h(),null==b?f.terms[a].type:(f.terms[a].type=b,this)},id:function(b){return h(),null==b?f.terms[a].id:(f.terms[a].id=b,this)},path:function(b){return h(),null==b?f.terms[a].path:(f.terms[a].path=b,this)},routing:function(b){return h(),null==b?f.terms[a].routing:(f.terms[a].routing=b,this)},cacheLookup:function(b){return h(),null==b?f.terms[a].cache:(f.terms[a].cache=b,this)},execution:function(a){return null==a?f.terms.execution:(a=a.toLowerCase(),("plain"===a||"bool"===a||"bool_nocache"===a||"and"===a||"and_nocache"===a||"or"===a||"or_nocache"===a)&&(f.terms.execution=a),this)}})},w.TypeFilter=function(a){var b=w.FilterMixin("type"),d=b.toJSON();return d.type.value=a,c(b,{type:function(a){return null==a?d.type.value:(d.type.value=a,this)}})},w.BoolQuery=function(){var a=w.QueryMixin("bool"),b=a.toJSON();
return c(a,{must:function(a){var c,d;if(null==b.bool.must&&(b.bool.must=[]),null==a)return b.bool.must;if(k(a))b.bool.must.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Query or array of Queries");for(b.bool.must=[],c=0,d=a.length;d>c;c++){if(!k(a[c]))throw new TypeError("Argument must be an array of Queries");b.bool.must.push(a[c].toJSON())}}return this},mustNot:function(a){var c,d;if(null==b.bool.must_not&&(b.bool.must_not=[]),null==a)return b.bool.must_not;if(k(a))b.bool.must_not.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Query or array of Queries");for(b.bool.must_not=[],c=0,d=a.length;d>c;c++){if(!k(a[c]))throw new TypeError("Argument must be an array of Queries");b.bool.must_not.push(a[c].toJSON())}}return this},should:function(a){var c,d;if(null==b.bool.should&&(b.bool.should=[]),null==a)return b.bool.should;if(k(a))b.bool.should.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Query or array of Queries");for(b.bool.should=[],c=0,d=a.length;d>c;c++){if(!k(a[c]))throw new TypeError("Argument must be an array of Queries");b.bool.should.push(a[c].toJSON())}}return this},adjustPureNegative:function(a){return null==a?b.bool.adjust_pure_negative:(b.bool.adjust_pure_negative=a,this)},disableCoord:function(a){return null==a?b.bool.disable_coord:(b.bool.disable_coord=a,this)},minimumNumberShouldMatch:function(a){return null==a?b.bool.minimum_number_should_match:(b.bool.minimum_number_should_match=a,this)}})},w.BoostingQuery=function(a,b,d){if(!k(a)||!k(b))throw new TypeError("Arguments must be Queries");var e=w.QueryMixin("boosting"),f=e.toJSON();return f.boosting.positive=a.toJSON(),f.boosting.negative=b.toJSON(),f.boosting.negative_boost=d,c(e,{positive:function(a){if(null==a)return f.boosting.positive;if(!k(a))throw new TypeError("Argument must be a Query");return f.boosting.positive=a.toJSON(),this},negative:function(a){if(null==a)return f.boosting.negative;if(!k(a))throw new TypeError("Argument must be a Query");return f.boosting.negative=a.toJSON(),this},negativeBoost:function(a){return null==a?f.boosting.negative_boost:(f.boosting.negative_boost=a,this)}})},w.CommonTermsQuery=function(a,b){var d=w.QueryMixin("common"),e=d.toJSON();return null==a&&(a="no_field_set"),e.common[a]={},null!=b&&(e.common[a].query=b),c(d,{field:function(b){var c=e.common[a];return null==b?a:(delete e.common[a],a=b,e.common[b]=c,this)},query:function(b){return null==b?e.common[a].query:(e.common[a].query=b,this)},analyzer:function(b){return null==b?e.common[a].analyzer:(e.common[a].analyzer=b,this)},disableCoord:function(b){return null==b?e.common[a].disable_coord:(e.common[a].disable_coord=b,this)},cutoffFrequency:function(b){return null==b?e.common[a].cutoff_frequency:(e.common[a].cutoff_frequency=b,this)},highFreqOperator:function(b){return null==b?e.common[a].high_freq_operator:(b=b.toLowerCase(),("and"===b||"or"===b)&&(e.common[a].high_freq_operator=b),this)},lowFreqOperator:function(b){return null==b?e.common[a].low_freq_operator:(b=b.toLowerCase(),("and"===b||"or"===b)&&(e.common[a].low_freq_operator=b),this)},minimumShouldMatch:function(b){return null==b?e.common[a].minimum_should_match.low_freq:(null==e.common[a].minimum_should_match&&(e.common[a].minimum_should_match={}),e.common[a].minimum_should_match.low_freq=b,this)},minimumShouldMatchLowFreq:function(a){return this.minimumShouldMatch(a)},minimumShouldMatchHighFreq:function(b){return null==b?e.common[a].minimum_should_match.high_freq:(null==e.common[a].minimum_should_match&&(e.common[a].minimum_should_match={}),e.common[a].minimum_should_match.high_freq=b,this)},boost:function(b){return null==b?e.common[a].boost:(e.common[a].boost=b,this)}})},w.ConstantScoreQuery=function(){var a=w.QueryMixin("constant_score"),b=a.toJSON();return c(a,{query:function(a){if(null==a)return b.constant_score.query;if(!k(a))throw new TypeError("Argument must be a Query");return b.constant_score.query=a.toJSON(),this},filter:function(a){if(null==a)return b.constant_score.filter;if(!m(a))throw new TypeError("Argument must be a Filter");return b.constant_score.filter=a.toJSON(),this},cache:function(a){return null==a?b.constant_score._cache:(b.constant_score._cache=a,this)},cacheKey:function(a){return null==a?b.constant_score._cache_key:(b.constant_score._cache_key=a,this)}})},w.CustomBoostFactorQuery=function(a){if(!k(a))throw new TypeError("Argument must be a Query");var b=w.QueryMixin("custom_boost_factor"),d=b.toJSON();return d.custom_boost_factor.query=a.toJSON(),c(b,{query:function(a){if(null==a)return d.custom_boost_factor.query;if(!k(a))throw new TypeError("Argument must be a Query");return d.custom_boost_factor.query=a.toJSON(),this},boostFactor:function(a){return null==a?d.custom_boost_factor.boost_factor:(d.custom_boost_factor.boost_factor=a,this)}})},w.CustomFiltersScoreQuery=function(a,d){if(!k(a))throw new TypeError("Argument must be a Query");var f=w.QueryMixin("custom_filters_score"),g=f.toJSON(),h=function(a){var b=null;return a.filter&&m(a.filter)&&(b={filter:a.filter.toJSON()},a.boost?b.boost=a.boost:a.script?b.script=a.script:b=null),b};return g.custom_filters_score.query=a.toJSON(),g.custom_filters_score.filters=[],b(e(d)?d:[d],function(a){var b=h(a);null!==b&&g.custom_filters_score.filters.push(b)}),c(f,{query:function(a){if(null==a)return g.custom_filters_score.query;if(!k(a))throw new TypeError("Argument must be a Query");return g.custom_filters_score.query=a.toJSON(),this},filters:function(a){return null==a?g.custom_filters_score.filters:(e(a)&&(g.custom_filters_score.filters=[]),b(e(a)?a:[a],function(a){var b=h(a);null!==b&&g.custom_filters_score.filters.push(b)}),this)},scoreMode:function(a){return null==a?g.custom_filters_score.score_mode:(a=a.toLowerCase(),("first"===a||"min"===a||"max"===a||"total"===a||"avg"===a||"multiply"===a)&&(g.custom_filters_score.score_mode=a),this)},params:function(a){return null==a?g.custom_filters_score.params:(g.custom_filters_score.params=a,this)},lang:function(a){return null==a?g.custom_filters_score.lang:(g.custom_filters_score.lang=a,this)},maxBoost:function(a){return null==a?g.custom_filters_score.max_boost:(g.custom_filters_score.max_boost=a,this)}})},w.CustomScoreQuery=function(a,b){if(!k(a)&&!m(a))throw new TypeError("Argument must be a Query or Filter");var d=w.QueryMixin("custom_score"),e=d.toJSON();return e.custom_score.script=b,k(a)?e.custom_score.query=a.toJSON():m(a)&&(e.custom_score.filter=a.toJSON()),c(d,{query:function(a){if(null==a)return e.custom_score.query;if(!k(a))throw new TypeError("Argument must be a Query");return e.custom_score.query=a.toJSON(),this},filter:function(a){if(null==a)return e.custom_score.filter;if(!m(a))throw new TypeError("Argument must be a Filter");return e.custom_score.filter=a.toJSON(),this},script:function(a){return null==a?e.custom_score.script:(e.custom_score.script=a,this)},params:function(a){return null==a?e.custom_score.params:(e.custom_score.params=a,this)},lang:function(a){return null==a?e.custom_score.lang:(e.custom_score.lang=a,this)}})},w.DisMaxQuery=function(){var a=w.QueryMixin("dis_max"),b=a.toJSON();return c(a,{queries:function(a){var c,d;if(null==a)return b.dis_max.queries;if(null==b.dis_max.queries&&(b.dis_max.queries=[]),k(a))b.dis_max.queries.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be a Query or array of Queries");for(b.dis_max.queries=[],c=0,d=a.length;d>c;c++){if(!k(a[c]))throw new TypeError("Argument must be array of Queries");b.dis_max.queries.push(a[c].toJSON())}}return this},tieBreaker:function(a){return null==a?b.dis_max.tie_breaker:(b.dis_max.tie_breaker=a,this)}})},w.FieldMaskingSpanQuery=function(a,b){if(!k(a))throw new TypeError("Argument must be a SpanQuery");var d=w.QueryMixin("field_masking_span"),e=d.toJSON();return e.field_masking_span.query=a.toJSON(),e.field_masking_span.field=b,c(d,{query:function(a){if(null==a)return e.field_masking_span.query;if(!k(a))throw new TypeError("Argument must be a SpanQuery");return e.field_masking_span.query=a.toJSON(),this},field:function(a){return null==a?e.field_masking_span.field:(e.field_masking_span.field=a,this)}})},w.FieldQuery=function(a,b){var d=w.QueryMixin("field"),e=d.toJSON();return e.field[a]={query:b},c(d,{field:function(b){var c=e.field[a];return null==b?a:(delete e.field[a],a=b,e.field[b]=c,this)},query:function(b){return null==b?e.field[a].query:(e.field[a].query=b,this)},defaultOperator:function(b){return null==b?e.field[a].default_operator:(b=b.toUpperCase(),("AND"===b||"OR"===b)&&(e.field[a].default_operator=b),this)},analyzer:function(b){return null==b?e.field[a].analyzer:(e.field[a].analyzer=b,this)},quoteAnalyzer:function(b){return null==b?e.field[a].quote_analyzer:(e.field[a].quote_analyzer=b,this)},autoGeneratePhraseQueries:function(b){return null==b?e.field[a].auto_generate_phrase_queries:(e.field[a].auto_generate_phrase_queries=b,this)},allowLeadingWildcard:function(b){return null==b?e.field[a].allow_leading_wildcard:(e.field[a].allow_leading_wildcard=b,this)},lowercaseExpandedTerms:function(b){return null==b?e.field[a].lowercase_expanded_terms:(e.field[a].lowercase_expanded_terms=b,this)},enablePositionIncrements:function(b){return null==b?e.field[a].enable_position_increments:(e.field[a].enable_position_increments=b,this)},fuzzyMinSim:function(b){return null==b?e.field[a].fuzzy_min_sim:(e.field[a].fuzzy_min_sim=b,this)},fuzzyPrefixLength:function(b){return null==b?e.field[a].fuzzy_prefix_length:(e.field[a].fuzzy_prefix_length=b,this)},fuzzyMaxExpansions:function(b){return null==b?e.field[a].fuzzy_max_expansions:(e.field[a].fuzzy_max_expansions=b,this)},fuzzyRewrite:function(b){return null==b?e.field[a].fuzzy_rewrite:(b=b.toLowerCase(),("constant_score_auto"===b||"scoring_boolean"===b||"constant_score_boolean"===b||"constant_score_filter"===b||0===b.indexOf("top_terms_boost_")||0===b.indexOf("top_terms_"))&&(e.field[a].fuzzy_rewrite=b),this)},rewrite:function(b){return null==b?e.field[a].rewrite:(b=b.toLowerCase(),("constant_score_auto"===b||"scoring_boolean"===b||"constant_score_boolean"===b||"constant_score_filter"===b||0===b.indexOf("top_terms_boost_")||0===b.indexOf("top_terms_"))&&(e.field[a].rewrite=b),this)},quoteFieldSuffix:function(b){return null==b?e.field[a].quote_field_suffix:(e.field[a].quote_field_suffix=b,this)},phraseSlop:function(b){return null==b?e.field[a].phrase_slop:(e.field[a].phrase_slop=b,this)},analyzeWildcard:function(b){return null==b?e.field[a].analyze_wildcard:(e.field[a].analyze_wildcard=b,this)},escape:function(b){return null==b?e.field[a].escape:(e.field[a].escape=b,this)},minimumShouldMatch:function(b){return null==b?e.field[a].minimum_should_match:(e.field[a].minimum_should_match=b,this)},boost:function(b){return null==b?e.field[a].boost:(e.field[a].boost=b,this)}})},w.FilteredQuery=function(a,b){if(!k(a))throw new TypeError("Argument must be a Query");if(null!=b&&!m(b))throw new TypeError("Argument must be a Filter");var d=w.QueryMixin("filtered"),e=d.toJSON();return e.filtered.query=a.toJSON(),null!=b&&(e.filtered.filter=b.toJSON()),c(d,{query:function(a){if(null==a)return e.filtered.query;if(!k(a))throw new TypeError("Argument must be a Query");return e.filtered.query=a.toJSON(),this},filter:function(a){if(null==a)return e.filtered.filter;if(!m(a))throw new TypeError("Argument must be a Filter");return e.filtered.filter=a.toJSON(),this},strategy:function(a){return null==a?e.filtered.strategy:(a=a.toLowerCase(),("query_first"===a||"random_access_always"===a||"leap_frog"===a||"leap_frog_filter_first"===a||0===a.indexOf("random_access_"))&&(e.filtered.strategy=a),this)},cache:function(a){return null==a?e.filtered._cache:(e.filtered._cache=a,this)},cacheKey:function(a){return null==a?e.filtered._cache_key:(e.filtered._cache_key=a,this)}})},w.FuzzyLikeThisFieldQuery=function(a,b){var d=w.QueryMixin("flt_field"),e=d.toJSON();return e.flt_field[a]={like_text:b},c(d,{field:function(b){var c=e.flt_field[a];return null==b?a:(delete e.flt_field[a],a=b,e.flt_field[b]=c,this)},likeText:function(b){return null==b?e.flt_field[a].like_text:(e.flt_field[a].like_text=b,this)},ignoreTf:function(b){return null==b?e.flt_field[a].ignore_tf:(e.flt_field[a].ignore_tf=b,this)},maxQueryTerms:function(b){return null==b?e.flt_field[a].max_query_terms:(e.flt_field[a].max_query_terms=b,this)},minSimilarity:function(b){return null==b?e.flt_field[a].min_similarity:(e.flt_field[a].min_similarity=b,this)},prefixLength:function(b){return null==b?e.flt_field[a].prefix_length:(e.flt_field[a].prefix_length=b,this)},analyzer:function(b){return null==b?e.flt_field[a].analyzer:(e.flt_field[a].analyzer=b,this)},failOnUnsupportedField:function(b){return null==b?e.flt_field[a].fail_on_unsupported_field:(e.flt_field[a].fail_on_unsupported_field=b,this)},boost:function(b){return null==b?e.flt_field[a].boost:(e.flt_field[a].boost=b,this)}})},w.FuzzyLikeThisQuery=function(a){var b=w.QueryMixin("flt"),d=b.toJSON();return d.flt.like_text=a,c(b,{fields:function(a){if(null==d.flt.fields&&(d.flt.fields=[]),null==a)return d.flt.fields;if(g(a))d.flt.fields.push(a);else{if(!e(a))throw new TypeError("Argument must be a string or array");d.flt.fields=a}return this},likeText:function(a){return null==a?d.flt.like_text:(d.flt.like_text=a,this)},ignoreTf:function(a){return null==a?d.flt.ignore_tf:(d.flt.ignore_tf=a,this)},maxQueryTerms:function(a){return null==a?d.flt.max_query_terms:(d.flt.max_query_terms=a,this)},minSimilarity:function(a){return null==a?d.flt.min_similarity:(d.flt.min_similarity=a,this)},prefixLength:function(a){return null==a?d.flt.prefix_length:(d.flt.prefix_length=a,this)},analyzer:function(a){return null==a?d.flt.analyzer:(d.flt.analyzer=a,this)},failOnUnsupportedField:function(a){return null==a?d.flt.fail_on_unsupported_field:(d.flt.fail_on_unsupported_field=a,this)}})},w.FuzzyQuery=function(a,b){var d=w.QueryMixin("fuzzy"),e=d.toJSON();return e.fuzzy[a]={value:b},c(d,{field:function(b){var c=e.fuzzy[a];return null==b?a:(delete e.fuzzy[a],a=b,e.fuzzy[b]=c,this)},value:function(b){return null==b?e.fuzzy[a].value:(e.fuzzy[a].value=b,this)},transpositions:function(b){return null==b?e.fuzzy[a].transpositions:(e.fuzzy[a].transpositions=b,this)},maxExpansions:function(b){return null==b?e.fuzzy[a].max_expansions:(e.fuzzy[a].max_expansions=b,this)},minSimilarity:function(b){return null==b?e.fuzzy[a].min_similarity:(e.fuzzy[a].min_similarity=b,this)},prefixLength:function(b){return null==b?e.fuzzy[a].prefix_length:(e.fuzzy[a].prefix_length=b,this)},rewrite:function(b){return null==b?e.fuzzy[a].rewrite:(b=b.toLowerCase(),("constant_score_auto"===b||"scoring_boolean"===b||"constant_score_boolean"===b||"constant_score_filter"===b||0===b.indexOf("top_terms_boost_")||0===b.indexOf("top_terms_"))&&(e.fuzzy[a].rewrite=b),this)},boost:function(b){return null==b?e.fuzzy[a].boost:(e.fuzzy[a].boost=b,this)}})},w.GeoShapeQuery=function(a){var b=w.QueryMixin("geo_shape"),d=b.toJSON();return d.geo_shape[a]={},c(b,{field:function(b){var c=d.geo_shape[a];return null==b?a:(delete d.geo_shape[a],a=b,d.geo_shape[b]=c,this)},shape:function(b){return null==b?d.geo_shape[a].shape:(null!=d.geo_shape[a].indexed_shape&&delete d.geo_shape[a].indexed_shape,d.geo_shape[a].shape=b.toJSON(),this)},indexedShape:function(b){return null==b?d.geo_shape[a].indexed_shape:(null!=d.geo_shape[a].shape&&delete d.geo_shape[a].shape,d.geo_shape[a].indexed_shape=b.toJSON(),this)},relation:function(b){return null==b?d.geo_shape[a].relation:(b=b.toLowerCase(),("intersects"===b||"disjoint"===b||"within"===b)&&(d.geo_shape[a].relation=b),this)},strategy:function(b){return null==b?d.geo_shape[a].strategy:(b=b.toLowerCase(),("recursive"===b||"term"===b)&&(d.geo_shape[a].strategy=b),this)},boost:function(b){return null==b?d.geo_shape[a].boost:(d.geo_shape[a].boost=b,this)}})},w.HasChildQuery=function(a,b){if(!k(a))throw new TypeError("Argument must be a valid Query");var d=w.QueryMixin("has_child"),e=d.toJSON();return e.has_child.query=a.toJSON(),e.has_child.type=b,c(d,{query:function(a){if(null==a)return e.has_child.query;if(!k(a))throw new TypeError("Argument must be a valid Query");return e.has_child.query=a.toJSON(),this},type:function(a){return null==a?e.has_child.type:(e.has_child.type=a,this)},scope:function(){return this},scoreType:function(a){return null==a?e.has_child.score_type:(a=a.toLowerCase(),("none"===a||"max"===a||"sum"===a||"avg"===a)&&(e.has_child.score_type=a),this)},scoreMode:function(a){return null==a?e.has_child.score_mode:(a=a.toLowerCase(),("none"===a||"max"===a||"sum"===a||"avg"===a)&&(e.has_child.score_mode=a),this)},shortCircuitCutoff:function(a){return null==a?e.has_child.short_circuit_cutoff:(e.has_child.short_circuit_cutoff=a,this)}})},w.HasParentQuery=function(a,b){if(!k(a))throw new TypeError("Argument must be a Query");var d=w.QueryMixin("has_parent"),e=d.toJSON();return e.has_parent.query=a.toJSON(),e.has_parent.parent_type=b,c(d,{query:function(a){if(null==a)return e.has_parent.query;if(!k(a))throw new TypeError("Argument must be a Query");return e.has_parent.query=a.toJSON(),this},parentType:function(a){return null==a?e.has_parent.parent_type:(e.has_parent.parent_type=a,this)},scope:function(){return this},scoreType:function(a){return null==a?e.has_parent.score_type:(a=a.toLowerCase(),("none"===a||"score"===a)&&(e.has_parent.score_type=a),this)},scoreMode:function(a){return null==a?e.has_parent.score_mode:(a=a.toLowerCase(),("none"===a||"score"===a)&&(e.has_parent.score_mode=a),this)}})},w.IdsQuery=function(a){var b=w.QueryMixin("ids"),d=b.toJSON();if(g(a))d.ids.values=[a];else{if(!e(a))throw new TypeError("Argument must be string or array");d.ids.values=a}return c(b,{values:function(a){if(null==a)return d.ids.values;if(g(a))d.ids.values.push(a);else{if(!e(a))throw new TypeError("Argument must be string or array");d.ids.values=a}return this},type:function(a){if(null==d.ids.type&&(d.ids.type=[]),null==a)return d.ids.type;if(g(a))d.ids.type.push(a);else{if(!e(a))throw new TypeError("Argument must be string or array");d.ids.type=a}return this}})},w.IndicesQuery=function(a,b){if(!k(a))throw new TypeError("Argument must be a Query");var d=w.QueryMixin("indices"),f=d.toJSON();if(f.indices.query=a.toJSON(),g(b))f.indices.indices=[b];else{if(!e(b))throw new TypeError("Argument must be a string or array");f.indices.indices=b}return c(d,{indices:function(a){if(null==a)return f.indices.indices;if(g(a))f.indices.indices.push(a);else{if(!e(a))throw new TypeError("Argument must be a string or array");f.indices.indices=a}return this},query:function(a){if(null==a)return f.indices.query;if(!k(a))throw new TypeError("Argument must be a Query");return f.indices.query=a.toJSON(),this},noMatchQuery:function(a){if(null==a)return f.indices.no_match_query;if(g(a))a=a.toLowerCase(),("none"===a||"all"===a)&&(f.indices.no_match_query=a);else{if(!k(a))throw new TypeError("Argument must be string or Query");f.indices.no_match_query=a.toJSON()}return this}})},w.MatchAllQuery=function(){return w.QueryMixin("match_all")},w.MatchQuery=function(a,b){var d=w.QueryMixin("match"),e=d.toJSON();return e.match[a]={query:b},c(d,{query:function(b){return null==b?e.match[a].query:(e.match[a].query=b,this)},type:function(b){return null==b?e.match[a].type:(b=b.toLowerCase(),("boolean"===b||"phrase"===b||"phrase_prefix"===b)&&(e.match[a].type=b),this)},fuzziness:function(b){return null==b?e.match[a].fuzziness:(e.match[a].fuzziness=b,this)},cutoffFrequency:function(b){return null==b?e.match[a].cutoff_frequency:(e.match[a].cutoff_frequency=b,this)},prefixLength:function(b){return null==b?e.match[a].prefix_length:(e.match[a].prefix_length=b,this)},maxExpansions:function(b){return null==b?e.match[a].max_expansions:(e.match[a].max_expansions=b,this)},operator:function(b){return null==b?e.match[a].operator:(b=b.toLowerCase(),("and"===b||"or"===b)&&(e.match[a].operator=b),this)},slop:function(b){return null==b?e.match[a].slop:(e.match[a].slop=b,this)},analyzer:function(b){return null==b?e.match[a].analyzer:(e.match[a].analyzer=b,this)},minimumShouldMatch:function(b){return null==b?e.match[a].minimum_should_match:(e.match[a].minimum_should_match=b,this)},rewrite:function(b){return null==b?e.match[a].rewrite:(b=b.toLowerCase(),("constant_score_auto"===b||"scoring_boolean"===b||"constant_score_boolean"===b||"constant_score_filter"===b||0===b.indexOf("top_terms_boost_")||0===b.indexOf("top_terms_"))&&(e.match[a].rewrite=b),this)},fuzzyRewrite:function(b){return null==b?e.match[a].fuzzy_rewrite:(b=b.toLowerCase(),("constant_score_auto"===b||"scoring_boolean"===b||"constant_score_boolean"===b||"constant_score_filter"===b||0===b.indexOf("top_terms_boost_")||0===b.indexOf("top_terms_"))&&(e.match[a].fuzzy_rewrite=b),this)},fuzzyTranspositions:function(b){return null==b?e.match[a].fuzzy_transpositions:(e.match[a].fuzzy_transpositions=b,this)},lenient:function(b){return null==b?e.match[a].lenient:(e.match[a].lenient=b,this)},zeroTermsQuery:function(b){return null==b?e.match[a].zero_terms_query:(b=b.toLowerCase(),("all"===b||"none"===b)&&(e.match[a].zero_terms_query=b),this)},boost:function(b){return null==b?e.match[a].boost:(e.match[a].boost=b,this)}})},w.MoreLikeThisFieldQuery=function(a,b){var d=w.QueryMixin("mlt_field"),e=d.toJSON();return e.mlt_field[a]={like_text:b},c(d,{field:function(b){var c=e.mlt_field[a];return null==b?a:(delete e.mlt_field[a],a=b,e.mlt_field[b]=c,this)},likeText:function(b){return null==b?e.mlt_field[a].like_text:(e.mlt_field[a].like_text=b,this)},percentTermsToMatch:function(b){return null==b?e.mlt_field[a].percent_terms_to_match:(e.mlt_field[a].percent_terms_to_match=b,this)},minTermFreq:function(b){return null==b?e.mlt_field[a].min_term_freq:(e.mlt_field[a].min_term_freq=b,this)},maxQueryTerms:function(b){return null==b?e.mlt_field[a].max_query_terms:(e.mlt_field[a].max_query_terms=b,this)},stopWords:function(b){return null==b?e.mlt_field[a].stop_words:(e.mlt_field[a].stop_words=b,this)},minDocFreq:function(b){return null==b?e.mlt_field[a].min_doc_freq:(e.mlt_field[a].min_doc_freq=b,this)},maxDocFreq:function(b){return null==b?e.mlt_field[a].max_doc_freq:(e.mlt_field[a].max_doc_freq=b,this)},minWordLen:function(b){return null==b?e.mlt_field[a].min_word_len:(e.mlt_field[a].min_word_len=b,this)},maxWordLen:function(b){return null==b?e.mlt_field[a].max_word_len:(e.mlt_field[a].max_word_len=b,this)},analyzer:function(b){return null==b?e.mlt_field[a].analyzer:(e.mlt_field[a].analyzer=b,this)},boostTerms:function(b){return null==b?e.mlt_field[a].boost_terms:(e.mlt_field[a].boost_terms=b,this)},failOnUnsupportedField:function(b){return null==b?e.mlt_field[a].fail_on_unsupported_field:(e.mlt_field[a].fail_on_unsupported_field=b,this)},boost:function(b){return null==b?e.mlt_field[a].boost:(e.mlt_field[a].boost=b,this)}})},w.MoreLikeThisQuery=function(a,b){var d=w.QueryMixin("mlt"),f=d.toJSON();if(f.mlt.like_text=b,f.mlt.fields=[],g(a))f.mlt.fields.push(a);else{if(!e(a))throw new TypeError("Argument must be string or array");f.mlt.fields=a}return c(d,{fields:function(a){if(null==a)return f.mlt.fields;if(g(a))f.mlt.fields.push(a);else{if(!e(a))throw new TypeError("Argument must be a string or array");f.mlt.fields=a}return this},likeText:function(a){return null==a?f.mlt.like_text:(f.mlt.like_text=a,this)},percentTermsToMatch:function(a){return null==a?f.mlt.percent_terms_to_match:(f.mlt.percent_terms_to_match=a,this)},minTermFreq:function(a){return null==a?f.mlt.min_term_freq:(f.mlt.min_term_freq=a,this)},maxQueryTerms:function(a){return null==a?f.mlt.max_query_terms:(f.mlt.max_query_terms=a,this)},stopWords:function(a){return null==a?f.mlt.stop_words:(f.mlt.stop_words=a,this)},minDocFreq:function(a){return null==a?f.mlt.min_doc_freq:(f.mlt.min_doc_freq=a,this)},maxDocFreq:function(a){return null==a?f.mlt.max_doc_freq:(f.mlt.max_doc_freq=a,this)},minWordLen:function(a){return null==a?f.mlt.min_word_len:(f.mlt.min_word_len=a,this)},maxWordLen:function(a){return null==a?f.mlt.max_word_len:(f.mlt.max_word_len=a,this)},analyzer:function(a){return null==a?f.mlt.analyzer:(f.mlt.analyzer=a,this)},boostTerms:function(a){return null==a?f.mlt.boost_terms:(f.mlt.boost_terms=a,this)},failOnUnsupportedField:function(a){return null==a?f.mlt.fail_on_unsupported_field:(f.mlt.fail_on_unsupported_field=a,this)}})},w.MultiMatchQuery=function(a,b){var d=w.QueryMixin("multi_match"),f=d.toJSON();if(f.multi_match.query=b,f.multi_match.fields=[],g(a))f.multi_match.fields.push(a);else{if(!e(a))throw new TypeError("Argument must be string or array");f.multi_match.fields=a}return c(d,{fields:function(a){if(null==a)return f.multi_match.fields;if(g(a))f.multi_match.fields.push(a);else{if(!e(a))throw new TypeError("Argument must be string or array");f.multi_match.fields=a}return this},useDisMax:function(a){return null==a?f.multi_match.use_dis_max:(f.multi_match.use_dis_max=a,this)},tieBreaker:function(a){return null==a?f.multi_match.tie_breaker:(f.multi_match.tie_breaker=a,this)},cutoffFrequency:function(a){return null==a?f.multi_match.cutoff_frequency:(f.multi_match.cutoff_frequency=a,this)},minimumShouldMatch:function(a){return null==a?f.multi_match.minimum_should_match:(f.multi_match.minimum_should_match=a,this)},rewrite:function(a){return null==a?f.multi_match.rewrite:(a=a.toLowerCase(),("constant_score_auto"===a||"scoring_boolean"===a||"constant_score_boolean"===a||"constant_score_filter"===a||0===a.indexOf("top_terms_boost_")||0===a.indexOf("top_terms_"))&&(f.multi_match.rewrite=a),this)},fuzzyRewrite:function(a){return null==a?f.multi_match.fuzzy_rewrite:(a=a.toLowerCase(),("constant_score_auto"===a||"scoring_boolean"===a||"constant_score_boolean"===a||"constant_score_filter"===a||0===a.indexOf("top_terms_boost_")||0===a.indexOf("top_terms_"))&&(f.multi_match.fuzzy_rewrite=a),this)},lenient:function(a){return null==a?f.multi_match.lenient:(f.multi_match.lenient=a,this)},query:function(a){return null==a?f.multi_match.query:(f.multi_match.query=a,this)},type:function(a){return null==a?f.multi_match.type:(a=a.toLowerCase(),("boolean"===a||"phrase"===a||"phrase_prefix"===a)&&(f.multi_match.type=a),this)},fuzziness:function(a){return null==a?f.multi_match.fuzziness:(f.multi_match.fuzziness=a,this)},prefixLength:function(a){return null==a?f.multi_match.prefix_length:(f.multi_match.prefix_length=a,this)},maxExpansions:function(a){return null==a?f.multi_match.max_expansions:(f.multi_match.max_expansions=a,this)},operator:function(a){return null==a?f.multi_match.operator:(a=a.toLowerCase(),("and"===a||"or"===a)&&(f.multi_match.operator=a),this)},slop:function(a){return null==a?f.multi_match.slop:(f.multi_match.slop=a,this)},analyzer:function(a){return null==a?f.multi_match.analyzer:(f.multi_match.analyzer=a,this)},zeroTermsQuery:function(a){return null==a?f.multi_match.zero_terms_query:(a=a.toLowerCase(),("all"===a||"none"===a)&&(f.multi_match.zero_terms_query=a),this)}})},w.NestedQuery=function(a){var b=w.QueryMixin("nested"),d=b.toJSON();return d.nested.path=a,c(b,{path:function(a){return null==a?d.nested.path:(d.nested.path=a,this)},query:function(a){if(null==a)return d.nested.query;if(!k(a))throw new TypeError("Argument must be a Query");return d.nested.query=a.toJSON(),this},filter:function(a){if(null==a)return d.nested.filter;if(!m(a))throw new TypeError("Argument must be a Filter");return d.nested.filter=a.toJSON(),this},scoreMode:function(a){return null==a?d.nested.score_mode:(a=a.toLowerCase(),("avg"===a||"total"===a||"max"===a||"none"===a||"sum"===a)&&(d.nested.score_mode=a),this)},scope:function(){return this}})},w.PrefixQuery=function(a,b){var d=w.QueryMixin("prefix"),e=d.toJSON();return e.prefix[a]={value:b},c(d,{field:function(b){var c=e.prefix[a];return null==b?a:(delete e.prefix[a],a=b,e.prefix[b]=c,this)},value:function(b){return null==b?e.prefix[a].value:(e.prefix[a].value=b,this)},rewrite:function(b){return null==b?e.prefix[a].rewrite:(b=b.toLowerCase(),("constant_score_auto"===b||"scoring_boolean"===b||"constant_score_boolean"===b||"constant_score_filter"===b||0===b.indexOf("top_terms_boost_")||0===b.indexOf("top_terms_"))&&(e.prefix[a].rewrite=b),this)},boost:function(b){return null==b?e.prefix[a].boost:(e.prefix[a].boost=b,this)}})},w.QueryStringQuery=function(a){var b=w.QueryMixin("query_string"),d=b.toJSON();return d.query_string.query=a,c(b,{query:function(a){return null==a?d.query_string.query:(d.query_string.query=a,this)},defaultField:function(a){return null==a?d.query_string.default_field:(d.query_string.default_field=a,this)},fields:function(a){if(null==d.query_string.fields&&(d.query_string.fields=[]),null==a)return d.query_string.fields;if(g(a))d.query_string.fields.push(a);else{if(!e(a))throw new TypeError("Argument must be a string or array");d.query_string.fields=a}return this},useDisMax:function(a){return null==a?d.query_string.use_dis_max:(d.query_string.use_dis_max=a,this)},defaultOperator:function(a){return null==a?d.query_string.default_operator:(a=a.toUpperCase(),("AND"===a||"OR"===a)&&(d.query_string.default_operator=a),this)},analyzer:function(a){return null==a?d.query_string.analyzer:(d.query_string.analyzer=a,this)},quoteAnalyzer:function(a){return null==a?d.query_string.quote_analyzer:(d.query_string.quote_analyzer=a,this)},allowLeadingWildcard:function(a){return null==a?d.query_string.allow_leading_wildcard:(d.query_string.allow_leading_wildcard=a,this)},lowercaseExpandedTerms:function(a){return null==a?d.query_string.lowercase_expanded_terms:(d.query_string.lowercase_expanded_terms=a,this)},enablePositionIncrements:function(a){return null==a?d.query_string.enable_position_increments:(d.query_string.enable_position_increments=a,this)},fuzzyPrefixLength:function(a){return null==a?d.query_string.fuzzy_prefix_length:(d.query_string.fuzzy_prefix_length=a,this)},fuzzyMinSim:function(a){return null==a?d.query_string.fuzzy_min_sim:(d.query_string.fuzzy_min_sim=a,this)},phraseSlop:function(a){return null==a?d.query_string.phrase_slop:(d.query_string.phrase_slop=a,this)},analyzeWildcard:function(a){return null==a?d.query_string.analyze_wildcard:(d.query_string.analyze_wildcard=a,this)},autoGeneratePhraseQueries:function(a){return null==a?d.query_string.auto_generate_phrase_queries:(d.query_string.auto_generate_phrase_queries=a,this)},minimumShouldMatch:function(a){return null==a?d.query_string.minimum_should_match:(d.query_string.minimum_should_match=a,this)},tieBreaker:function(a){return null==a?d.query_string.tie_breaker:(d.query_string.tie_breaker=a,this)},escape:function(a){return null==a?d.query_string.escape:(d.query_string.escape=a,this)},fuzzyMaxExpansions:function(a){return null==a?d.query_string.fuzzy_max_expansions:(d.query_string.fuzzy_max_expansions=a,this)},fuzzyRewrite:function(a){return null==a?d.query_string.fuzzy_rewrite:(a=a.toLowerCase(),("constant_score_auto"===a||"scoring_boolean"===a||"constant_score_boolean"===a||"constant_score_filter"===a||0===a.indexOf("top_terms_boost_")||0===a.indexOf("top_terms_"))&&(d.query_string.fuzzy_rewrite=a),this)},rewrite:function(a){return null==a?d.query_string.rewrite:(a=a.toLowerCase(),("constant_score_auto"===a||"scoring_boolean"===a||"constant_score_boolean"===a||"constant_score_filter"===a||0===a.indexOf("top_terms_boost_")||0===a.indexOf("top_terms_"))&&(d.query_string.rewrite=a),this)},quoteFieldSuffix:function(a){return null==a?d.query_string.quote_field_suffix:(d.query_string.quote_field_suffix=a,this)},lenient:function(a){return null==a?d.query_string.lenient:(d.query_string.lenient=a,this)}})},w.RangeQuery=function(a){var b=w.QueryMixin("range"),d=b.toJSON();return d.range[a]={},c(b,{field:function(b){var c=d.range[a];return null==b?a:(delete d.range[a],a=b,d.range[b]=c,this)},from:function(b){return null==b?d.range[a].from:(d.range[a].from=b,this)},to:function(b){return null==b?d.range[a].to:(d.range[a].to=b,this)},includeLower:function(b){return null==b?d.range[a].include_lower:(d.range[a].include_lower=b,this)},includeUpper:function(b){return null==b?d.range[a].include_upper:(d.range[a].include_upper=b,this)
-},gt:function(b){return null==b?d.range[a].gt:(d.range[a].gt=b,this)},gte:function(b){return null==b?d.range[a].gte:(d.range[a].gte=b,this)},lt:function(b){return null==b?d.range[a].lt:(d.range[a].lt=b,this)},lte:function(b){return null==b?d.range[a].lte:(d.range[a].lte=b,this)},boost:function(b){return null==b?d.range[a].boost:(d.range[a].boost=b,this)}})},w.RegexpQuery=function(a,b){var d=w.QueryMixin("regexp"),e=d.toJSON();return e.regexp[a]={value:b},c(d,{field:function(b){var c=e.regexp[a];return null==b?a:(delete e.regexp[a],a=b,e.regexp[b]=c,this)},value:function(b){return null==b?e.regexp[a].value:(e.regexp[a].value=b,this)},flags:function(b){return null==b?e.regexp[a].flags:(e.regexp[a].flags=b,this)},flagsValue:function(b){return null==b?e.regexp[a].flags_value:(e.regexp[a].flags_value=b,this)},rewrite:function(b){return null==b?e.regexp[a].rewrite:(b=b.toLowerCase(),("constant_score_auto"===b||"scoring_boolean"===b||"constant_score_boolean"===b||"constant_score_filter"===b||0===b.indexOf("top_terms_boost_")||0===b.indexOf("top_terms_"))&&(e.regexp[a].rewrite=b),this)},boost:function(b){return null==b?e.regexp[a].boost:(e.regexp[a].boost=b,this)}})},w.SpanFirstQuery=function(a,b){if(!k(a))throw new TypeError("Argument must be a SpanQuery");var d=w.QueryMixin("span_first"),e=d.toJSON();return e.span_first.match=a.toJSON(),e.span_first.end=b,c(d,{match:function(a){if(null==a)return e.span_first.match;if(!k(a))throw new TypeError("Argument must be a SpanQuery");return e.span_first.match=a.toJSON(),this},end:function(a){return null==a?e.span_first.end:(e.span_first.end=a,this)}})},w.SpanMultiTermQuery=function(a){if(null!=a&&!k(a))throw new TypeError("Argument must be a MultiTermQuery");var b=w.QueryMixin("span_multi"),d=b.toJSON();return d.span_multi.match={},null!=a&&(d.span_multi.match=a.toJSON()),c(b,{match:function(a){if(null==a)return d.span_multi.match;if(!k(a))throw new TypeError("Argument must be a MultiTermQuery");return d.span_multi.match=a.toJSON(),this}})},w.SpanNearQuery=function(a,b){var d,f,g=w.QueryMixin("span_near"),h=g.toJSON();if(h.span_near.clauses=[],h.span_near.slop=b,k(a))h.span_near.clauses.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be SpanQuery or array of SpanQueries");for(d=0,f=a.length;f>d;d++){if(!k(a[d]))throw new TypeError("Argument must be array of SpanQueries");h.span_near.clauses.push(a[d].toJSON())}}return c(g,{clauses:function(a){var b,c;if(null==a)return h.span_near.clauses;if(k(a))h.span_near.clauses.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be SpanQuery or array of SpanQueries");for(h.span_near.clauses=[],b=0,c=a.length;c>b;b++){if(!k(a[b]))throw new TypeError("Argument must be array of SpanQueries");h.span_near.clauses.push(a[b].toJSON())}}return this},slop:function(a){return null==a?h.span_near.slop:(h.span_near.slop=a,this)},inOrder:function(a){return null==a?h.span_near.in_order:(h.span_near.in_order=a,this)},collectPayloads:function(a){return null==a?h.span_near.collect_payloads:(h.span_near.collect_payloads=a,this)}})},w.SpanNotQuery=function(a,b){if(!k(a)||!k(b))throw new TypeError("Argument must be a SpanQuery");var d=w.QueryMixin("span_not"),e=d.toJSON();return e.span_not.include=a.toJSON(),e.span_not.exclude=b.toJSON(),c(d,{include:function(a){if(null==a)return e.span_not.include;if(!k(a))throw new TypeError("Argument must be a SpanQuery");return e.span_not.include=a.toJSON(),this},exclude:function(a){if(null==a)return e.span_not.exclude;if(!k(a))throw new TypeError("Argument must be a SpanQuery");return e.span_not.exclude=a.toJSON(),this}})},w.SpanOrQuery=function(a){var b,d,f=w.QueryMixin("span_or"),g=f.toJSON();if(g.span_or.clauses=[],k(a))g.span_or.clauses.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be SpanQuery or array of SpanQueries");for(b=0,d=a.length;d>b;b++){if(!k(a[b]))throw new TypeError("Argument must be array of SpanQueries");g.span_or.clauses.push(a[b].toJSON())}}return c(f,{clauses:function(a){var b,c;if(null==a)return g.span_or.clauses;if(k(a))g.span_or.clauses.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be SpanQuery or array of SpanQueries");for(g.span_or.clauses=[],b=0,c=a.length;c>b;b++){if(!k(a[b]))throw new TypeError("Argument must be array of SpanQueries");g.span_or.clauses.push(a[b].toJSON())}}return this}})},w.SpanTermQuery=function(a,b){var d=w.QueryMixin("span_term"),e=d.toJSON();return e.span_term[a]={term:b},c(d,{field:function(b){var c=e.span_term[a];return null==b?a:(delete e.span_term[a],a=b,e.span_term[b]=c,this)},term:function(b){return null==b?e.span_term[a].term:(e.span_term[a].term=b,this)},boost:function(b){return null==b?e.span_term[a].boost:(e.span_term[a].boost=b,this)}})},w.TermQuery=function(a,b){var d=w.QueryMixin("term"),e=d.toJSON();return e.term[a]={term:b},c(d,{field:function(b){var c=e.term[a];return null==b?a:(delete e.term[a],a=b,e.term[b]=c,this)},term:function(b){return null==b?e.term[a].term:(e.term[a].term=b,this)},boost:function(b){return null==b?e.term[a].boost:(e.term[a].boost=b,this)}})},w.TermsQuery=function(a,b){var d=w.QueryMixin("terms"),f=d.toJSON();if(g(b))f.terms[a]=[b];else{if(!e(b))throw new TypeError("Argument must be string or array");f.terms[a]=b}return c(d,{field:function(b){var c=f.terms[a];return null==b?a:(delete f.terms[a],a=b,f.terms[b]=c,this)},terms:function(b){if(null==b)return f.terms[a];if(g(b))f.terms[a].push(b);else{if(!e(b))throw new TypeError("Argument must be string or array");f.terms[a]=b}return this},minimumShouldMatch:function(a){return null==a?f.terms.minimum_should_match:(f.terms.minimum_should_match=a,this)},disableCoord:function(a){return null==a?f.terms.disable_coord:(f.terms.disable_coord=a,this)}})},w.TopChildrenQuery=function(a,b){if(!k(a))throw new TypeError("Argument must be a Query");var d=w.QueryMixin("top_children"),e=d.toJSON();return e.top_children.query=a.toJSON(),e.top_children.type=b,c(d,{query:function(a){if(null==a)return e.top_children.query;if(!k(a))throw new TypeError("Argument must be a Query");return e.top_children.query=a.toJSON(),this},type:function(a){return null==a?e.top_children.type:(e.top_children.type=a,this)},scope:function(){return this},score:function(a){return null==a?e.top_children.score:(a=a.toLowerCase(),("max"===a||"sum"===a||"avg"===a||"total"===a)&&(e.top_children.score=a),this)},scoreMode:function(a){return null==a?e.top_children.score_mode:(a=a.toLowerCase(),("max"===a||"sum"===a||"avg"===a||"total"===a)&&(e.top_children.score_mode=a),this)},factor:function(a){return null==a?e.top_children.factor:(e.top_children.factor=a,this)},incrementalFactor:function(a){return null==a?e.top_children.incremental_factor:(e.top_children.incremental_factor=a,this)}})},w.WildcardQuery=function(a,b){var d=w.QueryMixin("wildcard"),e=d.toJSON();return e.wildcard[a]={value:b},c(d,{field:function(b){var c=e.wildcard[a];return null==b?a:(delete e.wildcard[a],a=b,e.wildcard[b]=c,this)},value:function(b){return null==b?e.wildcard[a].value:(e.wildcard[a].value=b,this)},rewrite:function(b){return null==b?e.wildcard[a].rewrite:(b=b.toLowerCase(),("constant_score_auto"===b||"scoring_boolean"===b||"constant_score_boolean"===b||"constant_score_filter"===b||0===b.indexOf("top_terms_boost_")||0===b.indexOf("top_terms_"))&&(e.wildcard[a].rewrite=b),this)},boost:function(b){return null==b?e.wildcard[a].boost:(e.wildcard[a].boost=b,this)}})},w.GeoPoint=function(b){var c=[0,0];return null!=b&&e(b)&&2===b.length&&(c=[b[1],b[0]]),{properties:function(b){return null==b?c:(f(b)&&a(b,"lat")&&a(b,"lon")?c={lat:b.lat,lon:b.lon}:f(b)&&a(b,"geohash")&&(c={geohash:b.geohash}),this)},string:function(a){return null==a?c:(g(a)&&-1!==a.indexOf(",")&&(c=a),this)},geohash:function(a,b){return b=null!=b&&h(b)?b:12,null==a?c:(g(a)&&a.length===b&&(c=a),this)},array:function(a){return null==a?c:(e(a)&&2===a.length&&(c=[a[1],a[0]]),this)},_type:function(){return"geo point"},toJSON:function(){return c}}},w.Highlight=function(c){var d={fields:{}},h=function(b,c,e){null==b?d[c]=e:(a(d.fields,b)||(d.fields[b]={}),d.fields[b][c]=e)};return null!=c&&(g(c)?d.fields[c]={}:e(c)&&b(c,function(a){d.fields[a]={}})),{fields:function(c){return null==c?d.fields:(g(c)?a(d.fields,c)||(d.fields[c]={}):e(c)&&b(c,function(b){a(d.fields,b)||(d.fields[b]={})}),void 0)},preTags:function(a,b){return null===a&&null!=b?d.fields[b].pre_tags:null==a?d.pre_tags:(g(a)?h(b,"pre_tags",[a]):e(a)&&h(b,"pre_tags",a),this)},postTags:function(a,b){return null===a&&null!=b?d.fields[b].post_tags:null==a?d.post_tags:(g(a)?h(b,"post_tags",[a]):e(a)&&h(b,"post_tags",a),this)},order:function(a,b){return null===a&&null!=b?d.fields[b].order:null==a?d.order:(a=a.toLowerCase(),"score"===a&&h(b,"order",a),this)},tagsSchema:function(a){return null==a?d.tags_schema:(a=a.toLowerCase(),"styled"===a&&(d.tags_schema=a),this)},highlightFilter:function(a,b){return null===a&&null!=b?d.fields[b].highlight_filter:null==a?d.highlight_filter:(h(b,"highlight_filter",a),this)},fragmentSize:function(a,b){return null===a&&null!=b?d.fields[b].fragment_size:null==a?d.fragment_size:(h(b,"fragment_size",a),this)},numberOfFragments:function(a,b){return null===a&&null!=b?d.fields[b].number_of_fragments:null==a?d.number_of_fragments:(h(b,"number_of_fragments",a),this)},encoder:function(a){return null==a?d.encoder:(a=a.toLowerCase(),("default"===a||"html"===a)&&(d.encoder=a),this)},requireFieldMatch:function(a,b){return null===a&&null!=b?d.fields[b].require_field_match:null==a?d.require_field_match:(h(b,"require_field_match",a),this)},boundaryMaxScan:function(a,b){return null===a&&null!=b?d.fields[b].boundary_max_scan:null==a?d.boundary_max_scan:(h(b,"boundary_max_scan",a),this)},boundaryChars:function(a,b){return null===a&&null!=b?d.fields[b].boundary_chars:null==a?d.boundary_chars:(h(b,"boundary_chars",a),this)},type:function(a,b){return null===a&&null!=b?d.fields[b].type:null==a?d.type:(a=a.toLowerCase(),("fast-vector-highlighter"===a||"highlighter"===a)&&h(b,"type",a),this)},fragmenter:function(a,b){return null===a&&null!=b?d.fields[b].fragmenter:null==a?d.fragmenter:(a=a.toLowerCase(),("simple"===a||"span"===a)&&h(b,"fragmenter",a),this)},options:function(a,b){if(null===a&&null!=b)return d.fields[b].options;if(null==a)return d.options;if(!f(a)||e(a)||j(a))throw new TypeError("Parameter must be an object");return h(b,"options",a),this},_type:function(){return"highlight"},toJSON:function(){return d}}},w.IndexedShape=function(a,b){var c={type:a,id:b};return{type:function(a){return null==a?c.type:(c.type=a,this)},id:function(a){return null==a?c.id:(c.id=a,this)},index:function(a){return null==a?c.index:(c.index=a,this)},shapeFieldName:function(a){return null==a?c.shape_field_name:(c.shape_field_name=a,this)},_type:function(){return"indexed shape"},toJSON:function(){return c}}},w.Request=function(){var b={};return{sort:function(){var c,d;if(a(b,"sort")||(b.sort=[]),0===arguments.length)return b.sort;if(1===arguments.length){var f=arguments[0];if(g(f))b.sort.push(f);else if(s(f))b.sort.push(f.toJSON());else{if(!e(f))throw new TypeError("Argument must be string, Sort, or array");for(b.sort=[],c=0,d=f.length;d>c;c++)if(g(f[c]))b.sort.push(f[c]);else{if(!s(f[c]))throw new TypeError("Invalid object in array");b.sort.push(f[c].toJSON())}}}else if(2===arguments.length){var h=arguments[0],i=arguments[1];if(g(h)&&g(i)&&(i=i.toLowerCase(),"asc"===i||"desc"===i)){var j={};j[h]={order:i},b.sort.push(j)}}return this},trackScores:function(a){return null==a?b.track_scores:(b.track_scores=a,this)},from:function(a){return null==a?b.from:(b.from=a,this)},size:function(a){return null==a?b.size:(b.size=a,this)},timeout:function(a){return null==a?b.timeout:(b.timeout=a,this)},fields:function(a){if(null==a)return b.fields;if(null==b.fields&&(b.fields=[]),g(a))b.fields.push(a);else{if(!e(a))throw new TypeError("Argument must be string or array");b.fields=a}return this},rescore:function(a){if(null==a)return b.rescore;if(!l(a))throw new TypeError("Argument must be a Rescore");return b.rescore=a.toJSON(),this},query:function(a){if(null==a)return b.query;if(!k(a))throw new TypeError("Argument must be a Query");return b.query=a.toJSON(),this},facet:function(a){if(null==a)return b.facets;if(null==b.facets&&(b.facets={}),!n(a))throw new TypeError("Argument must be a Facet");return c(b.facets,a.toJSON()),this},filter:function(a){if(null==a)return b.filter;if(!m(a))throw new TypeError("Argument must be a Filter");return b.filter=a.toJSON(),this},highlight:function(a){if(null==a)return b.highlight;if(!t(a))throw new TypeError("Argument must be a Highlight object");return b.highlight=a.toJSON(),this},suggest:function(a){if(null==a)return b.suggest;if(null==b.suggest&&(b.suggest={}),g(a))b.suggest.text=a;else{if(!u(a))throw new TypeError("Argument must be a string or Suggest object");c(b.suggest,a.toJSON())}return this},scriptField:function(a){if(null==a)return b.script_fields;if(null==b.script_fields&&(b.script_fields={}),!o(a))throw new TypeError("Argument must be a ScriptField");return c(b.script_fields,a.toJSON()),this},indexBoost:function(a,c){return null==b.indices_boost&&(b.indices_boost={}),0===arguments.length?b.indices_boost:(b.indices_boost[a]=c,this)},explain:function(a){return null==a?b.explain:(b.explain=a,this)},version:function(a){return null==a?b.version:(b.version=a,this)},minScore:function(a){return null==a?b.min_score:(b.min_score=a,this)},_type:function(){return"request"},toJSON:function(){return b}}},w.Rescore=function(a,b){if(null!=a&&!h(a))throw new TypeError("Argument must be a Number");if(null!=b&&!k(b))throw new TypeError("Argument must be a Query");var c={query:{}};return null!=a&&(c.window_size=a),null!=b&&(c.query.rescore_query=b.toJSON()),{rescoreQuery:function(a){if(null==a)return c.query.rescore_query;if(!k(a))throw new TypeError("Argument must be a Query");return c.query.rescore_query=a.toJSON(),this},queryWeight:function(a){if(null==a)return c.query.query_weight;if(!h(a))throw new TypeError("Argument must be a Number");return c.query.query_weight=a,this},rescoreQueryWeight:function(a){if(null==a)return c.query.rescore_query_weight;if(!h(a))throw new TypeError("Argument must be a Number");return c.query.rescore_query_weight=a,this},windowSize:function(a){if(null==a)return c.window_size;if(!h(a))throw new TypeError("Argument must be a Number");return c.window_size=a,this},scoreMode:function(a){return null==a?c.query.score_mode:(a=a.toLowerCase(),("total"===a||"min"===a||"max"===a||"multiply"===a||"avg"===a)&&(c.query.score_mode=a),this)},_type:function(){return"rescore"},toJSON:function(){return c}}},w.ScriptField=function(a){var b={};return b[a]={},{lang:function(c){return null==c?b[a].lang:(b[a].lang=c,this)},script:function(c){return null==c?b[a].script:(b[a].script=c,this)},params:function(c){return null==c?b[a].params:(b[a].params=c,this)},ignoreFailure:function(c){return null==c?b[a].ignore_failure:(b[a].ignore_failure=c,this)},_type:function(){return"script field"},toJSON:function(){return b}}},w.Shape=function(a,b){var c={},d=function(a){var b=!1;return("point"===a||"linestring"===a||"polygon"===a||"multipoint"===a||"envelope"===a||"multipolygon"===a||"circle"===a||"multilinestring"===a)&&(b=!0),b};return a=a.toLowerCase(),d(a)&&(c.type=a,c.coordinates=b),{type:function(a){return null==a?c.type:(a=a.toLowerCase(),d(a)&&(c.type=a),this)},coordinates:function(a){return null==a?c.coordinates:(c.coordinates=a,this)},radius:function(a){return null==a?c.radius:(c.radius=a,this)},_type:function(){return"shape"},toJSON:function(){return c}}},w.Sort=function(a){null==a&&(a="_score");var b={},c=a,d="_geo_distance",e="_script";return b[c]={},{field:function(d){var e=b[c];return null==d?a:(delete b[c],a=d,c=d,b[c]=e,this)},geoDistance:function(e){var f=b[c];if(null==e)return b[c][a];if(!p(e))throw new TypeError("Argument must be a GeoPoint");return delete b[c],c=d,b[c]=f,b[c][a]=e.toJSON(),this},script:function(a){var d=b[c];return null==a?b[c].script:(delete b[c],c=e,b[c]=d,b[c].script=a,this)},order:function(a){return null==a?b[c].order:(a=a.toLowerCase(),("asc"===a||"desc"===a)&&(b[c].order=a),this)},asc:function(){return b[c].order="asc",this},desc:function(){return b[c].order="desc",this},reverse:function(a){return null==a?b[c].reverse:(b[c].reverse=a,this)},missing:function(a){return null==a?b[c].missing:(b[c].missing=a,this)},ignoreUnmapped:function(a){return null==a?b[c].ignore_unmapped:(b[c].ignore_unmapped=a,this)},unit:function(a){return null==a?b[c].unit:(a=a.toLowerCase(),("mi"===a||"km"===a)&&(b[c].unit=a),this)},normalize:function(a){return null==a?b[c].normalize:(b[c].normalize=a,this)},distanceType:function(a){return null==a?b[c].distance_type:(a=a.toLowerCase(),("arc"===a||"plane"===a)&&(b[c].distance_type=a),this)},params:function(a){return null==a?b[c].params:(b[c].params=a,this)},lang:function(a){return null==a?b[c].lang:(b[c].lang=a,this)},type:function(a){return null==a?b[c].type:(a=a.toLowerCase(),("string"===a||"number"===a)&&(b[c].type=a),this)},mode:function(a){return null==a?b[c].mode:(a=a.toLowerCase(),("min"===a||"max"===a||"sum"===a||"avg"===a)&&(b[c].mode=a),this)},nestedPath:function(a){return null==a?b[c].nested_path:(b[c].nested_path=a,this)},nestedFilter:function(a){if(null==a)return b[c].nested_filter;if(!m(a))throw new TypeError("Argument must be a Filter");return b[c].nested_filter=a.toJSON(),this},_type:function(){return"sort"},toJSON:function(){return b}}},w.CompletionSuggester=function(a){var b,d=w.SuggesterMixin(a),e=d.toJSON();return e[a].completion={},b=w.SuggestContextMixin(e[a].completion),c(d,b,{fuzzy:function(b){return null==b?e[a].completion.fuzzy:(b&&null==e[a].completion.fuzzy?e[a].completion.fuzzy={}:b||null==e[a].completion.fuzzy||delete e[a].completion.fuzzy,this)},transpositions:function(b){return null==e[a].completion.fuzzy&&(e[a].completion.fuzzy={}),null==b?e[a].completion.fuzzy.transpositions:(e[a].completion.fuzzy.transpositions=b,this)},unicodeAware:function(b){return null==e[a].completion.fuzzy&&(e[a].completion.fuzzy={}),null==b?e[a].completion.fuzzy.unicode_aware:(e[a].completion.fuzzy.unicode_aware=b,this)},editDistance:function(b){return null==e[a].completion.fuzzy&&(e[a].completion.fuzzy={}),null==b?e[a].completion.fuzzy.edit_distance:(e[a].completion.fuzzy.edit_distance=b,this)},minLength:function(b){return null==e[a].completion.fuzzy&&(e[a].completion.fuzzy={}),null==b?e[a].completion.fuzzy.min_length:(e[a].completion.fuzzy.min_length=b,this)},prefixLength:function(b){return null==e[a].completion.fuzzy&&(e[a].completion.fuzzy={}),null==b?e[a].completion.fuzzy.prefix_length:(e[a].completion.fuzzy.prefix_length=b,this)}})},w.DirectGenerator=function(){var a={},b=w.DirectSettingsMixin(a);return c(b,{preFilter:function(b){return null==b?a.pre_filter:(a.pre_filter=b,this)},postFilter:function(b){return null==b?a.post_filter:(a.post_filter=b,this)},field:function(b){return null==b?a.field:(a.field=b,this)},size:function(b){return null==b?a.size:(a.size=b,this)},_type:function(){return"generator"},toJSON:function(){return a}})},w.PhraseSuggester=function(a){var b,d=w.SuggesterMixin(a),f=d.toJSON();return f[a].phrase={},b=w.SuggestContextMixin(f[a].phrase),c(d,b,{realWorldErrorLikelihood:function(b){return null==b?f[a].phrase.real_world_error_likelihood:(f[a].phrase.real_world_error_likelihood=b,this)},confidence:function(b){return null==b?f[a].phrase.confidence:(f[a].phrase.confidence=b,this)},separator:function(b){return null==b?f[a].phrase.separator:(f[a].phrase.separator=b,this)},maxErrors:function(b){return null==b?f[a].phrase.max_errors:(f[a].phrase.max_errors=b,this)},gramSize:function(b){return null==b?f[a].phrase.gram_size:(f[a].phrase.gram_size=b,this)},forceUnigrams:function(b){return null==b?f[a].phrase.force_unigrams:(f[a].phrase.force_unigrams=b,this)},tokenLimit:function(b){return null==b?f[a].phrase.token_limit:(f[a].phrase.token_limit=b,this)},linearSmoothing:function(b,c,d){return 0===arguments.length?f[a].phrase.smoothing:(f[a].phrase.smoothing={linear:{trigram_lambda:b,bigram_lambda:c,unigram_lambda:d}},this)},laplaceSmoothing:function(b){return null==b?f[a].phrase.smoothing:(f[a].phrase.smoothing={laplace:{alpha:b}},this)},stupidBackoffSmoothing:function(b){return null==b?f[a].phrase.smoothing:(f[a].phrase.smoothing={stupid_backoff:{discount:b}},this)},highlight:function(b,c){return 0===arguments.length?f[a].phrase.highlight:(f[a].phrase.highlight={pre_tag:b,post_tag:c},this)},directGenerator:function(b){var c,d;if(null==f[a].phrase.direct_generator&&(f[a].phrase.direct_generator=[]),null==b)return f[a].phrase.direct_generator;if(v(b))f[a].phrase.direct_generator.push(b.toJSON());else{if(!e(b))throw new TypeError("Argument must be a Generator or array of Generators");for(f[a].phrase.direct_generator=[],c=0,d=b.length;d>c;c++){if(!v(b[c]))throw new TypeError("Argument must be an array of Generators");f[a].phrase.direct_generator.push(b[c].toJSON())}}return this}})},w.TermSuggester=function(a){var b,d,e=w.SuggesterMixin(a),f=e.toJSON();return f[a].term={},b=w.DirectSettingsMixin(f[a].term),d=w.SuggestContextMixin(f[a].term),c(e,b,d)},w.noConflict=function(){return x.ejs=y,this}}).call(this);
\ No newline at end of file
+},gt:function(b){return null==b?d.range[a].gt:(d.range[a].gt=b,this)},gte:function(b){return null==b?d.range[a].gte:(d.range[a].gte=b,this)},lt:function(b){return null==b?d.range[a].lt:(d.range[a].lt=b,this)},lte:function(b){return null==b?d.range[a].lte:(d.range[a].lte=b,this)},boost:function(b){return null==b?d.range[a].boost:(d.range[a].boost=b,this)}})},w.RegexpQuery=function(a,b){var d=w.QueryMixin("regexp"),e=d.toJSON();return e.regexp[a]={value:b},c(d,{field:function(b){var c=e.regexp[a];return null==b?a:(delete e.regexp[a],a=b,e.regexp[b]=c,this)},value:function(b){return null==b?e.regexp[a].value:(e.regexp[a].value=b,this)},flags:function(b){return null==b?e.regexp[a].flags:(e.regexp[a].flags=b,this)},flagsValue:function(b){return null==b?e.regexp[a].flags_value:(e.regexp[a].flags_value=b,this)},rewrite:function(b){return null==b?e.regexp[a].rewrite:(b=b.toLowerCase(),("constant_score_auto"===b||"scoring_boolean"===b||"constant_score_boolean"===b||"constant_score_filter"===b||0===b.indexOf("top_terms_boost_")||0===b.indexOf("top_terms_"))&&(e.regexp[a].rewrite=b),this)},boost:function(b){return null==b?e.regexp[a].boost:(e.regexp[a].boost=b,this)}})},w.SpanFirstQuery=function(a,b){if(!k(a))throw new TypeError("Argument must be a SpanQuery");var d=w.QueryMixin("span_first"),e=d.toJSON();return e.span_first.match=a.toJSON(),e.span_first.end=b,c(d,{match:function(a){if(null==a)return e.span_first.match;if(!k(a))throw new TypeError("Argument must be a SpanQuery");return e.span_first.match=a.toJSON(),this},end:function(a){return null==a?e.span_first.end:(e.span_first.end=a,this)}})},w.SpanMultiTermQuery=function(a){if(null!=a&&!k(a))throw new TypeError("Argument must be a MultiTermQuery");var b=w.QueryMixin("span_multi"),d=b.toJSON();return d.span_multi.match={},null!=a&&(d.span_multi.match=a.toJSON()),c(b,{match:function(a){if(null==a)return d.span_multi.match;if(!k(a))throw new TypeError("Argument must be a MultiTermQuery");return d.span_multi.match=a.toJSON(),this}})},w.SpanNearQuery=function(a,b){var d,f,g=w.QueryMixin("span_near"),h=g.toJSON();if(h.span_near.clauses=[],h.span_near.slop=b,k(a))h.span_near.clauses.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be SpanQuery or array of SpanQueries");for(d=0,f=a.length;f>d;d++){if(!k(a[d]))throw new TypeError("Argument must be array of SpanQueries");h.span_near.clauses.push(a[d].toJSON())}}return c(g,{clauses:function(a){var b,c;if(null==a)return h.span_near.clauses;if(k(a))h.span_near.clauses.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be SpanQuery or array of SpanQueries");for(h.span_near.clauses=[],b=0,c=a.length;c>b;b++){if(!k(a[b]))throw new TypeError("Argument must be array of SpanQueries");h.span_near.clauses.push(a[b].toJSON())}}return this},slop:function(a){return null==a?h.span_near.slop:(h.span_near.slop=a,this)},inOrder:function(a){return null==a?h.span_near.in_order:(h.span_near.in_order=a,this)},collectPayloads:function(a){return null==a?h.span_near.collect_payloads:(h.span_near.collect_payloads=a,this)}})},w.SpanNotQuery=function(a,b){if(!k(a)||!k(b))throw new TypeError("Argument must be a SpanQuery");var d=w.QueryMixin("span_not"),e=d.toJSON();return e.span_not.include=a.toJSON(),e.span_not.exclude=b.toJSON(),c(d,{include:function(a){if(null==a)return e.span_not.include;if(!k(a))throw new TypeError("Argument must be a SpanQuery");return e.span_not.include=a.toJSON(),this},exclude:function(a){if(null==a)return e.span_not.exclude;if(!k(a))throw new TypeError("Argument must be a SpanQuery");return e.span_not.exclude=a.toJSON(),this}})},w.SpanOrQuery=function(a){var b,d,f=w.QueryMixin("span_or"),g=f.toJSON();if(g.span_or.clauses=[],k(a))g.span_or.clauses.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be SpanQuery or array of SpanQueries");for(b=0,d=a.length;d>b;b++){if(!k(a[b]))throw new TypeError("Argument must be array of SpanQueries");g.span_or.clauses.push(a[b].toJSON())}}return c(f,{clauses:function(a){var b,c;if(null==a)return g.span_or.clauses;if(k(a))g.span_or.clauses.push(a.toJSON());else{if(!e(a))throw new TypeError("Argument must be SpanQuery or array of SpanQueries");for(g.span_or.clauses=[],b=0,c=a.length;c>b;b++){if(!k(a[b]))throw new TypeError("Argument must be array of SpanQueries");g.span_or.clauses.push(a[b].toJSON())}}return this}})},w.SpanTermQuery=function(a,b){var d=w.QueryMixin("span_term"),e=d.toJSON();return e.span_term[a]={term:b},c(d,{field:function(b){var c=e.span_term[a];return null==b?a:(delete e.span_term[a],a=b,e.span_term[b]=c,this)},term:function(b){return null==b?e.span_term[a].term:(e.span_term[a].term=b,this)},boost:function(b){return null==b?e.span_term[a].boost:(e.span_term[a].boost=b,this)}})},w.TermQuery=function(a,b){var d=w.QueryMixin("term"),e=d.toJSON();return e.term[a]={term:b},c(d,{field:function(b){var c=e.term[a];return null==b?a:(delete e.term[a],a=b,e.term[b]=c,this)},term:function(b){return null==b?e.term[a].term:(e.term[a].term=b,this)},boost:function(b){return null==b?e.term[a].boost:(e.term[a].boost=b,this)}})},w.TermsQuery=function(a,b){var d=w.QueryMixin("terms"),f=d.toJSON();if(g(b))f.terms[a]=[b];else{if(!e(b))throw new TypeError("Argument must be string or array");f.terms[a]=b}return c(d,{field:function(b){var c=f.terms[a];return null==b?a:(delete f.terms[a],a=b,f.terms[b]=c,this)},terms:function(b){if(null==b)return f.terms[a];if(g(b))f.terms[a].push(b);else{if(!e(b))throw new TypeError("Argument must be string or array");f.terms[a]=b}return this},minimumShouldMatch:function(a){return null==a?f.terms.minimum_should_match:(f.terms.minimum_should_match=a,this)},disableCoord:function(a){return null==a?f.terms.disable_coord:(f.terms.disable_coord=a,this)}})},w.TopChildrenQuery=function(a,b){if(!k(a))throw new TypeError("Argument must be a Query");var d=w.QueryMixin("top_children"),e=d.toJSON();return e.top_children.query=a.toJSON(),e.top_children.type=b,c(d,{query:function(a){if(null==a)return e.top_children.query;if(!k(a))throw new TypeError("Argument must be a Query");return e.top_children.query=a.toJSON(),this},type:function(a){return null==a?e.top_children.type:(e.top_children.type=a,this)},scope:function(){return this},score:function(a){return null==a?e.top_children.score:(a=a.toLowerCase(),("max"===a||"sum"===a||"avg"===a||"total"===a)&&(e.top_children.score=a),this)},scoreMode:function(a){return null==a?e.top_children.score_mode:(a=a.toLowerCase(),("max"===a||"sum"===a||"avg"===a||"total"===a)&&(e.top_children.score_mode=a),this)},factor:function(a){return null==a?e.top_children.factor:(e.top_children.factor=a,this)},incrementalFactor:function(a){return null==a?e.top_children.incremental_factor:(e.top_children.incremental_factor=a,this)}})},w.WildcardQuery=function(a,b){var d=w.QueryMixin("wildcard"),e=d.toJSON();return e.wildcard[a]={value:b},c(d,{field:function(b){var c=e.wildcard[a];return null==b?a:(delete e.wildcard[a],a=b,e.wildcard[b]=c,this)},value:function(b){return null==b?e.wildcard[a].value:(e.wildcard[a].value=b,this)},rewrite:function(b){return null==b?e.wildcard[a].rewrite:(b=b.toLowerCase(),("constant_score_auto"===b||"scoring_boolean"===b||"constant_score_boolean"===b||"constant_score_filter"===b||0===b.indexOf("top_terms_boost_")||0===b.indexOf("top_terms_"))&&(e.wildcard[a].rewrite=b),this)},boost:function(b){return null==b?e.wildcard[a].boost:(e.wildcard[a].boost=b,this)}})},w.GeoPoint=function(b){var c=[0,0];return null!=b&&e(b)&&2===b.length&&(c=[b[1],b[0]]),{properties:function(b){return null==b?c:(f(b)&&a(b,"lat")&&a(b,"lon")?c={lat:b.lat,lon:b.lon}:f(b)&&a(b,"geohash")&&(c={geohash:b.geohash}),this)},string:function(a){return null==a?c:(g(a)&&-1!==a.indexOf(",")&&(c=a),this)},geohash:function(a,b){return b=null!=b&&h(b)?b:12,null==a?c:(g(a)&&a.length===b&&(c=a),this)},array:function(a){return null==a?c:(e(a)&&2===a.length&&(c=[a[1],a[0]]),this)},_type:function(){return"geo point"},toJSON:function(){return c}}},w.Highlight=function(c){var d={fields:{}},h=function(b,c,e){null==b?d[c]=e:(a(d.fields,b)||(d.fields[b]={}),d.fields[b][c]=e)};return null!=c&&(g(c)?d.fields[c]={}:e(c)&&b(c,function(a){d.fields[a]={}})),{fields:function(c){return null==c?d.fields:(g(c)?a(d.fields,c)||(d.fields[c]={}):e(c)&&b(c,function(b){a(d.fields,b)||(d.fields[b]={})}),void 0)},preTags:function(a,b){return null===a&&null!=b?d.fields[b].pre_tags:null==a?d.pre_tags:(g(a)?h(b,"pre_tags",[a]):e(a)&&h(b,"pre_tags",a),this)},postTags:function(a,b){return null===a&&null!=b?d.fields[b].post_tags:null==a?d.post_tags:(g(a)?h(b,"post_tags",[a]):e(a)&&h(b,"post_tags",a),this)},order:function(a,b){return null===a&&null!=b?d.fields[b].order:null==a?d.order:(a=a.toLowerCase(),"score"===a&&h(b,"order",a),this)},tagsSchema:function(a){return null==a?d.tags_schema:(a=a.toLowerCase(),"styled"===a&&(d.tags_schema=a),this)},highlightFilter:function(a,b){return null===a&&null!=b?d.fields[b].highlight_filter:null==a?d.highlight_filter:(h(b,"highlight_filter",a),this)},fragmentSize:function(a,b){return null===a&&null!=b?d.fields[b].fragment_size:null==a?d.fragment_size:(h(b,"fragment_size",a),this)},numberOfFragments:function(a,b){return null===a&&null!=b?d.fields[b].number_of_fragments:null==a?d.number_of_fragments:(h(b,"number_of_fragments",a),this)},encoder:function(a){return null==a?d.encoder:(a=a.toLowerCase(),("default"===a||"html"===a)&&(d.encoder=a),this)},requireFieldMatch:function(a,b){return null===a&&null!=b?d.fields[b].require_field_match:null==a?d.require_field_match:(h(b,"require_field_match",a),this)},boundaryMaxScan:function(a,b){return null===a&&null!=b?d.fields[b].boundary_max_scan:null==a?d.boundary_max_scan:(h(b,"boundary_max_scan",a),this)},boundaryChars:function(a,b){return null===a&&null!=b?d.fields[b].boundary_chars:null==a?d.boundary_chars:(h(b,"boundary_chars",a),this)},type:function(a,b){return null===a&&null!=b?d.fields[b].type:null==a?d.type:(a=a.toLowerCase(),("fast-vector-highlighter"===a||"highlighter"===a)&&h(b,"type",a),this)},fragmenter:function(a,b){return null===a&&null!=b?d.fields[b].fragmenter:null==a?d.fragmenter:(a=a.toLowerCase(),("simple"===a||"span"===a)&&h(b,"fragmenter",a),this)},options:function(a,b){if(null===a&&null!=b)return d.fields[b].options;if(null==a)return d.options;if(!f(a)||e(a)||j(a))throw new TypeError("Parameter must be an object");return h(b,"options",a),this},_type:function(){return"highlight"},toJSON:function(){return d}}},w.IndexedShape=function(a,b){var c={type:a,id:b};return{type:function(a){return null==a?c.type:(c.type=a,this)},id:function(a){return null==a?c.id:(c.id=a,this)},index:function(a){return null==a?c.index:(c.index=a,this)},shapeFieldName:function(a){return null==a?c.shape_field_name:(c.shape_field_name=a,this)},_type:function(){return"indexed shape"},toJSON:function(){return c}}},w.Request=function(){var b={};return{sort:function(){var c,d;if(a(b,"sort")||(b.sort=[]),0===arguments.length)return b.sort;if(1===arguments.length){var f=arguments[0];if(g(f))b.sort.push(f);else if(s(f))b.sort.push(f.toJSON());else{if(!e(f))throw new TypeError("Argument must be string, Sort, or array");for(b.sort=[],c=0,d=f.length;d>c;c++)if(g(f[c]))b.sort.push(f[c]);else{if(!s(f[c]))throw new TypeError("Invalid object in array");b.sort.push(f[c].toJSON())}}}else if(2===arguments.length){var h=arguments[0],i=arguments[1];if(g(h)&&g(i)&&(i=i.toLowerCase(),"asc"===i||"desc"===i)){var j={};j[h]={order:i},b.sort.push(j)}}return this},trackScores:function(a){return null==a?b.track_scores:(b.track_scores=a,this)},from:function(a){return null==a?b.from:(b.from=a,this)},size:function(a){return null==a?b.size:(b.size=a,this)},timeout:function(a){return null==a?b.timeout:(b.timeout=a,this)},fields:function(a){if(null==a)return b.fields;if(null==b.fields&&(b.fields=[]),g(a))b.fields.push(a);else{if(!e(a))throw new TypeError("Argument must be a string or an array");b.fields=a}return this},partialFields:function(a,c,d){if(!g(a))throw new TypeError("Argument partialName must be a String");if(null!=c&&!e(c)&&!g(c))throw new TypeError("Argument includes must be a string or an array");if(null!=d&&!e(d)&&!g(d))throw new TypeError("Argument excludes must be a string or an array");return null==b.partial_fields&&(b.partial_fields={}),null==c&&null==d?b.partial_fields[a]:(b.partial_fields[a]={},null!=c&&(b.partial_fields[a].include=c),null!=d&&(b.partial_fields[a].exclude=d),this)},rescore:function(a){if(null==a)return b.rescore;if(!l(a))throw new TypeError("Argument must be a Rescore");return b.rescore=a.toJSON(),this},query:function(a){if(null==a)return b.query;if(!k(a))throw new TypeError("Argument must be a Query");return b.query=a.toJSON(),this},facet:function(a){if(null==a)return b.facets;if(null==b.facets&&(b.facets={}),!n(a))throw new TypeError("Argument must be a Facet");return c(b.facets,a.toJSON()),this},filter:function(a){if(null==a)return b.filter;if(!m(a))throw new TypeError("Argument must be a Filter");return b.filter=a.toJSON(),this},highlight:function(a){if(null==a)return b.highlight;if(!t(a))throw new TypeError("Argument must be a Highlight object");return b.highlight=a.toJSON(),this},suggest:function(a){if(null==a)return b.suggest;if(null==b.suggest&&(b.suggest={}),g(a))b.suggest.text=a;else{if(!u(a))throw new TypeError("Argument must be a string or Suggest object");c(b.suggest,a.toJSON())}return this},scriptField:function(a){if(null==a)return b.script_fields;if(null==b.script_fields&&(b.script_fields={}),!o(a))throw new TypeError("Argument must be a ScriptField");return c(b.script_fields,a.toJSON()),this},indexBoost:function(a,c){return null==b.indices_boost&&(b.indices_boost={}),0===arguments.length?b.indices_boost:(b.indices_boost[a]=c,this)},explain:function(a){return null==a?b.explain:(b.explain=a,this)},version:function(a){return null==a?b.version:(b.version=a,this)},minScore:function(a){return null==a?b.min_score:(b.min_score=a,this)},_type:function(){return"request"},toJSON:function(){return b}}},w.Rescore=function(a,b){if(null!=a&&!h(a))throw new TypeError("Argument must be a Number");if(null!=b&&!k(b))throw new TypeError("Argument must be a Query");var c={query:{}};return null!=a&&(c.window_size=a),null!=b&&(c.query.rescore_query=b.toJSON()),{rescoreQuery:function(a){if(null==a)return c.query.rescore_query;if(!k(a))throw new TypeError("Argument must be a Query");return c.query.rescore_query=a.toJSON(),this},queryWeight:function(a){if(null==a)return c.query.query_weight;if(!h(a))throw new TypeError("Argument must be a Number");return c.query.query_weight=a,this},rescoreQueryWeight:function(a){if(null==a)return c.query.rescore_query_weight;if(!h(a))throw new TypeError("Argument must be a Number");return c.query.rescore_query_weight=a,this},windowSize:function(a){if(null==a)return c.window_size;if(!h(a))throw new TypeError("Argument must be a Number");return c.window_size=a,this},scoreMode:function(a){return null==a?c.query.score_mode:(a=a.toLowerCase(),("total"===a||"min"===a||"max"===a||"multiply"===a||"avg"===a)&&(c.query.score_mode=a),this)},_type:function(){return"rescore"},toJSON:function(){return c}}},w.ScriptField=function(a){var b={};return b[a]={},{lang:function(c){return null==c?b[a].lang:(b[a].lang=c,this)},script:function(c){return null==c?b[a].script:(b[a].script=c,this)},params:function(c){return null==c?b[a].params:(b[a].params=c,this)},ignoreFailure:function(c){return null==c?b[a].ignore_failure:(b[a].ignore_failure=c,this)},_type:function(){return"script field"},toJSON:function(){return b}}},w.Shape=function(a,b){var c={},d=function(a){var b=!1;return("point"===a||"linestring"===a||"polygon"===a||"multipoint"===a||"envelope"===a||"multipolygon"===a||"circle"===a||"multilinestring"===a)&&(b=!0),b};return a=a.toLowerCase(),d(a)&&(c.type=a,c.coordinates=b),{type:function(a){return null==a?c.type:(a=a.toLowerCase(),d(a)&&(c.type=a),this)},coordinates:function(a){return null==a?c.coordinates:(c.coordinates=a,this)},radius:function(a){return null==a?c.radius:(c.radius=a,this)},_type:function(){return"shape"},toJSON:function(){return c}}},w.Sort=function(a){null==a&&(a="_score");var b={},c=a,d="_geo_distance",e="_script";return b[c]={},{field:function(d){var e=b[c];return null==d?a:(delete b[c],a=d,c=d,b[c]=e,this)},geoDistance:function(e){var f=b[c];if(null==e)return b[c][a];if(!p(e))throw new TypeError("Argument must be a GeoPoint");return delete b[c],c=d,b[c]=f,b[c][a]=e.toJSON(),this},script:function(a){var d=b[c];return null==a?b[c].script:(delete b[c],c=e,b[c]=d,b[c].script=a,this)},order:function(a){return null==a?b[c].order:(a=a.toLowerCase(),("asc"===a||"desc"===a)&&(b[c].order=a),this)},asc:function(){return b[c].order="asc",this},desc:function(){return b[c].order="desc",this},reverse:function(a){return null==a?b[c].reverse:(b[c].reverse=a,this)},missing:function(a){return null==a?b[c].missing:(b[c].missing=a,this)},ignoreUnmapped:function(a){return null==a?b[c].ignore_unmapped:(b[c].ignore_unmapped=a,this)},unit:function(a){return null==a?b[c].unit:(a=a.toLowerCase(),("mi"===a||"km"===a)&&(b[c].unit=a),this)},normalize:function(a){return null==a?b[c].normalize:(b[c].normalize=a,this)},distanceType:function(a){return null==a?b[c].distance_type:(a=a.toLowerCase(),("arc"===a||"plane"===a)&&(b[c].distance_type=a),this)},params:function(a){return null==a?b[c].params:(b[c].params=a,this)},lang:function(a){return null==a?b[c].lang:(b[c].lang=a,this)},type:function(a){return null==a?b[c].type:(a=a.toLowerCase(),("string"===a||"number"===a)&&(b[c].type=a),this)},mode:function(a){return null==a?b[c].mode:(a=a.toLowerCase(),("min"===a||"max"===a||"sum"===a||"avg"===a)&&(b[c].mode=a),this)},nestedPath:function(a){return null==a?b[c].nested_path:(b[c].nested_path=a,this)},nestedFilter:function(a){if(null==a)return b[c].nested_filter;if(!m(a))throw new TypeError("Argument must be a Filter");return b[c].nested_filter=a.toJSON(),this},_type:function(){return"sort"},toJSON:function(){return b}}},w.CompletionSuggester=function(a){var b,d=w.SuggesterMixin(a),e=d.toJSON();return e[a].completion={},b=w.SuggestContextMixin(e[a].completion),c(d,b,{fuzzy:function(b){return null==b?e[a].completion.fuzzy:(b&&null==e[a].completion.fuzzy?e[a].completion.fuzzy={}:b||null==e[a].completion.fuzzy||delete e[a].completion.fuzzy,this)},transpositions:function(b){return null==e[a].completion.fuzzy&&(e[a].completion.fuzzy={}),null==b?e[a].completion.fuzzy.transpositions:(e[a].completion.fuzzy.transpositions=b,this)},unicodeAware:function(b){return null==e[a].completion.fuzzy&&(e[a].completion.fuzzy={}),null==b?e[a].completion.fuzzy.unicode_aware:(e[a].completion.fuzzy.unicode_aware=b,this)},editDistance:function(b){return null==e[a].completion.fuzzy&&(e[a].completion.fuzzy={}),null==b?e[a].completion.fuzzy.edit_distance:(e[a].completion.fuzzy.edit_distance=b,this)},minLength:function(b){return null==e[a].completion.fuzzy&&(e[a].completion.fuzzy={}),null==b?e[a].completion.fuzzy.min_length:(e[a].completion.fuzzy.min_length=b,this)},prefixLength:function(b){return null==e[a].completion.fuzzy&&(e[a].completion.fuzzy={}),null==b?e[a].completion.fuzzy.prefix_length:(e[a].completion.fuzzy.prefix_length=b,this)}})},w.DirectGenerator=function(){var a={},b=w.DirectSettingsMixin(a);return c(b,{preFilter:function(b){return null==b?a.pre_filter:(a.pre_filter=b,this)},postFilter:function(b){return null==b?a.post_filter:(a.post_filter=b,this)},field:function(b){return null==b?a.field:(a.field=b,this)},size:function(b){return null==b?a.size:(a.size=b,this)},_type:function(){return"generator"},toJSON:function(){return a}})},w.PhraseSuggester=function(a){var b,d=w.SuggesterMixin(a),f=d.toJSON();return f[a].phrase={},b=w.SuggestContextMixin(f[a].phrase),c(d,b,{realWorldErrorLikelihood:function(b){return null==b?f[a].phrase.real_world_error_likelihood:(f[a].phrase.real_world_error_likelihood=b,this)},confidence:function(b){return null==b?f[a].phrase.confidence:(f[a].phrase.confidence=b,this)},separator:function(b){return null==b?f[a].phrase.separator:(f[a].phrase.separator=b,this)},maxErrors:function(b){return null==b?f[a].phrase.max_errors:(f[a].phrase.max_errors=b,this)},gramSize:function(b){return null==b?f[a].phrase.gram_size:(f[a].phrase.gram_size=b,this)},forceUnigrams:function(b){return null==b?f[a].phrase.force_unigrams:(f[a].phrase.force_unigrams=b,this)},tokenLimit:function(b){return null==b?f[a].phrase.token_limit:(f[a].phrase.token_limit=b,this)},linearSmoothing:function(b,c,d){return 0===arguments.length?f[a].phrase.smoothing:(f[a].phrase.smoothing={linear:{trigram_lambda:b,bigram_lambda:c,unigram_lambda:d}},this)},laplaceSmoothing:function(b){return null==b?f[a].phrase.smoothing:(f[a].phrase.smoothing={laplace:{alpha:b}},this)},stupidBackoffSmoothing:function(b){return null==b?f[a].phrase.smoothing:(f[a].phrase.smoothing={stupid_backoff:{discount:b}},this)},highlight:function(b,c){return 0===arguments.length?f[a].phrase.highlight:(f[a].phrase.highlight={pre_tag:b,post_tag:c},this)},directGenerator:function(b){var c,d;if(null==f[a].phrase.direct_generator&&(f[a].phrase.direct_generator=[]),null==b)return f[a].phrase.direct_generator;if(v(b))f[a].phrase.direct_generator.push(b.toJSON());else{if(!e(b))throw new TypeError("Argument must be a Generator or array of Generators");for(f[a].phrase.direct_generator=[],c=0,d=b.length;d>c;c++){if(!v(b[c]))throw new TypeError("Argument must be an array of Generators");f[a].phrase.direct_generator.push(b[c].toJSON())}}return this}})},w.TermSuggester=function(a){var b,d,e=w.SuggesterMixin(a),f=e.toJSON();return f[a].term={},b=w.DirectSettingsMixin(f[a].term),d=w.SuggestContextMixin(f[a].term),c(e,b,d)},w.noConflict=function(){return x.ejs=y,this}}).call(this);
\ No newline at end of file
diff --git a/src/search/Request.js b/src/search/Request.js
index 572aaa9..e6fe22b 100644
--- a/src/search/Request.js
+++ b/src/search/Request.js
@@ -15,19 +15,19 @@
routing - the shard routing value
*/
ejs.Request = function () {
-
+
/**
The internal query object.
@member ejs.Request
@property {Object} query
*/
var query = {};
-
+
return {
/**
Sets the sorting for the query. This accepts many input formats.
- +sort()
- The current sorting values are returned.sort(fieldName)
- Adds the field to the current list of sorting values.Multi-level sorting is supported so the order in which sort fields +
Multi-level sorting is supported so the order in which sort fields are added to the query requests is relevant.
- +It is recommended to use Sort
objects when possible.
this
so that calls can be chained.
*/
sort: function () {
var i, len;
-
+
if (!has(query, "sort")) {
query.sort = [];
}
@@ -57,11 +57,11 @@
if (arguments.length === 0) {
return query.sort;
}
-
+
// if passed a single argument
if (arguments.length === 1) {
var sortVal = arguments[0];
-
+
if (isString(sortVal)) {
// add a single field name
query.sort.push(sortVal);
@@ -85,12 +85,12 @@
} else {
// Invalid object type as argument.
throw new TypeError('Argument must be string, Sort, or array');
- }
+ }
} else if (arguments.length === 2) {
// handle the case where a single field name and order are passed
var field = arguments[0],
order = arguments[1];
-
+
if (isString(field) && isString(order)) {
order = order.toLowerCase();
if (order === 'asc' || order === 'desc') {
@@ -105,7 +105,7 @@
},
/**
- Enables score computation and tracking during sorting. Be default,
+ Enables score computation and tracking during sorting. Be default,
when sorting scores are not computed.
@member ejs.Request
@@ -116,11 +116,11 @@
if (trueFalse == null) {
return query.track_scores;
}
-
+
query.track_scores = trueFalse;
return this;
},
-
+
/**
A search result set could be very large (think Google). Setting the
from
parameter allows you to page through the result set
@@ -135,11 +135,11 @@
if (f == null) {
return query.from;
}
-
+
query.from = f;
return this;
},
-
+
/**
Sets the number of results/documents to be returned. This is set on a per page basis.
@@ -151,18 +151,18 @@
if (s == null) {
return query.size;
}
-
+
query.size = s;
return this;
},
/**
- A timeout, bounding the request to be executed within the
+ A timeout, bounding the request to be executed within the
specified time value and bail when expired. Defaults to no timeout.
This option is valid during the following operations:
search
and delete by query
this
so that calls can be chained.
@@ -171,18 +171,18 @@
if (t == null) {
return query.timeout;
}
-
+
query.timeout = t;
return this;
},
-
-
+
+
/**
By default, searches return full documents, meaning every property or field.
This method allows you to specify which fields you want returned.
-
+
Pass a single field name and it is appended to the current list of
- fields. Pass an array of fields and it replaces all existing
+ fields. Pass an array of fields and it replaces all existing
fields.
@member ejs.Request
@@ -193,17 +193,65 @@
if (fieldList == null) {
return query.fields;
}
-
+
if (query.fields == null) {
query.fields = [];
}
-
+
if (isString(fieldList)) {
query.fields.push(fieldList);
} else if (isArray(fieldList)) {
query.fields = fieldList;
} else {
- throw new TypeError('Argument must be string or array');
+ throw new TypeError('Argument must be a string or an array');
+ }
+
+ return this;
+ },
+
+ /**
+ By default, searches return full documents, meaning every property or field.
+ This method allows you to specify which fields you want included and/or which
+ ones you want excluded.
+ You are allowed to call this function multiple times with different partial names.
+ The result will be different sets that are returned by ElasticSearch, only containing
+ the fields you specified for each set. The paths to such a result set looks like this:
+ hits.hits.fields.this
so that calls can be chained.
+ */
+ partialFields: function (partialName, includes, excludes) {
+ if (!isString(partialName)) {
+ throw new TypeError('Argument partialName must be a String');
+ }
+
+ if (includes != null && !isArray(includes) && !isString(includes)) {
+ throw new TypeError('Argument includes must be a string or an array');
+ }
+
+ if (excludes != null && !isArray(excludes) && !isString(excludes)) {
+ throw new TypeError('Argument excludes must be a string or an array');
+ }
+
+ if (query.partial_fields == null) {
+ query.partial_fields = {};
+ }
+
+ if (includes == null && excludes == null) {
+ return query.partial_fields[partialName];
+ }
+
+ query.partial_fields[partialName] = {};
+ if (includes != null) {
+ query.partial_fields[partialName].include = includes;
+ }
+
+ if (excludes != null) {
+ query.partial_fields[partialName].exclude = excludes;
}
return this;
@@ -243,11 +291,11 @@
if (someQuery == null) {
return query.query;
}
-
+
if (!isQuery(someQuery)) {
throw new TypeError('Argument must be a Query');
}
-
+
query.query = someQuery.toJSON();
return this;
},
@@ -264,15 +312,15 @@
if (facet == null) {
return query.facets;
}
-
+
if (query.facets == null) {
query.facets = {};
}
-
+
if (!isFacet(facet)) {
throw new TypeError('Argument must be a Facet');
}
-
+
extend(query.facets, facet.toJSON());
return this;
@@ -289,17 +337,17 @@
if (filter == null) {
return query.filter;
}
-
+
if (!isFilter(filter)) {
throw new TypeError('Argument must be a Filter');
}
-
+
query.filter = filter.toJSON();
return this;
},
/**
- Performs highlighting based on the Highlight
+ Performs highlighting based on the Highlight
settings.
@member ejs.Request
@@ -310,7 +358,7 @@
if (h == null) {
return query.highlight;
}
-
+
if (!isHighlight(h)) {
throw new TypeError('Argument must be a Highlight object');
}
@@ -320,15 +368,15 @@
},
/**
- Allows you to set the specified suggester on this request object.
- Multiple suggesters can be set, all of which will be returned when
- the search is executed. Global suggestion text can be set by
+ Allows you to set the specified suggester on this request object.
+ Multiple suggesters can be set, all of which will be returned when
+ the search is executed. Global suggestion text can be set by
passing in a string vs. a Suggest
object.
@since elasticsearch 0.90
-
+
@member ejs.Request
- @param {(String|Suggest)} s A valid Suggest object or a String to
+ @param {(String|Suggest)} s A valid Suggest object or a String to
set as the global suggest text.
@returns {Object} returns this
so that calls can be chained.
*/
@@ -336,11 +384,11 @@
if (s == null) {
return query.suggest;
}
-
+
if (query.suggest == null) {
query.suggest = {};
}
-
+
if (isString(s)) {
query.suggest.text = s;
} else if (isSuggest(s)) {
@@ -351,7 +399,7 @@
return this;
},
-
+
/**
Computes a document property dynamically based on the supplied ScriptField
.
@@ -363,19 +411,19 @@
if (oScriptField == null) {
return query.script_fields;
}
-
+
if (query.script_fields == null) {
query.script_fields = {};
}
-
+
if (!isScriptField(oScriptField)) {
throw new TypeError('Argument must be a ScriptField');
}
-
+
extend(query.script_fields, oScriptField.toJSON());
return this;
},
-
+
/**
Boosts hits in the specified index by the given boost value.
@@ -392,7 +440,7 @@
if (arguments.length === 0) {
return query.indices_boost;
}
-
+
query.indices_boost[index] = boost;
return this;
},
@@ -407,8 +455,8 @@
explain: function (trueFalse) {
if (trueFalse == null) {
return query.explain;
- }
-
+ }
+
query.explain = trueFalse;
return this;
},
@@ -424,7 +472,7 @@
if (trueFalse == null) {
return query.version;
}
-
+
query.version = trueFalse;
return this;
},
@@ -440,21 +488,21 @@
if (min == null) {
return query.min_score;
}
-
+
query.min_score = min;
return this;
},
/**
The type of ejs object. For internal use only.
-
+
@member ejs.Request
@returns {String} the type of object
*/
_type: function () {
return 'request';
},
-
+
/**
Retrieves the internal query
object. This is typically used by
internal API functions so use with caution.
@@ -465,6 +513,6 @@
toJSON: function () {
return query;
}
-
+
};
};
diff --git a/tests/search_test.js b/tests/search_test.js
index 9c025fb..3078165 100644
--- a/tests/search_test.js
+++ b/tests/search_test.js
@@ -45,12 +45,12 @@ exports.search = {
test.ok(ejs.SuggestContextMixin, 'SuggestContextMixin');
test.ok(ejs.CompletionSuggester, 'CompletionSuggester');
test.ok(ejs.Rescore, 'Rescore');
-
+
test.done();
},
Rescore: function (test) {
test.expect(22);
-
+
var rescore = ejs.Rescore(),
termQuery1 = ejs.TermQuery('f1', 't1'),
termQuery2 = ejs.TermQuery('f2', 't2'),
@@ -58,329 +58,329 @@ exports.search = {
doTest = function () {
test.deepEqual(rescore.toJSON(), expected);
};
-
+
expected = {
query: {}
};
-
+
test.ok(rescore, 'Rescore exists');
test.ok(rescore.toJSON(), 'toJSON() works');
doTest();
-
+
rescore = ejs.Rescore(100);
expected.window_size = 100;
doTest();
-
+
rescore = ejs.Rescore(1000, termQuery1);
expected.window_size = 1000;
expected.query.rescore_query = termQuery1.toJSON();
doTest();
-
+
rescore.windowSize(100);
expected.window_size = 100;
doTest();
-
+
rescore.rescoreQuery(termQuery2);
expected.query.rescore_query = termQuery2.toJSON();
doTest();
-
+
rescore.queryWeight(2);
expected.query.query_weight = 2;
doTest();
-
+
rescore.rescoreQueryWeight(3);
expected.query.rescore_query_weight = 3;
doTest();
-
+
rescore.scoreMode('total');
expected.query.score_mode = 'total';
doTest();
-
+
rescore.scoreMode('INVALID');
doTest();
-
+
rescore.scoreMode('MIN');
expected.query.score_mode = 'min';
doTest();
-
+
rescore.scoreMode('Max');
expected.query.score_mode = 'max';
doTest();
-
+
rescore.scoreMode('AvG');
expected.query.score_mode = 'avg';
doTest();
-
+
rescore.scoreMode('multiply');
expected.query.score_mode = 'multiply';
doTest();
-
+
test.strictEqual(rescore._type(), 'rescore');
-
-
+
+
test.throws(function () {
ejs.Rescore('invalid');
}, TypeError);
-
+
test.throws(function () {
ejs.Rescore(2, 'invalid');
}, TypeError);
-
+
test.throws(function () {
rescore.rescoreQuery('invalid');
}, TypeError);
-
+
test.throws(function () {
rescore.rescoreQueryWeight('invalid');
}, TypeError);
-
+
test.throws(function () {
rescore.queryWeight('invalid');
}, TypeError);
-
+
test.throws(function () {
rescore.windowSize('invalid');
}, TypeError);
-
+
test.done();
},
DirectGenerator: function (test) {
test.expect(28);
-
+
var generator = ejs.DirectGenerator(),
expected,
doTest = function () {
test.deepEqual(generator.toJSON(), expected);
};
-
+
expected = {};
-
+
test.ok(generator, 'DirectGenerator exists');
test.ok(generator.toJSON(), 'toJSON() works');
doTest();
-
+
generator.preFilter('pre analyzer');
expected.pre_filter = 'pre analyzer';
doTest();
-
+
generator.postFilter('post analyzer');
expected.post_filter = 'post analyzer';
doTest();
-
+
generator.field('f');
expected.field = 'f';
doTest();
-
+
generator.size(5);
expected.size = 5;
doTest();
-
+
generator.accuracy(0.6);
expected.accuracy = 0.6;
doTest(0.6);
-
+
generator.suggestMode('missing');
expected.suggest_mode = 'missing';
doTest();
-
+
generator.suggestMode('INVALID');
doTest();
-
+
generator.suggestMode('POPULAR');
expected.suggest_mode = 'popular';
doTest();
-
+
generator.suggestMode('Always');
expected.suggest_mode = 'always';
doTest();
-
+
generator.sort('score');
expected.sort = 'score';
doTest();
-
+
generator.sort('INVALID');
doTest();
-
+
generator.sort('FREQUENCY');
expected.sort = 'frequency';
doTest();
-
+
generator.stringDistance('internal');
expected.string_distance = 'internal';
doTest();
-
+
generator.stringDistance('INVALID');
doTest();
-
+
generator.stringDistance('DAMERAU_LEVENSHTEIN');
expected.string_distance = 'damerau_levenshtein';
doTest();
-
+
generator.stringDistance('Levenstein');
expected.string_distance = 'levenstein';
doTest();
-
+
generator.stringDistance('jarowinkler');
expected.string_distance = 'jarowinkler';
doTest();
-
+
generator.stringDistance('ngram');
expected.string_distance = 'ngram';
doTest();
-
+
generator.maxEdits(3);
expected.max_edits = 3;
doTest();
-
+
generator.maxInspections(10);
expected.max_inspections = 10;
doTest();
-
+
generator.maxTermFreq(0.7);
expected.max_term_freq = 0.7;
doTest();
-
+
generator.prefixLen(4);
expected.prefix_len = 4;
doTest();
-
+
generator.minWordLen(3);
expected.min_word_len = 3;
doTest();
-
+
generator.minDocFreq(0.1);
expected.min_doc_freq = 0.1;
doTest();
-
+
test.strictEqual(generator._type(), 'generator');
-
-
+
+
test.done();
},
TermSuggester: function (test) {
test.expect(29);
-
+
var suggester = ejs.TermSuggester('suggester'),
expected,
doTest = function () {
test.deepEqual(suggester.toJSON(), expected);
};
-
+
expected = {
suggester: {
term: {}
}
};
-
+
test.ok(suggester, 'TermSuggester exists');
test.ok(suggester.toJSON(), 'toJSON() works');
doTest();
-
+
suggester.text('sugest termz');
expected.suggester.text = 'sugest termz';
doTest();
-
+
suggester.analyzer('analyzer');
expected.suggester.term.analyzer = 'analyzer';
doTest();
-
+
suggester.field('f');
expected.suggester.term.field = 'f';
doTest();
-
+
suggester.size(5);
expected.suggester.term.size = 5;
doTest();
-
+
suggester.shardSize(100);
expected.suggester.term.shard_size = 100;
doTest();
-
+
suggester.accuracy(0.6);
expected.suggester.term.accuracy = 0.6;
doTest(0.6);
-
+
suggester.suggestMode('missing');
expected.suggester.term.suggest_mode = 'missing';
doTest();
-
+
suggester.suggestMode('INVALID');
doTest();
-
+
suggester.suggestMode('POPULAR');
expected.suggester.term.suggest_mode = 'popular';
doTest();
-
+
suggester.suggestMode('Always');
expected.suggester.term.suggest_mode = 'always';
doTest();
-
+
suggester.sort('score');
expected.suggester.term.sort = 'score';
doTest();
-
+
suggester.sort('INVALID');
doTest();
-
+
suggester.sort('FREQUENCY');
expected.suggester.term.sort = 'frequency';
doTest();
-
+
suggester.stringDistance('internal');
expected.suggester.term.string_distance = 'internal';
doTest();
-
+
suggester.stringDistance('INVALID');
doTest();
-
+
suggester.stringDistance('DAMERAU_LEVENSHTEIN');
expected.suggester.term.string_distance = 'damerau_levenshtein';
doTest();
-
+
suggester.stringDistance('Levenstein');
expected.suggester.term.string_distance = 'levenstein';
doTest();
-
+
suggester.stringDistance('jarowinkler');
expected.suggester.term.string_distance = 'jarowinkler';
doTest();
-
+
suggester.stringDistance('ngram');
expected.suggester.term.string_distance = 'ngram';
doTest();
-
+
suggester.maxEdits(3);
expected.suggester.term.max_edits = 3;
doTest();
-
+
suggester.maxInspections(10);
expected.suggester.term.max_inspections = 10;
doTest();
-
+
suggester.maxTermFreq(0.7);
expected.suggester.term.max_term_freq = 0.7;
doTest();
-
+
suggester.prefixLen(4);
expected.suggester.term.prefix_len = 4;
doTest();
-
+
suggester.minWordLen(3);
expected.suggester.term.min_word_len = 3;
doTest();
-
+
suggester.minDocFreq(0.1);
expected.suggester.term.min_doc_freq = 0.1;
doTest();
-
+
test.strictEqual(suggester._type(), 'suggest');
-
-
+
+
test.done();
},
PhraseSuggester: function (test) {
test.expect(25);
-
+
var suggester = ejs.PhraseSuggester('suggester'),
gen1 = ejs.DirectGenerator().field('body')
.suggestMode('always')
@@ -399,65 +399,65 @@ exports.search = {
doTest = function () {
test.deepEqual(suggester.toJSON(), expected);
};
-
+
expected = {
suggester: {
phrase: {}
}
};
-
+
test.ok(suggester, 'PhraseSuggester exists');
test.ok(suggester.toJSON(), 'toJSON() works');
doTest();
-
+
suggester.text('sugest termz');
expected.suggester.text = 'sugest termz';
doTest();
-
+
suggester.analyzer('analyzer');
expected.suggester.phrase.analyzer = 'analyzer';
doTest();
-
+
suggester.field('f');
expected.suggester.phrase.field = 'f';
doTest();
-
+
suggester.size(5);
expected.suggester.phrase.size = 5;
doTest();
-
+
suggester.shardSize(100);
expected.suggester.phrase.shard_size = 100;
doTest();
-
+
suggester.realWorldErrorLikelihood(0.99);
expected.suggester.phrase.real_world_error_likelihood = 0.99;
doTest();
-
+
suggester.confidence(0.6);
expected.suggester.phrase.confidence = 0.6;
doTest();
-
+
suggester.separator('|');
expected.suggester.phrase.separator = '|';
doTest();
-
+
suggester.maxErrors(0.5);
expected.suggester.phrase.max_errors = 0.5;
doTest();
-
+
suggester.gramSize(2);
expected.suggester.phrase.gram_size = 2;
doTest();
-
+
suggester.forceUnigrams(false);
expected.suggester.phrase.force_unigrams = false;
doTest();
-
+
suggester.tokenLimit(10);
expected.suggester.phrase.token_limit = 10;
doTest();
-
+
suggester.linearSmoothing(0.7, 0.2, 0.1);
expected.suggester.phrase.smoothing = {
linear: {
@@ -467,7 +467,7 @@ exports.search = {
}
};
doTest();
-
+
suggester.laplaceSmoothing(0.7);
expected.suggester.phrase.smoothing = {
laplace: {
@@ -475,7 +475,7 @@ exports.search = {
}
};
doTest();
-
+
suggester.stupidBackoffSmoothing(0.5);
expected.suggester.phrase.smoothing = {
stupid_backoff: {
@@ -483,309 +483,309 @@ exports.search = {
}
};
doTest();
-
+
suggester.highlight('', '');
expected.suggester.phrase.highlight = {
pre_tag: '',
post_tag: ''
};
doTest();
-
+
suggester.directGenerator(gen1);
expected.suggester.phrase.direct_generator = [gen1.toJSON()];
doTest();
-
+
suggester.directGenerator(gen2);
expected.suggester.phrase.direct_generator.push(gen2.toJSON());
doTest();
-
+
suggester.directGenerator([gen3, gen1]);
expected.suggester.phrase.direct_generator = [gen3.toJSON(), gen1.toJSON()];
doTest();
-
+
test.strictEqual(suggester._type(), 'suggest');
-
-
+
+
test.throws(function () {
suggester.directGenerator('invalid');
}, TypeError);
-
+
test.throws(function () {
suggester.directGenerator([gen1, gen2, 'invalid']);
}, TypeError);
-
+
test.done();
},
CompletionSuggester: function (test) {
test.expect(17);
-
+
var suggester = ejs.CompletionSuggester('suggester'),
expected,
doTest = function () {
test.deepEqual(suggester.toJSON(), expected);
};
-
+
expected = {
suggester: {
completion: {}
}
};
-
+
test.ok(suggester, 'CompletionSuggester exists');
test.ok(suggester.toJSON(), 'toJSON() works');
doTest();
-
+
suggester.text('sugest termz');
expected.suggester.text = 'sugest termz';
doTest();
-
+
suggester.analyzer('analyzer');
expected.suggester.completion.analyzer = 'analyzer';
doTest();
-
+
suggester.field('f');
expected.suggester.completion.field = 'f';
doTest();
-
+
suggester.size(5);
expected.suggester.completion.size = 5;
doTest();
-
+
suggester.shardSize(100);
expected.suggester.completion.shard_size = 100;
doTest();
-
+
suggester.fuzzy(true);
expected.suggester.completion.fuzzy = {};
doTest();
-
+
suggester.fuzzy(false);
delete expected.suggester.completion.fuzzy;
doTest();
-
+
suggester.transpositions(true);
expected.suggester.completion.fuzzy = {transpositions: true};
doTest();
-
+
suggester.unicodeAware(false);
expected.suggester.completion.fuzzy.unicode_aware = false;
doTest();
-
+
suggester.editDistance(4);
expected.suggester.completion.fuzzy.edit_distance = 4;
doTest();
-
+
suggester.minLength(4);
expected.suggester.completion.fuzzy.min_length = 4;
doTest();
-
+
suggester.prefixLength(2);
expected.suggester.completion.fuzzy.prefix_length = 2;
- doTest();
-
+ doTest();
+
suggester.fuzzy(false);
delete expected.suggester.completion.fuzzy;
doTest();
-
+
test.strictEqual(suggester._type(), 'suggest');
-
+
test.done();
},
Highlight: function (test) {
test.expect(46);
-
+
var highlight = ejs.Highlight(['title', 'content']),
expected,
doTest = function () {
test.deepEqual(highlight.toJSON(), expected);
};
-
+
expected = {
fields: {
title: {},
content: {}
}
- };
-
+ };
+
test.ok(highlight, 'Highlight exists');
test.ok(highlight.toJSON(), 'toJSON() works');
doTest();
-
+
highlight.fields('teaser');
expected.fields.teaser = {};
doTest();
-
+
highlight.fields(['body', 'summary']);
expected.fields.body = {};
expected.fields.summary = {};
doTest();
-
+
highlight.preTags('');
expected.pre_tags = [''];
doTest();
-
+
highlight.preTags(['