Skip to content

5.0 changes #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
250 changes: 230 additions & 20 deletions dist/elastic.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! elastic.js - v1.2.0 - 2014-10-13
/*! elastic.js - v1.4.0 - 2016-11-01
* https://github.com/fullscale/elastic.js
* Copyright (c) 2014 FullScale Labs, LLC; Licensed MIT */
* Copyright (c) 2016 FullScale Labs, LLC; Licensed MIT */

/**
@namespace
Expand Down Expand Up @@ -3170,6 +3170,54 @@

};

/**
@class
<p>A special single bucket aggregation that enables aggregating children
documents.</p>

@name ejs.ChildrenAggregation
@ejs aggregation
@borrows ejs.AggregationMixin.aggregation as aggregation
@borrows ejs.AggregationMixin.agg as agg
@borrows ejs.AggregationMixin._type as _type
@borrows ejs.AggregationMixin.toJSON as toJSON

@desc
<p>A special single bucket aggregation that enables aggregating nested
documents.</p>

@param {String} name The name which be used to refer to this aggregation.

*/
ejs.ChildrenAggregation = function (name) {

var
_common = ejs.AggregationMixin(name),
agg = _common.toJSON();

agg[name].children = {};

return extend(_common, {

/**
<p>Sets the nested path.</p>

@member ejs.ChildrenAggregation
@param {String} type The nested type value.
@returns {Object} returns <code>this</code> so that calls can be chained.
*/
type: function (type) {
if (type == null) {
return agg[name].children.type;
}

agg[name].children.type = type;
return this;
}

});
};

/**
@class
<p>A multi-bucket aggregation similar to the histogram except it can only be
Expand Down Expand Up @@ -3766,7 +3814,7 @@
<p>Sets the filter to be used for this aggregation.</p>

@member ejs.FilterAggregation
@param {Filter} oFilter A valid <code>Filter</code> object.
@param {Query} oFilter A valid <code>Filter</code> object.
@returns {Object} returns <code>this</code> so that calls can be chained.
*/
filter: function (oFilter) {
Expand All @@ -3780,6 +3828,25 @@

agg[name].filter = oFilter.toJSON();
return this;
},
/**
<p>Sets the filter to be used for this aggregation.</p>

@member ejs.FilterAggregation
@param {Query} oQuery A valid <code>Query</code> object.
@returns {Object} returns <code>this</code> so that calls can be chained.
*/
filterQuery: function (oQuery) {
if (oQuery == null) {
return agg[name].filter;
}

if (!isQuery(oQuery)) {
throw new TypeError('Argument must be a Query');
}

agg[name].filter = oQuery.toJSON();
return this;
}

});
Expand Down Expand Up @@ -4987,6 +5054,37 @@
});
};

/**
@class
<p>A special single bucket aggregation that enables aggregating nested
documents.</p>

@name ejs.NestedAggregation
@ejs aggregation
@borrows ejs.AggregationMixin.aggregation as aggregation
@borrows ejs.AggregationMixin.agg as agg
@borrows ejs.AggregationMixin._type as _type
@borrows ejs.AggregationMixin.toJSON as toJSON

@desc
<p>A special single bucket aggregation that enables aggregating nested
documents.</p>

@param {String} name The name which be used to refer to this aggregation.

*/
ejs.ReverseNestedAggregation = function (name) {

var
_common = ejs.AggregationMixin(name),
agg = _common.toJSON();

agg[name].reverse_nested = {};


return extend(_common, { });
};

/**
@class
<p>An aggregation that returns interesting or unusual occurrences of terms in
Expand Down Expand Up @@ -9020,11 +9118,11 @@
*/
must: function (oQuery) {
var i, len;

if (query.bool.must == null) {
query.bool.must = [];
}

if (oQuery == null) {
return query.bool.must;
}
Expand All @@ -9037,13 +9135,13 @@
if (!isQuery(oQuery[i])) {
throw new TypeError('Argument must be an array of Queries');
}

query.bool.must.push(oQuery[i].toJSON());
}
} else {
throw new TypeError('Argument must be a Query or array of Queries');
}

return this;
},

Expand All @@ -9056,15 +9154,15 @@
*/
mustNot: function (oQuery) {
var i, len;

if (query.bool.must_not == null) {
query.bool.must_not = [];
}

if (oQuery == null) {
return query.bool.must_not;
}

if (isQuery(oQuery)) {
query.bool.must_not.push(oQuery.toJSON());
} else if (isArray(oQuery)) {
Expand All @@ -9073,13 +9171,13 @@
if (!isQuery(oQuery[i])) {
throw new TypeError('Argument must be an array of Queries');
}

query.bool.must_not.push(oQuery[i].toJSON());
}
} else {
throw new TypeError('Argument must be a Query or array of Queries');
}

