From 6b1292cd9ae1e62fb5d44d602bbf483d6f6636e1 Mon Sep 17 00:00:00 2001 From: Spencer Date: Fri, 25 Apr 2014 07:56:19 -0700 Subject: [PATCH 01/18] Update api_conventions.asciidoc --- docs/api_conventions.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api_conventions.asciidoc b/docs/api_conventions.asciidoc index bf982c293..6afee9f4c 100755 --- a/docs/api_conventions.asciidoc +++ b/docs/api_conventions.asciidoc @@ -1,7 +1,7 @@ [[api-conventions]] == API Conventions === Generic Parameters -By default, all api methods accept the following parameters. They are omitted from the param lists of each method, just because. +By default, all api methods accept the following parameters. They are omitted from the param lists of each method for brevity. [horizontal] `method`:: From 2104c692aba28bbf80f9215bb3133a7251e4fc9c Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Wed, 23 Apr 2014 12:19:31 -0700 Subject: [PATCH 02/18] switched to tilde notiation for relative package versions --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8c4e6b760..6c308b1b3 100644 --- a/package.json +++ b/package.json @@ -46,12 +46,12 @@ "mocha-lcov-reporter": "0.0.1", "blanket": "~1.1.5", "sinon": "~1.7.3", - "nock": "^0.28.1", + "nock": "~0.28.1", "open": "0.0.4", "load-grunt-tasks": "~0.2.0", "load-grunt-config": "~0.7.0", "grunt-s3": "~0.2.0-alpha.3", - "grunt-run": "^0.2.2", + "grunt-run": "~0.2.2", "grunt-contrib-compress": "~0.5.3", "grunt-contrib-copy": "~0.4.1", "grunt-prompt": "~0.1.2", @@ -70,7 +70,7 @@ "chalk": "~0.4", "forever-agent": "0.5.2", "lodash-node": "~2.4", - "bluebird": "^1.2.1" + "bluebird": "~1.2.1" }, "repository": { "type": "git", From c5ea877e3bf6506fc7dd0acdec5a584cbb85b28e Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Wed, 23 Apr 2014 12:21:10 -0700 Subject: [PATCH 03/18] updated angular build to add $invoke to the config (rather than and ) so that other components can define their dependencies in the component. --- src/elasticsearch.angular.js | 4 ++-- src/lib/connectors/angular.js | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/elasticsearch.angular.js b/src/elasticsearch.angular.js index 0bfa86952..67b6fa1e8 100644 --- a/src/elasticsearch.angular.js +++ b/src/elasticsearch.angular.js @@ -11,12 +11,12 @@ process.angular_build = true; /* global angular */ angular.module('elasticsearch', []) - .factory('esFactory', ['$http', '$q', function ($http, $q) { + .factory('esFactory', ['$injector', '$q', function ($injector, $q) { var factory = function (config) { config = config || {}; config.connectionClass = AngularConnector; - config.$http = $http; + config.$injector = $injector; config.defer = function () { return $q.defer(); }; diff --git a/src/lib/connectors/angular.js b/src/lib/connectors/angular.js index 543745be1..489f92a76 100644 --- a/src/lib/connectors/angular.js +++ b/src/lib/connectors/angular.js @@ -12,16 +12,24 @@ var ConnectionFault = require('../errors').ConnectionFault; function AngularConnector(host, config) { ConnectionAbstract.call(this, host, config); - this.defer = config.defer; - this.$http = config.$http; - if (this.host.auth) { - this.$http.defaults.headers.common.Authorization = 'Basic ' + (new Buffer(this.host.auth, 'utf8')).toString('base64'); - } + var connector = this; + + config.$injector.invoke(function ($http, $q) { + connector.$q = $q; + connector.$http = $http; + + if (connector.host.auth) { + connector.$http.defaults.headers.common.Authorization = 'Basic ' + (new Buffer(connector.host.auth, 'utf8')).toString('base64'); + } + }); + + } _.inherits(AngularConnector, ConnectionAbstract); AngularConnector.prototype.request = function (params, cb) { - var abort = this.defer(); + var abort = this.$q.defer(); + this.$http({ method: params.method, url: this.host.makeUrl(params), From 35003b122b50f1ac1d24726bc5d4f4fe20b153cb Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Fri, 25 Apr 2014 16:20:25 -0700 Subject: [PATCH 04/18] Updating API and log generator --- .travis.yml | 6 +- docs/api_methods.asciidoc | 42 ++++ docs/api_methods_1_0.asciidoc | 42 ++++ docs/api_methods_1_x.asciidoc | 44 +++- docs/api_methods_master.asciidoc | 44 +++- scripts/generate/logs/index.js | 197 ++++++++++++------ scripts/generate/logs/samples/index.js | 21 +- .../generate/logs/samples/weighted_list.js | 2 +- src/lib/apis/1_0.js | 69 ++++++ src/lib/apis/1_1.js | 69 ++++++ src/lib/apis/1_x.js | 71 ++++++- src/lib/apis/master.js | 71 ++++++- test/integration/yaml_suite/yaml_doc.js | 11 +- 13 files changed, 603 insertions(+), 86 deletions(-) diff --git a/.travis.yml b/.travis.yml index efbd7c1fe..8bd766839 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,9 @@ language: node_js node_js: "0.10" secure: "UFAGQ6m/VnEahbj9vttY9YoA5h5rEBE6K7AvEEbWnt+VKppV+w3hu3HZxgKr8C9PWhCzqlGvsLh+kCqykZhISU1fBCK/Ttp3nSpMvvF5tI2u51Rj1qZ/7NUGRU0qVI9KFt0rJeXMJwq3fivb1H6aojfPD1gsIte7NHNjUfd0iUg=" env: - - ES_BRANCH=1.1 COVERAGE=1 - - ES_BRANCH=1.0 NODE_UNIT=0 - - ES_BRANCH=0.90 NODE_UNIT=0 + - ES_BRANCH=1.1 ES_RELEASE=1.1.1 COVERAGE=1 + - ES_BRANCH=1.0 ES_RELEASE=1.0.3 NODE_UNIT=0 + - ES_BRANCH=0.90 ES_RELEASE=0.90.13 NODE_UNIT=0 - NODE_UNIT=0 NODE_INTEGRATION=0 BROWSER_UNIT=1 script: ./scripts/ci.sh email: diff --git a/docs/api_methods.asciidoc b/docs/api_methods.asciidoc index 7a1b57a75..4c15ec3d1 100644 --- a/docs/api_methods.asciidoc +++ b/docs/api_methods.asciidoc @@ -27,6 +27,7 @@ NOTE: This is currently the default API, but in upcomming versions that will cha * <> * <> * <> +* <> * <> * <> * <> @@ -1528,6 +1529,47 @@ Options::: link:#[back to top] +[[api-searchshards]] +=== `searchShards` + +[source,js] +-------- +client.searchShards([params, [callback]]) +-------- + +// no description + +The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-shards.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`preference`:: +`String` -- Specify the node or shard the operation should be performed on (default: random) +`routing`:: +`String` -- Specific routing value +`local`:: +`Boolean` -- Return local information, do not retrieve the state from master node (default: false) +`ignoreUnavailable`:: +`Boolean` -- Whether specified concrete indices should be ignored when unavailable (missing or closed) +`allowNoIndices`:: +`Boolean` -- Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) +`[expandWildcards=open]`:: +`String` -- Whether to expand wildcard expression to concrete indices that are open, closed or both. +Options::: + * `"open"` + * `"closed"` + +`index`:: +`String` -- The name of the index +`type`:: +`String` -- The type of the document + +link:#[back to top] + [[api-searchtemplate]] === `searchTemplate` diff --git a/docs/api_methods_1_0.asciidoc b/docs/api_methods_1_0.asciidoc index 0fde9556f..a209aed5a 100644 --- a/docs/api_methods_1_0.asciidoc +++ b/docs/api_methods_1_0.asciidoc @@ -27,6 +27,7 @@ NOTE: At this time, you must opt into the 1.0 API by setting the `apiVersion` co * <> * <> * <> +* <> * <> * <> * <> @@ -1510,6 +1511,47 @@ Options::: link:#[back to top] +[[api-searchshards-1-0]] +=== `searchShards` + +[source,js] +-------- +client.searchShards([params, [callback]]) +-------- + +// no description + +The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-shards.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`preference`:: +`String` -- Specify the node or shard the operation should be performed on (default: random) +`routing`:: +`String` -- Specific routing value +`local`:: +`Boolean` -- Return local information, do not retrieve the state from master node (default: false) +`ignoreUnavailable`:: +`Boolean` -- Whether specified concrete indices should be ignored when unavailable (missing or closed) +`allowNoIndices`:: +`Boolean` -- Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) +`[expandWildcards=open]`:: +`String` -- Whether to expand wildcard expression to concrete indices that are open, closed or both. +Options::: + * `"open"` + * `"closed"` + +`index`:: +`String` -- The name of the index +`type`:: +`String` -- The type of the document + +link:#[back to top] + [[api-suggest-1-0]] === `suggest` diff --git a/docs/api_methods_1_x.asciidoc b/docs/api_methods_1_x.asciidoc index 74b105142..a64ee5730 100644 --- a/docs/api_methods_1_x.asciidoc +++ b/docs/api_methods_1_x.asciidoc @@ -30,6 +30,7 @@ NOTE: At this time, you must opt into the 1.x API by setting the `apiVersion` co * <> * <> * <> +* <> * <> * <> * <> @@ -1605,6 +1606,47 @@ Options::: link:#[back to top] +[[api-searchshards-1-x]] +=== `searchShards` + +[source,js] +-------- +client.searchShards([params, [callback]]) +-------- + +// no description + +The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-shards.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`preference`:: +`String` -- Specify the node or shard the operation should be performed on (default: random) +`routing`:: +`String` -- Specific routing value +`local`:: +`Boolean` -- Return local information, do not retrieve the state from master node (default: false) +`ignoreUnavailable`:: +`Boolean` -- Whether specified concrete indices should be ignored when unavailable (missing or closed) +`allowNoIndices`:: +`Boolean` -- Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) +`[expandWildcards=open]`:: +`String` -- Whether to expand wildcard expression to concrete indices that are open, closed or both. +Options::: + * `"open"` + * `"closed"` + +`index`:: +`String` -- The name of the index +`type`:: +`String` -- The type of the document + +link:#[back to top] + [[api-searchtemplate-1-x]] === `searchTemplate` @@ -1901,8 +1943,6 @@ Options::: `String` -- Specific version type Options::: * `"internal"` - * `"external"` - * `"external_gte"` * `"force"` `id`:: diff --git a/docs/api_methods_master.asciidoc b/docs/api_methods_master.asciidoc index c75751ab4..52a0ed538 100644 --- a/docs/api_methods_master.asciidoc +++ b/docs/api_methods_master.asciidoc @@ -30,6 +30,7 @@ NOTE: At this time, you must opt into the master API by setting the `apiVersion` * <> * <> * <> +* <> * <> * <> * <> @@ -1605,6 +1606,47 @@ Options::: link:#[back to top] +[[api-searchshards-master]] +=== `searchShards` + +[source,js] +-------- +client.searchShards([params, [callback]]) +-------- + +// no description + +The default method is `POST` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-shards.html[the elasticsearch docs] for more about this method. + +// no examples + + +==== Params + +[horizontal] +`preference`:: +`String` -- Specify the node or shard the operation should be performed on (default: random) +`routing`:: +`String` -- Specific routing value +`local`:: +`Boolean` -- Return local information, do not retrieve the state from master node (default: false) +`ignoreUnavailable`:: +`Boolean` -- Whether specified concrete indices should be ignored when unavailable (missing or closed) +`allowNoIndices`:: +`Boolean` -- Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) +`[expandWildcards=open]`:: +`String` -- Whether to expand wildcard expression to concrete indices that are open, closed or both. +Options::: + * `"open"` + * `"closed"` + +`index`:: +`String` -- The name of the index +`type`:: +`String` -- The type of the document + +link:#[back to top] + [[api-searchtemplate-master]] === `searchTemplate` @@ -1901,8 +1943,6 @@ Options::: `String` -- Specific version type Options::: * `"internal"` - * `"external"` - * `"external_gte"` * `"force"` `id`:: diff --git a/scripts/generate/logs/index.js b/scripts/generate/logs/index.js index 40d6488c7..4d3e2d9da 100644 --- a/scripts/generate/logs/index.js +++ b/scripts/generate/logs/index.js @@ -1,3 +1,4 @@ +/* jshint curly:false, latedef:false */ // args var argv = require('optimist') .usage('node scripts/generate/logs [-h|--host localhost:9200] [-c|--count 14000] [-d|--days 7]') @@ -23,6 +24,7 @@ var es = require('../../../src/elasticsearch'); var async = require('async'); var moment = require('moment'); var makeSamples = require('./samples').make; +var Promise = require('bluebird'); var startingMoment = moment().utc().startOf('day').subtract('days', argv.days); var endingMoment = moment().utc().endOf('day').add('days', argv.days); @@ -30,7 +32,7 @@ var clientConfig = { // log: { // level: 'trace', // type: 'file', - // path: path.join(__dirname, '../../../log') + // path: require('path').join(__dirname, '../../../log') // } }; @@ -43,29 +45,36 @@ if (argv.host) { var client = new es.Client(clientConfig); var samples = makeSamples(startingMoment, endingMoment); -console.log('Generating', argv.count, 'events across ±', argv.days, 'days'); - var indices = {}; -var events = []; -var doneEventing = false; -var eventsPerBulk = 3500; -var eventElementsPerBulk = eventsPerBulk * 2; // events are stored next to their headers, so each event has two elements; +var doneCreatingEvents = false; +var total = argv.count; + +console.log('Generating', total, 'events across ±', argv.days, 'days'); + +function createIndex(indexName) { + // console.log('ensuring index "%s" exists', indexName); -function createIndex(indexName, done) { - console.log('made index', indexName); var indexBody = { settings: { index: { number_of_shards: 1, number_of_replicas: 0 + }, + analysis: { + analyzer: { + url: { + type: 'standard', + tokenizer: 'uax_url_email', + max_token_length: 1000 + } + } } }, mappings: { _default_: { properties: { '@timestamp': { - type: 'date', - index: 'not_analyzed' + type: 'date' }, id: { type: 'integer', @@ -97,52 +106,128 @@ function createIndex(indexName, done) { }, memory: { type: 'double' + }, + referer: { + type: 'string', + index: 'not_analyzed' } } } } }; - client.indices.create({ + return client.indices.create({ ignore: 400, index: indexName, body: indexBody - }, done); + }) + .then(function () { + return client.cluster.health({ + index: indexName, + waitForStatus: 'yellow' + }); + }); } -var bulk = async.queue(function (chunk, done) { - if (typeof chunk === 'string') { - return createIndex(chunk, done); + +var queue = async.queue(function (events, done) { + + var body = []; + var deps = []; + + events.forEach(function (event) { + var header = event.header; + event = event.body; + + if (indices[event.index] !== true) { + deps.push(createIndex(event.index)); + indices[event.index] = true; + } + + body.push({ index: header }, event); + }); + + Promise.all(deps) + .then(function () { + if (body.length) { + return client.bulk({ + body: body + }); + } else { + return {}; + } + }) + .then(function (resp) { + if (resp.errors) { + var errors = []; + + resp.items.forEach(function (item, i) { + if (item.index.error) { + errors.push(item.index.error); + eventBuffer.push(events[i]); + } + }); + + console.log('\n - errors - \n' + errors.join('\n') + '\n'); + } + }) + .finally(function () { + process.stdout.write('.'); + }) + .nodeify(done); + +}, 1); + +var eventBuffer = []; +eventBuffer.flush = function () { + if (eventBuffer.length === 3500 || doneCreatingEvents) { + queue.push([eventBuffer.splice(0)], function (err) { + if (err) { + console.error(err.resp); + console.error(err.stack); + process.exit(); + } + }); } - - console.info('writing', chunk.length / 2, 'documents'); - client.bulk({ - body: chunk - }, done); -}, 3); - -bulk.drain = function () { - if (!doneEventing) { - // console.log('indexed faster than the events were created'); - return; - } - - client.close(); - console.log('done'); }; -async.timesSeries(argv.count, function (i, done) { +queue.drain = function () { + if (doneCreatingEvents && eventBuffer.length === 0) { + client.close(); + process.stdout.write('.\n\ncreated ' + total + ' events\n\n'); + } else { + eventBuffer.flush(); + } +}; + +async.timesSeries(total, function (i, done) { // random date, plus less random time - var date = moment(samples.randomMsInDayRange()) - .utc() - .startOf('day') - .add('milliseconds', samples.lessRandomMsInDay()); + var date = new Date(samples.randomMsInDayRange()); + var ms = samples.lessRandomMsInDay(); + + // extract number of hours from the milliseconds + var hours = Math.floor(ms / 3600000); + ms = ms - hours * 3600000; + + // extract number of minutes from the milliseconds + var minutes = Math.floor(ms / 60000); + ms = ms - minutes * 60000; + + // extract number of seconds from the milliseconds + var seconds = Math.floor(ms / 1000); + ms = ms - seconds * 1000; + + // apply the values found to the date + date.setUTCHours(hours, minutes, seconds, ms); + + var dateAsIso = date.toISOString(); + var indexName = 'logstash-' + dateAsIso.substr(0, 4) + '.' + dateAsIso.substr(5, 2) + '.' + dateAsIso.substr(8, 2); var event = {}; - event.index = date.format('[logstash-]YYYY.MM.DD'); - event['@timestamp'] = date.toISOString(); + event.index = indexName; + event['@timestamp'] = dateAsIso; event.ip = samples.ips(); event.extension = samples.extensions(); event.response = samples.responseCodes(); @@ -152,7 +237,7 @@ async.timesSeries(argv.count, function (i, done) { samples.tags(), samples.tags2() ]; - event.utc_time = date.toISOString(); + event.utc_time = dateAsIso; event.referer = 'http://' + samples.referrers() + '/' + samples.tags() + '/' + samples.astronauts(); event.agent = samples.userAgents(); event.clientip = event.ip; @@ -161,33 +246,21 @@ async.timesSeries(argv.count, function (i, done) { if (event.extension === 'php') { event.phpmemory = event.memory = event.bytes * 40; } - event['@message'] = event.ip + ' - - [' + date.toISOString() + '] "GET ' + event.request + ' HTTP/1.1" ' + + event['@message'] = event.ip + ' - - [' + dateAsIso + '] "GET ' + event.request + ' HTTP/1.1" ' + event.response + ' ' + event.bytes + ' "-" "' + event.agent + '"'; - - if (indices[event.index] !== true) { - bulk.push(event.index); // when it receives a string it handles that immediately - indices[event.index] = true; - } - - events.push( - { - index: { - _index: event.index, - _type: samples.types(), - _id: i - } + eventBuffer.push({ + header: { + _index: event.index, + _type: samples.types(), + _id: i, }, - event - ); - - // eventsPerBulk must be multiplied by 2 because each event is two elements long - if (events.length === eventElementsPerBulk || i === argv.count - 1) { - bulk.push([events.splice(0, eventElementsPerBulk)]); - } + body: event + }); + eventBuffer.flush(); setImmediate(done); }, function () { - console.log('done creating events'); - doneEventing = true; + doneCreatingEvents = true; + eventBuffer.flush(); }); \ No newline at end of file diff --git a/scripts/generate/logs/samples/index.js b/scripts/generate/logs/samples/index.js index 4df7ad4ee..20b318ef9 100644 --- a/scripts/generate/logs/samples/index.js +++ b/scripts/generate/logs/samples/index.js @@ -8,11 +8,12 @@ var dayMs = 86400000; exports.make = function (startingMoment, endingMoment) { var sets = {}; + var startms = startingMoment.toDate().getTime(); + var endms = endingMoment.toDate().getTime(); - sets.randomMsInDayRange = new Stochator({ - min: startingMoment.toDate().getTime(), - max: endingMoment.toDate().getTime() - }, 'get'); + sets.randomMsInDayRange = function () { + return _.random(startms, endms); + }; sets.lessRandomRespSize = new Stochator({ mean: 4500, @@ -86,11 +87,9 @@ exports.make = function (startingMoment, endingMoment) { 'apache': 4 }); - return _.transform(sets, function (note, set, name) { - if (name === 'days') { - return note[name] = set; - } - - note[name] = _.bindKey(set, 'get'); - }, {}); + return _.mapValues(sets, function (set) { + return (typeof set === 'function') ? set : function () { + return set.get(); + }; + }); }; diff --git a/scripts/generate/logs/samples/weighted_list.js b/scripts/generate/logs/samples/weighted_list.js index c96fa9efd..5f2c73f1c 100644 --- a/scripts/generate/logs/samples/weighted_list.js +++ b/scripts/generate/logs/samples/weighted_list.js @@ -111,7 +111,7 @@ WeightedList.prototype._update = function () { sum = 0, totals = []; - _.each(me, function (item) { + me.forEach(function (item) { sum += item.weight; totals.push(sum); }); diff --git a/src/lib/apis/1_0.js b/src/lib/apis/1_0.js index 22d20452d..2e28eae44 100644 --- a/src/lib/apis/1_0.js +++ b/src/lib/apis/1_0.js @@ -4679,6 +4679,75 @@ api.search = ca({ method: 'POST' }); +/** + * Perform a [searchShards](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-shards.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random) + * @param {String} params.routing - Specific routing value + * @param {Boolean} params.local - Return local information, do not retrieve the state from master node (default: false) + * @param {Boolean} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {Boolean} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {String} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {String} params.index - The name of the index + * @param {String} params.type - The type of the document + */ +api.searchShards = ca({ + params: { + preference: { + type: 'string' + }, + routing: { + type: 'string' + }, + local: { + type: 'boolean' + }, + ignoreUnavailable: { + type: 'boolean', + name: 'ignore_unavailable' + }, + allowNoIndices: { + type: 'boolean', + name: 'allow_no_indices' + }, + expandWildcards: { + type: 'enum', + 'default': 'open', + options: [ + 'open', + 'closed' + ], + name: 'expand_wildcards' + } + }, + urls: [ + { + fmt: '/<%=index%>/<%=type%>/_search_shards', + req: { + index: { + type: 'string' + }, + type: { + type: 'string' + } + } + }, + { + fmt: '/<%=index%>/_search_shards', + req: { + index: { + type: 'string' + } + } + }, + { + fmt: '/_search_shards' + } + ], + method: 'POST' +}); + api.snapshot = function SnapshotNS(transport) { this.transport = transport; }; diff --git a/src/lib/apis/1_1.js b/src/lib/apis/1_1.js index 1b2b9d29d..21d21f343 100644 --- a/src/lib/apis/1_1.js +++ b/src/lib/apis/1_1.js @@ -4806,6 +4806,75 @@ api.searchTemplate = ca({ method: 'POST' }); +/** + * Perform a [searchShards](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-shards.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random) + * @param {String} params.routing - Specific routing value + * @param {Boolean} params.local - Return local information, do not retrieve the state from master node (default: false) + * @param {Boolean} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {Boolean} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {String} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {String} params.index - The name of the index + * @param {String} params.type - The type of the document + */ +api.searchShards = ca({ + params: { + preference: { + type: 'string' + }, + routing: { + type: 'string' + }, + local: { + type: 'boolean' + }, + ignoreUnavailable: { + type: 'boolean', + name: 'ignore_unavailable' + }, + allowNoIndices: { + type: 'boolean', + name: 'allow_no_indices' + }, + expandWildcards: { + type: 'enum', + 'default': 'open', + options: [ + 'open', + 'closed' + ], + name: 'expand_wildcards' + } + }, + urls: [ + { + fmt: '/<%=index%>/<%=type%>/_search_shards', + req: { + index: { + type: 'string' + }, + type: { + type: 'string' + } + } + }, + { + fmt: '/<%=index%>/_search_shards', + req: { + index: { + type: 'string' + } + } + }, + { + fmt: '/_search_shards' + } + ], + method: 'POST' +}); + api.snapshot = function SnapshotNS(transport) { this.transport = transport; }; diff --git a/src/lib/apis/1_x.js b/src/lib/apis/1_x.js index c4e3f248e..d4b73c4d6 100644 --- a/src/lib/apis/1_x.js +++ b/src/lib/apis/1_x.js @@ -4823,6 +4823,75 @@ api.search = ca({ method: 'POST' }); +/** + * Perform a [searchShards](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-shards.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random) + * @param {String} params.routing - Specific routing value + * @param {Boolean} params.local - Return local information, do not retrieve the state from master node (default: false) + * @param {Boolean} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {Boolean} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {String} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {String} params.index - The name of the index + * @param {String} params.type - The type of the document + */ +api.searchShards = ca({ + params: { + preference: { + type: 'string' + }, + routing: { + type: 'string' + }, + local: { + type: 'boolean' + }, + ignoreUnavailable: { + type: 'boolean', + name: 'ignore_unavailable' + }, + allowNoIndices: { + type: 'boolean', + name: 'allow_no_indices' + }, + expandWildcards: { + type: 'enum', + 'default': 'open', + options: [ + 'open', + 'closed' + ], + name: 'expand_wildcards' + } + }, + urls: [ + { + fmt: '/<%=index%>/<%=type%>/_search_shards', + req: { + index: { + type: 'string' + }, + type: { + type: 'string' + } + } + }, + { + fmt: '/<%=index%>/_search_shards', + req: { + index: { + type: 'string' + } + } + }, + { + fmt: '/_search_shards' + } + ], + method: 'POST' +}); + /** * Perform a [searchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html) request * @@ -5383,8 +5452,6 @@ api.update = ca({ type: 'enum', options: [ 'internal', - 'external', - 'external_gte', 'force' ], name: 'version_type' diff --git a/src/lib/apis/master.js b/src/lib/apis/master.js index 3e88b7fb3..8bffa498b 100644 --- a/src/lib/apis/master.js +++ b/src/lib/apis/master.js @@ -4823,6 +4823,75 @@ api.search = ca({ method: 'POST' }); +/** + * Perform a [searchShards](http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-shards.html) request + * + * @param {Object} params - An object with parameters used to carry out this action + * @param {String} params.preference - Specify the node or shard the operation should be performed on (default: random) + * @param {String} params.routing - Specific routing value + * @param {Boolean} params.local - Return local information, do not retrieve the state from master node (default: false) + * @param {Boolean} params.ignoreUnavailable - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {Boolean} params.allowNoIndices - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {String} [params.expandWildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. + * @param {String} params.index - The name of the index + * @param {String} params.type - The type of the document + */ +api.searchShards = ca({ + params: { + preference: { + type: 'string' + }, + routing: { + type: 'string' + }, + local: { + type: 'boolean' + }, + ignoreUnavailable: { + type: 'boolean', + name: 'ignore_unavailable' + }, + allowNoIndices: { + type: 'boolean', + name: 'allow_no_indices' + }, + expandWildcards: { + type: 'enum', + 'default': 'open', + options: [ + 'open', + 'closed' + ], + name: 'expand_wildcards' + } + }, + urls: [ + { + fmt: '/<%=index%>/<%=type%>/_search_shards', + req: { + index: { + type: 'string' + }, + type: { + type: 'string' + } + } + }, + { + fmt: '/<%=index%>/_search_shards', + req: { + index: { + type: 'string' + } + } + }, + { + fmt: '/_search_shards' + } + ], + method: 'POST' +}); + /** * Perform a [searchTemplate](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html) request * @@ -5383,8 +5452,6 @@ api.update = ca({ type: 'enum', options: [ 'internal', - 'external', - 'external_gte', 'force' ], name: 'version_type' diff --git a/test/integration/yaml_suite/yaml_doc.js b/test/integration/yaml_suite/yaml_doc.js index ddaef2e4a..60092c696 100644 --- a/test/integration/yaml_suite/yaml_doc.js +++ b/test/integration/yaml_suite/yaml_doc.js @@ -390,8 +390,10 @@ YamlDoc.prototype = { catcher = null; } + var timeoutId; var cb = _.bind(function (error, body, status) { this._last_requests_response = body; + clearTimeout(timeoutId); if (error) { if (catcher) { @@ -414,7 +416,14 @@ YamlDoc.prototype = { done(error); }, this); - clientAction.call(client, params, cb); + var req = clientAction.call(client, params, cb); + timeoutId = setTimeout(function () { + // request timed out, so we will skip the rest of the tests and continue + req.abort(); + this.skipping = true; + this._last_requests_response = {}; + done(); + }.bind(this), 20000); }, /** From 546e23820bddb08ebecefac86c2e7132ecb2bdeb Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Fri, 25 Apr 2014 17:17:14 -0700 Subject: [PATCH 05/18] updated link to jenkins --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ae41712b..a4dd21427 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ bower install elasticsearch ## Supported Elasticsearch Versions -[Jenkins](https://build.elasticsearch.org/job/es-js_nightly/) +[Jenkins](http://build.elasticsearch.com/job/es-js_nightly/) Elasticsearch.js provides support for, and is regularly tested against, Elasticsearch releases **0.90.5 and greater**. We also test against the latest changes in the 0.90 and master branches of the Elasticsearch repository. To tell the client which version of Elastisearch you are using, and therefore the API it should provide, set the `apiVersion` config param. [More info](http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/configuration.html#_config_options) From 810adc9cbd8f765a56c4035d1c7b623699816ff9 Mon Sep 17 00:00:00 2001 From: Victor Quinn Date: Mon, 28 Apr 2014 11:58:23 -0400 Subject: [PATCH 06/18] Update api_methods.asciidoc Fix a minor typo in the docs: upcomming -> upcoming --- docs/api_methods.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api_methods.asciidoc b/docs/api_methods.asciidoc index 4c15ec3d1..a672cbb8f 100644 --- a/docs/api_methods.asciidoc +++ b/docs/api_methods.asciidoc @@ -2,7 +2,7 @@ == 1.1 API -NOTE: This is currently the default API, but in upcomming versions that will change. We recommend setting the `apiVersion` config param when you instantiate your client to make sure that the API does not change unexpectedly. +NOTE: This is currently the default API, but in upcoming versions that will change. We recommend setting the `apiVersion` config param when you instantiate your client to make sure that the API does not change unexpectedly. [[js-api-method-index]] * <> From 5edcab1d39d32e44993d53088671ec88b89547ed Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Mon, 5 May 2014 12:02:09 +0200 Subject: [PATCH 07/18] Fixed a link to the deprecated indices-status method --- docs/api_methods.asciidoc | 2 +- docs/api_methods_1_0.asciidoc | 2 +- docs/api_methods_1_x.asciidoc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api_methods.asciidoc b/docs/api_methods.asciidoc index a672cbb8f..d4529ffed 100644 --- a/docs/api_methods.asciidoc +++ b/docs/api_methods.asciidoc @@ -3665,7 +3665,7 @@ client.indices.status([params, [callback]]) Get a comprehensive status information of one or more indices. -The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-status.html[the elasticsearch docs] for more about this method. +The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/indices-status.html[the elasticsearch docs] for more about this method. // no examples diff --git a/docs/api_methods_1_0.asciidoc b/docs/api_methods_1_0.asciidoc index a209aed5a..2ae048911 100644 --- a/docs/api_methods_1_0.asciidoc +++ b/docs/api_methods_1_0.asciidoc @@ -3558,7 +3558,7 @@ client.indices.status([params, [callback]]) Get a comprehensive status information of one or more indices. -The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-status.html[the elasticsearch docs] for more about this method. +The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/indices-status.html[the elasticsearch docs] for more about this method. // no examples diff --git a/docs/api_methods_1_x.asciidoc b/docs/api_methods_1_x.asciidoc index a64ee5730..870549554 100644 --- a/docs/api_methods_1_x.asciidoc +++ b/docs/api_methods_1_x.asciidoc @@ -3733,7 +3733,7 @@ client.indices.status([params, [callback]]) Get a comprehensive status information of one or more indices. -The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-status.html[the elasticsearch docs] for more about this method. +The default method is `GET` and the usual <> apply. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/indices-status.html[the elasticsearch docs] for more about this method. // no examples From e0de5d1f31ff12b5187fd87df9dfaa77e96a508e Mon Sep 17 00:00:00 2001 From: Brian Woodward Date: Tue, 6 May 2014 11:57:43 -0400 Subject: [PATCH 08/18] Update quick_start.asciidoc Since the `from` property is doing this `from: (pageNum - 1) * perPage,` logic, I think the default for `pageNum` should be `1`. Otherwise it would results it `-15` when `pageNum` and `perPage` are defaults. --- docs/quick_start.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/quick_start.asciidoc b/docs/quick_start.asciidoc index 36c2041ec..06f1794eb 100644 --- a/docs/quick_start.asciidoc +++ b/docs/quick_start.asciidoc @@ -112,7 +112,7 @@ NOTE: In this example, `request` and `response` are http://expressjs.com/api.htm [source,js] ----------------- -var pageNum = request.param('page', 0); +var pageNum = request.param('page', 1); var perPage = request.param('per_page', 15); var userQuery = request.param('search_query'); var userId = request.session.userId; @@ -158,4 +158,4 @@ client.search({ }); ----------------- -You can find a lot more information about filters http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-filters.html[here] \ No newline at end of file +You can find a lot more information about filters http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-filters.html[here] From cbb718296551855e875ffec9b55ce3952d1dd470 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Thu, 8 May 2014 17:24:02 -0700 Subject: [PATCH 09/18] moved browser-builds section to their own page/file and modified verbiage about IE9 --- docs/about.asciidoc | 44 +-------------------------------- docs/browser_builds.asciidoc | 47 ++++++++++++++++++++++++++++++++++++ docs/index.asciidoc | 2 ++ 3 files changed, 50 insertions(+), 43 deletions(-) create mode 100644 docs/browser_builds.asciidoc diff --git a/docs/about.asciidoc b/docs/about.asciidoc index a61dab1da..01bbe7bf1 100644 --- a/docs/about.asciidoc +++ b/docs/about.asciidoc @@ -17,46 +17,4 @@ npm install --save elasticsearch -------- === Browser Builds - -We also provide builds of the elasticsearch.js client for use in the browser. These versions of the client are currently ***experimental***. We test these builds using https://saucelabs.com/u/elasticsearch-js[saucelabs] in Chrome, Firefox, and Internet Explorer 10, and 11. We also test in IE 9, but there is a known issue with making non-standard (get/post) requests across domains. - -==== Bower -If you use bower to manage your dependencies, then just run: - -[source,shell] ---------- -bower install elasticsearch ---------- - -==== Download - * v2.1.4: https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.4.zip[zip], https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.4.tar.gz[tar.gz] - - -==== Angular Build (elasticsearch.angular.js) - * Registers the elasticsearch object as a factory `esFactory` - * Uses Angular's `$http` service - * Returns promises using Angular's `$q` service to properly trigger digest cycles within Angular - -.Create a client instance and register it as a service -[source,js] -------------------- -module.service('es', function (esFactory) { - return esFactory({ - host: 'localhost:9200', - // ... - }); -}); -------------------- - -==== jQuery Build (elasticsearch.jquery.js) - * Uses jQuery's `.ajax()` functionality - * Returns jQuery "promises" - * Registers the module at `jQuery.es` - -.Create a client with the jQuery build -[source,js] -------------------- -var client = new $.es.Client({ - hosts: 'localhost:9200' -}); -------------------- +See <> \ No newline at end of file diff --git a/docs/browser_builds.asciidoc b/docs/browser_builds.asciidoc new file mode 100644 index 000000000..2ccccae54 --- /dev/null +++ b/docs/browser_builds.asciidoc @@ -0,0 +1,47 @@ +[browser-builds] +==== Browser Builds + +We also provide builds of the elasticsearch.js client for use in the browser. These versions of the client are currently ***experimental***. We test these builds using https://saucelabs.com/u/elasticsearch-js[saucelabs] in Chrome, Firefox, and Internet Explorer 10, and 11. + +While there is https://github.com/elasticsearch/elasticsearch-js/issues/96#issuecomment-42617480[a way to get it working in IE 9], the browser severly limits what you can do with cross-domain requests. Because of these limits, many of the API calls and other functionality do not work. + +===== Bower +If you use bower to manage your dependencies, then just run: + +[source,shell] +--------- +bower install elasticsearch +--------- + +===== Download + * v2.1.4: https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.4.zip[zip], https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.4.tar.gz[tar.gz] + + +===== Angular Build (elasticsearch.angular.js) + * Registers the elasticsearch object as a factory `esFactory` + * Uses Angular's `$http` service + * Returns promises using Angular's `$q` service to properly trigger digest cycles within Angular + +.Create a client instance and register it as a service +[source,js] +------------------- +module.service('es', function (esFactory) { + return esFactory({ + host: 'localhost:9200', + // ... + }); +}); +------------------- + +===== jQuery Build (elasticsearch.jquery.js) + * Uses jQuery's `.ajax()` functionality + * Returns jQuery "promises" + * Registers the module at `jQuery.es` + +.Create a client with the jQuery build +[source,js] +------------------- +var client = new $.es.Client({ + hosts: 'localhost:9200' +}); +------------------- diff --git a/docs/index.asciidoc b/docs/index.asciidoc index 51b51933c..5bf76109f 100644 --- a/docs/index.asciidoc +++ b/docs/index.asciidoc @@ -2,6 +2,8 @@ include::about.asciidoc[] +include::browser_builds.asciidoc[] + include::quick_start.asciidoc[] include::api_conventions.asciidoc[] From 81ecbd5be3882f29167f78e15a9aa892f159e4be Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Thu, 8 May 2014 17:27:02 -0700 Subject: [PATCH 10/18] fixed asciidoc id --- docs/browser_builds.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/browser_builds.asciidoc b/docs/browser_builds.asciidoc index 2ccccae54..536b61014 100644 --- a/docs/browser_builds.asciidoc +++ b/docs/browser_builds.asciidoc @@ -1,4 +1,4 @@ -[browser-builds] +[[browser-builds]] ==== Browser Builds We also provide builds of the elasticsearch.js client for use in the browser. These versions of the client are currently ***experimental***. We test these builds using https://saucelabs.com/u/elasticsearch-js[saucelabs] in Chrome, Firefox, and Internet Explorer 10, and 11. From dbf2de3319194ac1220053ee9261ae107321aadc Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Thu, 8 May 2014 17:43:27 -0700 Subject: [PATCH 11/18] push browser_buils to their own page --- docs/browser_builds.asciidoc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/browser_builds.asciidoc b/docs/browser_builds.asciidoc index 536b61014..82a18f7ac 100644 --- a/docs/browser_builds.asciidoc +++ b/docs/browser_builds.asciidoc @@ -1,11 +1,11 @@ [[browser-builds]] -==== Browser Builds +== Browser Builds We also provide builds of the elasticsearch.js client for use in the browser. These versions of the client are currently ***experimental***. We test these builds using https://saucelabs.com/u/elasticsearch-js[saucelabs] in Chrome, Firefox, and Internet Explorer 10, and 11. While there is https://github.com/elasticsearch/elasticsearch-js/issues/96#issuecomment-42617480[a way to get it working in IE 9], the browser severly limits what you can do with cross-domain requests. Because of these limits, many of the API calls and other functionality do not work. -===== Bower +=== Bower If you use bower to manage your dependencies, then just run: [source,shell] @@ -13,11 +13,12 @@ If you use bower to manage your dependencies, then just run: bower install elasticsearch --------- -===== Download +=== Download * v2.1.4: https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.4.zip[zip], https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.4.tar.gz[tar.gz] -===== Angular Build (elasticsearch.angular.js) +=== Angular Build + * use the file named `elasticsearch.angular.js` or `elasticsearch.angular.min.js` * Registers the elasticsearch object as a factory `esFactory` * Uses Angular's `$http` service * Returns promises using Angular's `$q` service to properly trigger digest cycles within Angular @@ -33,7 +34,8 @@ module.service('es', function (esFactory) { }); ------------------- -===== jQuery Build (elasticsearch.jquery.js) +=== jQuery Build + * use the file named `elasticsearch.jquery.js` or `elasticsearch.jquery.min.js` * Uses jQuery's `.ajax()` functionality * Returns jQuery "promises" * Registers the module at `jQuery.es` From 0bdb424d4032f8ab20d7ba52fda5e5b32cddfae6 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Thu, 8 May 2014 18:11:56 -0700 Subject: [PATCH 12/18] added a link directly to the browser_builds page --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a4dd21427..8fc432a13 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ npm install elasticsearch [![Selenium Tests Status](https://saucelabs.com/browser-matrix/elasticsearch-js.svg)](https://saucelabs.com/u/elasticsearch-js) -We also provide builds of the elasticsearch.js client for use in the browser. These versions of the client are currently *experimental*. +We also provide builds of the elasticsearch.js client for use in the browser. These versions of the client are currently *experimental*. More information is available [here](http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/browser-builds.html). ### Bower If you use bower to manage your dependencies, then just run: @@ -38,6 +38,7 @@ bower install elasticsearch ## Docs - [Quick Start](http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/quick-start.html) + - [Browser Builds](http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/browser-builds.html) - [API](http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/api-reference.html) - [Configuration](http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/configuration.html) - [Development/Contributing](https://github.com/elasticsearch/elasticsearch-js/blob/master/CONTRIBUTING.md) From 928692d5cc1d0f180b9d31553acd46e3f9c6ae07 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Mon, 19 May 2014 11:35:07 -0700 Subject: [PATCH 13/18] version 2.1.5 --- CHANGELOG.md | 3 +++ README.md | 2 +- docs/browser_builds.asciidoc | 2 +- package.json | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cf9fc0cc..8ca946b1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 2.1 (Mar 27 2014) - The default API version is now `'1.1'` +- Errors generated in the browser will now have stack traces +- Clarified IE-support +- Improvements to the bundled log-generator ## 2.0 (Mar 27 2014) - The default API version is now `'1.0'` diff --git a/README.md b/README.md index 8fc432a13..2d1e16579 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ bower install elasticsearch ``` ### Download - - v2.1.4: [zip](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.4.zip), [tar.gz](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.4.tar.gz) + - v2.1.5: [zip](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.5.zip), [tar.gz](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.5.tar.gz) ## Docs - [Quick Start](http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/quick-start.html) diff --git a/docs/browser_builds.asciidoc b/docs/browser_builds.asciidoc index 82a18f7ac..b56afbde0 100644 --- a/docs/browser_builds.asciidoc +++ b/docs/browser_builds.asciidoc @@ -14,7 +14,7 @@ bower install elasticsearch --------- === Download - * v2.1.4: https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.4.zip[zip], https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.4.tar.gz[tar.gz] + * v2.1.5: https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.5.zip[zip], https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.5.tar.gz[tar.gz] === Angular Build diff --git a/package.json b/package.json index 1de95fdf8..b6f974a77 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "description": "The official low-level Elasticsearch client for Node.js and the browser.", "main": "src/elasticsearch.js", "homepage": "http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/index.html", - "version": "2.1.4", + "version": "2.1.5", "browser": { "./src/lib/connectors/index.js": "./src/lib/connectors/browser_index.js", "./src/lib/loggers/index.js": "./src/lib/loggers/browser_index.js", From 33b19ab634ab439962507b6627411855b1e1f7e1 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Mon, 19 May 2014 11:41:19 -0700 Subject: [PATCH 14/18] forgot to exclude _elasticsearch directories from npm --- .npmignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.npmignore b/.npmignore index 8797e708e..cc7d29402 100644 --- a/.npmignore +++ b/.npmignore @@ -9,7 +9,7 @@ test/integration/yaml_suite/log ## generated files test/integration/yaml_suite/yaml_tests*.json test/integration/yaml_suite/index*.js -src/elasticsearch*/ +src/_elasticsearch*/ src/bower*/ junit-*.xml elasticsearch*.log From 1bcc5849e0bc7b49665cbb3d90a80b9b19a57fb1 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Mon, 19 May 2014 11:42:16 -0700 Subject: [PATCH 15/18] version 2.1.6 --- README.md | 2 +- docs/browser_builds.asciidoc | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2d1e16579..17641ade9 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ bower install elasticsearch ``` ### Download - - v2.1.5: [zip](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.5.zip), [tar.gz](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.5.tar.gz) + - v2.1.6: [zip](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.6.zip), [tar.gz](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.6.tar.gz) ## Docs - [Quick Start](http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/quick-start.html) diff --git a/docs/browser_builds.asciidoc b/docs/browser_builds.asciidoc index b56afbde0..9084bd800 100644 --- a/docs/browser_builds.asciidoc +++ b/docs/browser_builds.asciidoc @@ -14,7 +14,7 @@ bower install elasticsearch --------- === Download - * v2.1.5: https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.5.zip[zip], https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.5.tar.gz[tar.gz] + * v2.1.6: https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.6.zip[zip], https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.6.tar.gz[tar.gz] === Angular Build diff --git a/package.json b/package.json index b6f974a77..26b043e02 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "description": "The official low-level Elasticsearch client for Node.js and the browser.", "main": "src/elasticsearch.js", "homepage": "http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/index.html", - "version": "2.1.5", + "version": "2.1.6", "browser": { "./src/lib/connectors/index.js": "./src/lib/connectors/browser_index.js", "./src/lib/loggers/index.js": "./src/lib/loggers/browser_index.js", From d63aa0c95046797e4f3642dba4f0acd9bae6cb07 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Thu, 22 May 2014 09:12:02 -0700 Subject: [PATCH 16/18] version 2.2.0 --- README.md | 2 +- docs/browser_builds.asciidoc | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7ecb90ca2..16d6d2bc2 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ bower install elasticsearch ``` ### Download - - v2.1.6: [zip](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.6.zip), [tar.gz](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.6.tar.gz) + - v2.2.0: [zip](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.2.0.zip), [tar.gz](https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.2.0.tar.gz) ## Docs - [Quick Start](http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/quick-start.html) diff --git a/docs/browser_builds.asciidoc b/docs/browser_builds.asciidoc index 9084bd800..752a538bc 100644 --- a/docs/browser_builds.asciidoc +++ b/docs/browser_builds.asciidoc @@ -14,7 +14,7 @@ bower install elasticsearch --------- === Download - * v2.1.6: https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.6.zip[zip], https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.1.6.tar.gz[tar.gz] + * v2.2.0: https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.2.0.zip[zip], https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-2.2.0.tar.gz[tar.gz] === Angular Build diff --git a/package.json b/package.json index f214eacb5..06e2bbc38 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "description": "The official low-level Elasticsearch client for Node.js and the browser.", "main": "src/elasticsearch.js", "homepage": "http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/index.html", - "version": "2.1.6", + "version": "2.2.0", "browser": { "./src/lib/connectors/index.js": "./src/lib/connectors/browser_index.js", "./src/lib/loggers/index.js": "./src/lib/loggers/browser_index.js", From 0e4c434fe430551f186cc0484874aa234c4b558d Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Wed, 9 Jul 2014 11:33:26 -0700 Subject: [PATCH 17/18] expanded angular client docs a bit, and mentioned the example integration project. --- docs/browser_builds.asciidoc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/browser_builds.asciidoc b/docs/browser_builds.asciidoc index 752a538bc..8ac744ab2 100644 --- a/docs/browser_builds.asciidoc +++ b/docs/browser_builds.asciidoc @@ -18,15 +18,22 @@ bower install elasticsearch === Angular Build - * use the file named `elasticsearch.angular.js` or `elasticsearch.angular.min.js` - * Registers the elasticsearch object as a factory `esFactory` + * Registers the an `esFactory` factory in the `"elasticsearch"` module * Uses Angular's `$http` service * Returns promises using Angular's `$q` service to properly trigger digest cycles within Angular +NOTE: Checkout an example that integrates elasticsearch.js with angular https://github.com/spenceralger/elasticsearch-angular-example[on GitHub] + +.Include the `"elasticsearch"` module in your app +[source,js] +------------------- +var myApp = angular.module('myApp', ['elasticsearch']); +------------------- + .Create a client instance and register it as a service [source,js] ------------------- -module.service('es', function (esFactory) { +module.service('client', function (esFactory) { return esFactory({ host: 'localhost:9200', // ... @@ -35,7 +42,6 @@ module.service('es', function (esFactory) { ------------------- === jQuery Build - * use the file named `elasticsearch.jquery.js` or `elasticsearch.jquery.min.js` * Uses jQuery's `.ajax()` functionality * Returns jQuery "promises" * Registers the module at `jQuery.es` From 838cfe8cf653d5eb26cd876ff13e2f778a3a225d Mon Sep 17 00:00:00 2001 From: vzvenyach Date: Fri, 25 Jul 2014 21:41:39 -0400 Subject: [PATCH 18/18] Update quick_start.asciidoc typo --- docs/quick_start.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/quick_start.asciidoc b/docs/quick_start.asciidoc index 06f1794eb..04a199055 100644 --- a/docs/quick_start.asciidoc +++ b/docs/quick_start.asciidoc @@ -2,7 +2,7 @@ == Quick Start === Creating a client -Start using Elasticsearch.js by creating an instance of the `elasticsearch.Client` class. The constructor accepts a config object/hash where you can define defaults values, or even entire classes, for the client to use. For a full list of config options check out the the <>. +Start using Elasticsearch.js by creating an instance of the `elasticsearch.Client` class. The constructor accepts a config object/hash where you can define defaults values, or even entire classes, for the client to use. For a full list of config options check out the the <>. [source,js] -----------------