return this;
},

Expand All @@ -9092,15 +9190,15 @@
*/
should: function (oQuery) {
var i, len;

if (query.bool.should == null) {
query.bool.should = [];
}

if (oQuery == null) {
return query.bool.should;
}

if (isQuery(oQuery)) {
query.bool.should.push(oQuery.toJSON());
} else if (isArray(oQuery)) {
Expand All @@ -9109,13 +9207,85 @@
if (!isQuery(oQuery[i])) {
throw new TypeError('Argument must be an array of Queries');
}

query.bool.should.push(oQuery[i].toJSON());
}
} else {
throw new TypeError('Argument must be a Query or array of Queries');
}


return this;
},

/**
Adds filter to boolean container.

@member ejs.BoolQuery
@param {Object} oFilter A valid <code>Filter</code> object
@returns {Object} returns <code>this</code> so that calls can be chained.
*/
filter: function (oFilter) {
var i, len;

if (query.bool.filter == null) {
query.bool.filter = [];
}

if (oFilter == null) {
return query.bool.filter;
}

if (isFilter(oFilter)) {
query.bool.filter.push(oFilter.toJSON());
} else if (isArray(oFilter)) {
query.bool.filter = [];
for (i = 0, len = oFilter.length; i < len; i++) {
if (!isFilter(oFilter[i])) {
throw new TypeError('Argument must be an array of Filters');
}

query.bool.filter.push(oFilter[i].toJSON());
}
} else {
throw new TypeError('Argument must be a Filter or array of Filters');
}

return this;
},

/**
Adds query in filter context to boolean container.

@member ejs.BoolQuery
@param {Object} oQuery A valid <code>Query</code> object
@returns {Object} returns <code>this</code> so that calls can be chained.
*/
filterQuery: function (oQuery) {
var i, len;

if (query.bool.filter == null) {
query.bool.filter = [];
}

if (oQuery == null) {
return query.bool.filter;
}

if (isQuery(oQuery)) {
query.bool.filter.push(oQuery.toJSON());
} else if (isArray(oQuery)) {
query.bool.filter = [];
for (i = 0, len = oQuery.length; i < len; i++) {
if (!isQuery(oQuery[i])) {
throw new TypeError('Argument must be an array of Queries');
}

query.bool.filter.push(oQuery[i].toJSON());
}
} else {
throw new TypeError('Argument must be a Query or array of Queries');
}

return this;
},

Expand All @@ -9136,7 +9306,7 @@
query.bool.adjust_pure_negative = trueFalse;
return this;
},

/**
Enables or disables similarity coordinate scoring of documents
matching the <code>Query</code>. Default: false.
Expand All @@ -9156,15 +9326,15 @@

/**
<p>Sets the number of optional clauses that must match.</p>

<p>By default no optional clauses are necessary for a match
(unless there are no required clauses). If this method is used,
then the specified number of clauses is required.</p>

<p>Use of this method is totally independent of specifying that
any specific clauses are required (or prohibited). This number will
only be compared against the number of matching optional clauses.</p>

@member ejs.BoolQuery
@param {Integer} minMatch A positive <code>integer</code> value.
@returns {Object} returns <code>this</code> so that calls can be chained.
Expand All @@ -9177,7 +9347,7 @@
query.bool.minimum_number_should_match = minMatch;
return this;
}

});
};

Expand Down Expand Up @@ -9728,6 +9898,46 @@
};


/**
@class
<p>An existsQuery matches documents where the specified field is present
and the field contains a legitimate value.</p>
@name ejs.ExistsQuery
@ejs query
@borrows ejs.QueryMixin._type as _type
@borrows ejs.QueryMixin.toJSON as toJSON
@desc
Queries documents where a specified field exists and contains a value.
@param {String} fieldName the field name that must exists and contain a value.
*/
ejs.ExistsQuery = function (fieldName) {

var
_common = ejs.QueryMixin('exists'),
query = _common.toJSON();

query.exists.field = fieldName;

return extend(_common, {

/**
Sets the field to check for missing values.
@member ejs.ExistsQuery
@param {String} name A name of the field.
@returns {Object} returns <code>this</code> so that calls can be chained.
*/
field: function (name) {
if (name == null) {
return query.exists.field;
}

query.exists.field = name;
return this;
}

});
};

/**
@class
<p>Wrapper to allow SpanQuery objects participate in composite single-field
Expand Down Expand Up @@ -18005,5 +18215,5 @@
root.ejs = _ejs;
return this;
};

}).call(this);
Loading