diff --git a/package.json b/package.json index ef160ab83..a9f9ac47a 100644 --- a/package.json +++ b/package.json @@ -12,15 +12,16 @@ "grunt-contrib-concat": "~0.3.0", "grunt-contrib-jshint": "~0.6.0", "grunt-contrib-nodeunit": "~0.2.0", - "should": "~1.3.0", - "nodeunit": "~0.8.1", "js-yaml": "~2.1.0", "mkdirp": "~0.3.5", "yuidoc-bootstrap-theme": "git://github.com/spenceralger/yuidoc-bootstrap-theme.git#master", "grunt-contrib-yuidoc": "~0.5.0", "grunt-simple-mocha": "~0.4.0", "mocha": "~1.13.0", - "mocha-as-promised": "~1.4.0" + "mocha-as-promised": "~1.4.0", + "moment": "~2.2.1", + "should": "~2.0.1", + "sinon": "~1.7.3" }, "license": "Apache License", "dependencies": { @@ -28,7 +29,9 @@ "require-directory": "git://github.com/spenceralger/node-require-directory.git#master", "cli-color": "~0.2.3", "qs": "~0.6.5", + "expect.js": "~0.2.0", "q": "~0.9.7", - "expect.js": "~0.2.0" + "async": "~0.2.9", + "optimist": "~0.6.0" } } diff --git a/scripts/generate_js_api/aliases.js b/scripts/generate/js_api/aliases.js similarity index 100% rename from scripts/generate_js_api/aliases.js rename to scripts/generate/js_api/aliases.js diff --git a/scripts/generate_js_api/index.js b/scripts/generate/js_api/index.js similarity index 87% rename from scripts/generate_js_api/index.js rename to scripts/generate/js_api/index.js index 08da6e86f..b15041dae 100644 --- a/scripts/generate_js_api/index.js +++ b/scripts/generate/js_api/index.js @@ -1,10 +1,10 @@ -var _ = require('../../src/lib/toolbelt') +var _ = require('../../../src/lib/utils') , asset = require('assert') , path = require('path') , fs = require('fs') , mkdirp = require('mkdirp') - , docs = _.requireDir(module, '../../es_api_spec/api') - , outputDir = _.joinPath(__dirname, '../../src/api/') + , docs = _.requireDir(module, '../../../es_api_spec/api') + , outputDir = _.joinPath(__dirname, '../../../src/api/') , templates = require('./templates') , notes = require('./notes') , aliases = require('./aliases'); @@ -35,7 +35,7 @@ _.each(docs, function (doc) { var spec = { name: name, - methods: _.map(def.methods, function (m) { return m.toLowerCase(); }), + methods: _.map(def.methods, function (m) { return m.toUpperCase(); }), docUrl: def.documentation, urlParts: def.url.parts, params: def.url.params, diff --git a/scripts/generate/js_api/notes.js b/scripts/generate/js_api/notes.js new file mode 100644 index 000000000..0cfe3271c --- /dev/null +++ b/scripts/generate/js_api/notes.js @@ -0,0 +1,2 @@ +// exports['cluster.node_info'] = +// '//TODO: this enpoint ***needs*** work, many of the possible urls are not supported'; diff --git a/scripts/generate_js_api/templates/action.tmpl b/scripts/generate/js_api/templates/action.tmpl similarity index 69% rename from scripts/generate_js_api/templates/action.tmpl rename to scripts/generate/js_api/templates/action.tmpl index 85a320b50..eec4629fd 100644 --- a/scripts/generate_js_api/templates/action.tmpl +++ b/scripts/generate/js_api/templates/action.tmpl @@ -1,5 +1,7 @@ -var _ = require('<%= path2lib %>toolbelt') - , paramHelper = require('<%= path2lib %>param_helper');<% +var _ = require('<%= path2lib %>utils'), + paramHelper = require('<%= path2lib %>param_helper'), + errors = require('<%= path2lib %>errors'), + q = require('q');<% if (_.keys(enumOptions).length) { @@ -11,9 +13,6 @@ var <%= name %>Options = <%= stringify(options) %>;<% } %> -<%= notes ? notes + '\n' : '' -%> - /** * Perform an elasticsearch [<%= name %>](<%= docUrl %>) request * @@ -24,7 +23,7 @@ var <%= name %>Options = <%= stringify(options) %>;<% }) %> */ -function do<%= _.studlyCase(name) %>(params, callback) { +function do<%= _.studlyCase(name) %>(params, cb) { params = params || {}; var request = {<% @@ -39,22 +38,22 @@ function do<%= _.studlyCase(name) %>(params, callback) { body: params.body || null<% } }%> } - , url = {} + , parts = {} , query = {} , responseOpts = {}; <% if (methods.length > 1) { %> - if (params.method = _.toLowerString(params.method)) { + if (params.method = _.toUpperString(params.method)) { if (<%= _.map(methods, function (method) { return 'params.method === ' + stringify(method) }).join(' || ') %>) { request.method = params.method; } else { throw new TypeError('Invalid method: should be one of <%= methods.join(', ') %>'); } } else {<% - if (_.contains(methods, 'get')) { - var nonGet = _.find(methods, function (m) {return m !== 'get'; });%> - request.method = params.body ? <%= stringify(nonGet) %> : 'get';<% + if (_.contains(methods, 'GET')) { + var nonGet = _.find(methods, function (m) {return m !== 'GET'; });%> + request.method = params.body ? <%= stringify(nonGet) %> : 'GET';<% } else {%> request.method = <%= stringify(methods[0]) %>;<% }%> @@ -64,21 +63,17 @@ if (methods.length > 1) { %> } %> - // find the url's params -<%= writeParams(2, urlParts, 'url.') %> + // find the paths's params +<%= writeParams(2, urlParts, 'parts.') %> - // build the url + // build the path <%= writeUrls(2, urls, urlParts, params) %> // build the query string <%= writeParams(2, params, 'query.') %> - request.url = request.url + _.makeQueryString(query); + request.path = request.path + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; +<%= returnStatement(2, name) %> } module.exports = do<%= _.studlyCase(name) %>; diff --git a/scripts/generate_js_api/templates/any.param.tmpl b/scripts/generate/js_api/templates/any.param.tmpl similarity index 100% rename from scripts/generate_js_api/templates/any.param.tmpl rename to scripts/generate/js_api/templates/any.param.tmpl diff --git a/scripts/generate_js_api/templates/boolean.param.tmpl b/scripts/generate/js_api/templates/boolean.param.tmpl similarity index 100% rename from scripts/generate_js_api/templates/boolean.param.tmpl rename to scripts/generate/js_api/templates/boolean.param.tmpl diff --git a/scripts/generate_js_api/templates/duration.param.tmpl b/scripts/generate/js_api/templates/duration.param.tmpl similarity index 100% rename from scripts/generate_js_api/templates/duration.param.tmpl rename to scripts/generate/js_api/templates/duration.param.tmpl diff --git a/scripts/generate_js_api/templates/enum.param.tmpl b/scripts/generate/js_api/templates/enum.param.tmpl similarity index 100% rename from scripts/generate_js_api/templates/enum.param.tmpl rename to scripts/generate/js_api/templates/enum.param.tmpl diff --git a/scripts/generate_js_api/templates/index.js b/scripts/generate/js_api/templates/index.js similarity index 77% rename from scripts/generate_js_api/templates/index.js rename to scripts/generate/js_api/templates/index.js index ba1ad29be..0a5799eba 100644 --- a/scripts/generate_js_api/templates/index.js +++ b/scripts/generate/js_api/templates/index.js @@ -1,5 +1,5 @@ -var _ = require('../../../src/lib/toolbelt') +var _ = require('../../../../src/lib/utils') , fs = require('fs') , path = require('path') , urlParamRE = /\{(\w+)\}/g; @@ -13,7 +13,9 @@ var _ = require('../../../src/lib/toolbelt') function lines(i) { function l(line) { - l.lines.push(_.repeat(' ', l.indent) + line); + if (typeof line !== 'undefined') { + l.lines.push(_.repeat(' ', l.indent) + line); + } return l; } @@ -25,14 +27,14 @@ function lines(i) { return l; }; - l.in = function () { + l.in = function (line) { l.indent += 2; - return l; + return l(line); }; - l.out = function () { + l.out = function (line) { l.indent -= 2; - return l; + return l(line); }; l.toString = function () { @@ -109,14 +111,14 @@ var templateGlobals = { // collect the vars from the url and replace them to form the js that will build the url var makeL = lines(), vars = []; - makeL('request.url = \'' + url.replace(urlParamRE, function (match, varName) { + makeL('request.path = \'' + url.replace(urlParamRE, function (match, varName) { var varDetails = urlParams[varName]; varDetails.name = varName; vars.push(varDetails); if (urlVarIsRequired(varDetails)) { - return '\' + encodeURIComponent(url.' + varName + ') + \''; + return '\' + encodeURIComponent(parts.' + varName + ') + \''; } else { - return '\' + encodeURIComponent(url.' + varName + ' || ' + stringify(varDetails.default) + ') + \''; + return '\' + encodeURIComponent(parts.' + varName + ' || ' + stringify(varDetails.default) + ') + \''; } }) + '\';'); @@ -131,17 +133,20 @@ var templateGlobals = { var requiredVars = _.filter(vars, urlVarIsRequired); var condition = _.map(requiredVars, function (v) { - return 'url.hasOwnProperty(\'' + v.name + '\')'; + return 'parts.hasOwnProperty(\'' + v.name + '\')'; }).join(' && '); - l((urlIndex > 0 ? 'else ' : '') + (condition ? 'if (' + condition + ') ' : '') + '{').in(); - l.split(makeL.toString()).out(); - l('}'); + l((urlIndex > 0 ? 'else ' : '') + (condition ? 'if (' + condition + ') ' : '') + '{') + .in() + .split(makeL.toString()) + .out('}'); if (urlIndex === urls.length - 1 && condition) { - l('else {').in(); - l('throw new TypeError(\'Unable to build a url with those params. Supply at least ' + vars.join(', ') + '\');').out(); - l('}'); + l('else {') + .in('throw new TypeError(\'Unable to build a path with those params. Supply at least ' + + vars.join(', ') + '\');' + ) + .out('}'); } } else { @@ -185,6 +190,22 @@ var templateGlobals = { } else { return name; } + }, + + returnStatement: function (indent, name) { + var l = lines(indent); + if (name.match(/(^|\.)exists/)) { + l('this.client.request(request, function (err, response) {') + .in('if (err instanceof errors.NotFound) {') + .in('cb(err, false);') + .out('} else {') + .in('cb(err, true);') + .out('}') + .out('});'); + } else { + l('this.client.request(request, cb);'); + } + return l.toString(); } }; diff --git a/scripts/generate_js_api/templates/list.param.tmpl b/scripts/generate/js_api/templates/list.param.tmpl similarity index 100% rename from scripts/generate_js_api/templates/list.param.tmpl rename to scripts/generate/js_api/templates/list.param.tmpl diff --git a/scripts/generate_js_api/templates/number.param.tmpl b/scripts/generate/js_api/templates/number.param.tmpl similarity index 100% rename from scripts/generate_js_api/templates/number.param.tmpl rename to scripts/generate/js_api/templates/number.param.tmpl diff --git a/scripts/generate_js_api/templates/string.param.tmpl b/scripts/generate/js_api/templates/string.param.tmpl similarity index 100% rename from scripts/generate_js_api/templates/string.param.tmpl rename to scripts/generate/js_api/templates/string.param.tmpl diff --git a/scripts/generate_js_api/templates/time.param.tmpl b/scripts/generate/js_api/templates/time.param.tmpl similarity index 100% rename from scripts/generate_js_api/templates/time.param.tmpl rename to scripts/generate/js_api/templates/time.param.tmpl diff --git a/scripts/generate/logs/index.js b/scripts/generate/logs/index.js new file mode 100644 index 000000000..9c247584a --- /dev/null +++ b/scripts/generate/logs/index.js @@ -0,0 +1,155 @@ +// args +var count = parseInt(process.argv[2] || 14000, 10), + days = parseInt(process.argv[3] || 7, 10); + +var es = require('../../../src/elasticsearch'), + _ = require('../../../src/lib/utils'), + q = require('q'), + async = require('async'), + moment = require('moment'), + makeSamples = require('./samples').make, + startingMoment = moment().startOf('day').subtract('days', days), + endingMoment = moment().endOf('day').add('days', days), + client = new es.Client({ + log: 'info' + }); + +client.log.info('Generating', count, 'events across ±', days, 'days'); + +fillIndecies(function () { + var actions = [], + samples = makeSamples(startingMoment, endingMoment); + + async.timesSeries(count, function (i, done) { + // random date, plus less random time + var date = moment(samples.randomMsInDayRange()) + .utc() + .startOf('day') + .add('milliseconds', samples.lessRandomMsInDay()); + + var event = { + index: date.format('[logstash-]YYYY.MM.DD'), + '@timestamp': date.toISOString(), + ip: samples.ips(), + extension: samples.extensions(), + response: samples.responseCodes(), + country: samples.countries(), + point: samples.airports(), + '@tags': [samples.tags(), samples.tags2()], + utc_time: date.toISOString(), + referer: 'http://' + samples.referrers() + '/' + samples.tags() + '/' + samples.astronauts(), + agent: samples.userAgents(), + }; + + event.clientip = event.ip; + event.bytes = event.response < 500 ? samples.lessRandomRespSize() : 0; + event.request = '/' + samples.astronauts() + '.' + event.extension; + event.memory = event.extension === 'php' ? event.bytes * 40 : 0; + if (event.memory) { + event.phpmemory = event.memory; + } + + event['@message'] = event.ip + ' - - [' + date.toISOString() + '] "GET ' + event.request + ' HTTP/1.1" ' + + event.respCode + ' ' + event.respSize + ' "-" "' + event.agent + '"'; + event.src = JSON.stringify(event, null, ' '); + + actions.push({ + index: { + _index: event.index, + _type: samples.types(), + _id: i + } + }); + actions.push(event); + + if (actions.length === 3000 || i === count - 1) { + client.log.info('writing', actions.length / 2, 'documents'); + client.bulk({ + body: actions + }, done); + actions = []; + } else { + done(); + } + }, function (err) { + if (err) { + throw err; + } else { + console.log('Done!'); + } + }); +}); + +function fillIndecies(cb) { + var movingDate = moment(startingMoment); + var indexBody = { + mappings: { + _default_: { + properties: { + '@timestamp': { + type: 'date', + index: 'not_analyzed' + }, + id: { + type: 'integer', + index: 'not_analyzed', + include_in_all: false + }, + country: { + type: 'string', + index: 'not_analyzed' + }, + agent: { + type: 'multi_field', + fields: { + agent: { + type: 'string', + index: 'analyzed' + }, + raw: { + type: 'string', + index: 'not_analyzed' + } + } + }, + ip: { + type: 'ip' + } + } + } + } + }, + indexPushActions = []; + + function createDateIndex(indexName) { + return function (done) { + client.indices.create({ + ignore: 400, + index: indexName, + body: indexBody + }, function (err, resp) { + if (err) { + done(err); + } else { + done(null, resp.error ? 'existed' : 'created'); + } + }); + }; + } + + while (movingDate.unix() < endingMoment.unix()) { + indexPushActions.push(createDateIndex(movingDate.format('[logstash-]YYYY.MM.DD'))); + movingDate.add('day', 1); + } + + async.parallel(indexPushActions, function (err, responses) { + if (err) { + client.log.error(err); + } else { + _.each(_.groupBy(responses), function (list, did) { + client.log.info(list.length, 'indicies', did); + }); + cb(); + } + }); +} diff --git a/scripts/generate/logs/samples/airports.js b/scripts/generate/logs/samples/airports.js new file mode 100644 index 000000000..c34fa189e --- /dev/null +++ b/scripts/generate/logs/samples/airports.js @@ -0,0 +1,3369 @@ +module.exports = [ + [31.95376472, -89.23450472], + [30.68586111, -95.01792778], + [38.94574889, -104.5698933], + [42.74134667, -78.05208056], + [30.6880125, -81.90594389], + [34.49166667, -88.20111111], + [32.85048667, -86.61145333], + [43.08751, -88.17786917], + [40.67331278, -80.64140639], + [40.44725889, -92.22696056], + [33.93011222, -89.34285194], + [46.88384889, -96.35089861], + [41.51961917, -87.40109333], + [31.42127556, -97.79696778], + [39.60416667, -116.0050597], + [32.46047167, -85.68003611], + [41.98934083, -88.10124278], + [48.88434111, -99.62087694], + [33.53456583, -89.31256917], + [41.43156583, -74.39191722], + [41.97602222, -114.6580911], + [41.30716667, -85.06433333], + [32.52883861, -94.97174556], + [42.57450861, -84.81143139], + [41.11668056, -98.05033639], + [32.52943944, -86.32822139], + [48.30079861, -102.4063514], + [40.65138528, -98.07978667], + [32.76124611, -89.53007139], + [32.11931306, -88.1274625], + [31.07447222, -81.42777778], + [41.63695083, -99.34038139], + [33.99150222, -90.078145], + [38.86872333, -77.00747583], + [35.98531194, -85.80931806], + [32.93679056, -87.08888306], + [36.37094306, -82.17374111], + [61.93396417, -162.8929358], + [44.42506444, -70.80784778], + [42.60355556, -97.25263889], + [42.59136361, -72.52275472], + [44.11672722, -72.82705806], + [41.25130806, -72.03161139], + [42.40418556, -88.63343222], + [42.11388722, -96.72892556], + [42.35083333, -86.25613889], + [44.98730556, -99.9535], + [34.98560639, -106.0094661], + [35.71765889, -108.2015961], + [33.60166667, -97.77556], + [41.29028694, -98.99064278], + [35.38898833, -95.60165111], + [36.17528, -96.15181028], + [34.19592833, -96.67555694], + [43.10318389, -78.70334583], + [40.39944417, -96.17139694], + [41.46736111, -84.50655556], + [42.88062278, -76.78162028], + [39.0044525, -99.89289917], + [38.36674167, -84.28410056], + [31.60016778, -85.23882222], + [31.04247361, -86.31156111], + [31.364895, -85.30965556], + [42.7360825, -94.24524167], + [37.71798833, -117.2384119], + [35.76827222, -115.3296378], + [36.31108972, -114.4638672], + [33.8845475, -91.53429111], + [35.63778, -88.127995], + [36.01122694, -88.12328833], + [36.11659972, -87.73815889], + [34.36677444, -89.90008917], + [32.82587917, -91.187665], + [38.14611639, -120.6481733], + [39.94376806, -122.1713781], + [38.53146222, -121.7864906], + [40.02764333, -124.0733639], + [40.52210111, -121.8177683], + [31.29700806, -89.81282944], + [31.01621528, -87.44675972], + [29.97576083, -92.08415167], + [31.56683278, -91.50011889], + [31.96366222, -92.66026056], + [31.99071694, -93.30739306], + [48.958965, -119.4119622], + [48.04981361, -122.8012792], + [38.53916389, -106.0458483], + [40.5149125, -98.94565083], + [37.14172222, -79.01638889], + [43.30694778, -100.6281936], + [36.70972139, -110.2367978], + [42.40266472, -88.37588917], + [44.94996278, -94.0669175], + [40.53716667, -81.95436111], + [41.62787111, -74.13375583], + [41.95323306, -116.1876014], + [31.88329917, -85.48491361], + [41.22581222, -79.44098972], + [42.04808278, -88.05257194], + [31.39698611, -84.89525694], + [30.219, -96.37427778], + [41.89300139, -89.07829], + [47.81833333, -92.29166667], + [31.05126306, -87.06796833], + [40.04636111, -98.06011111], + [44.43746472, -93.91274083], + [43.45213722, -85.26480333], + [37.8515825, -96.29169806], + [40.96676444, -74.78016556], + [31.40988861, -86.08883583], + [33.18262167, -90.83065444], + [45.89857556, -94.87391], + [33.19155556, -99.71793056], + [31.13780556, -83.45308333], + [34.7723125, -88.16587444], + [61.43706083, -142.9037372], + [60.90582833, -162.4391158], + [41.09405556, -83.2125], + [31.74328472, -84.419285], + [42.99845056, -123.3095092], + [40.78141667, -82.97469444], + [31.00694444, -84.87761111], + [36.77430028, -102.5104364], + [31.86127139, -89.80285361], + [39.70547583, -75.03300306], + [58.98896583, -159.0499739], + [34.34010472, -83.13348333], + [36.69591306, -84.39160389], + [34.17402472, -83.56066528], + [33.12546111, -90.02555694], + [39.77842056, -74.94780389], + [56.32880417, -133.6100844], + [35.01619111, -84.34631083], + [35.222595, -83.41904389], + [36.6106375, -83.73741611], + [36.39728139, -85.64164278], + [32.438775, -86.51044778], + [45.00839444, -69.23976722], + [42.29130028, -73.71031944], + [43.61534389, -73.27455556], + [42.00013306, -71.19677139], + [41.69597444, -88.12923056], + [45.23053806, -96.56596556], + [42.35003667, -83.45826833], + [43.40332833, -98.82952972], + [44.73107278, -94.71471333], + [45.29329111, -97.51369889], + [44.86247611, -98.52953972], + [34.14698917, -97.12265194], + [34.07509694, -97.10667917], + [34.14040194, -96.81203222], + [33.17533333, -97.82838889], + [41.391, -83.63013889], + [41.15186167, -81.41658306], + [35.99221, -113.8166164], + [41.13144444, -81.76491667], + [43.18166667, -76.12777778], + [38.72752, -90.50830417], + [39.07045083, -88.53351972], + [38.47149444, -91.81531667], + [39.30250917, -88.00406194], + [42.36425, -74.06596806], + [40.54281417, -86.68167194], + [30.84577778, -85.60138889], + [34.85007333, -97.58642028], + [35.1550675, -97.47039389], + [36.56670028, -98.85231333], + [37.45419111, -100.9921119], + [30.08720833, -90.58266528], + [37.78746444, -114.4216567], + [37.74532639, -111.5701653], + [37.85969694, -112.816055], + [34.83398056, -92.25792778], + [33.14518056, -90.51528472], + [34.28034806, -87.60044139], + [36.59287528, -86.47691028], + [36.52589417, -88.91561611], + [37.12071889, -92.311245], + [40.82787639, -72.74871083], + [39.21915, -74.794765], + [40.97114556, -74.99747556], + [40.57027778, -75.48830556], + [46.6485775, -97.00564306], + [34.23758944, -98.74200917], + [38.99017472, -122.8997175], + [38.20241667, -121.2684167], + [35.73338222, -98.73063833], + [41.26320889, -122.2719528], + [31.671005, -92.15846722], + [31.6058475, -90.40931583], + [30.87046278, -87.81738167], + [47.10391667, -122.2871944], + [46.27110639, -106.6239206], + [46.32763139, -119.9705964], + [48.19018611, -116.9093644], + [42.24714972, -111.33826], + [36.80833833, -107.6514444], + [42.00942944, -101.7693439], + [40.03942972, -105.2258217], + [38.42838111, -105.1054994], + [38.78539722, -108.0636611], + [33.97231972, -86.37942722], + [33.13345889, -88.53559806], + [41.9852525, -73.96409722], + [46.92362444, -103.9785389], + [40.05367972, -106.3689467], + [44.99748861, -92.85568111], + [33.228725, -98.14671083], + [41.77287528, -73.01121667], + [39.328125, -82.44182167], + [34.27593833, -89.03839694], + [40.80950889, -75.76149639], + [30.27778889, -81.80594722], + [32.08487111, -88.73893389], + [40.75843139, -73.05372083], + [29.1384075, -98.94189028], + [35.3168625, -83.20936806], + [30.30105583, -83.02318778], + [36.828535, -106.8841914], + [31.70016583, -84.82492194], + [34.72226778, -89.01504944], + [26.44201083, -98.12945306], + [33.28761417, -85.80412861], + [39.26347222, -74.60747222], + [29.00101, -96.58194667], + [42.00211083, -117.7231972], + [34.09519722, -82.81586417], + [44.72801889, -96.26309972], + [34.30927778, -81.63972222], + [38.23442528, -84.43468667], + [29.65863889, -81.68855556], + [41.14597611, -80.16592194], + [41.210195, -81.25163083], + [45.04993556, -110.7466008], + [35.48624611, -84.93109722], + [36.34970833, -84.94664472], + [57.53510667, -153.9784169], + [63.03116111, -163.5299278], + [61.35848528, -155.4403508], + [43.38812944, -72.18925417], + [44.76852778, -69.37441667], + [43.884235, -72.25370333], + [40.97089139, -81.09981889], + [46.17301972, -98.07987556], + [32.75627778, -101.9194722], + [36.357035, -96.01138556], + [33.29288889, -95.89641806], + [32.75607944, -91.88057194], + [40.35944306, -80.70007806], + [39.95893667, -79.65713306], + [39.58027778, -79.33941667], + [40.03911111, -79.01455556], + [39.41042861, -88.8454325], + [36.96230778, -93.69531111], + [37.35502778, -87.39963889], + [40.29355556, -88.14236111], + [26.74200972, -81.04978917], + [31.78461111, -81.64116667], + [32.98654083, -82.38568139], + [32.89376972, -81.96511583], + [30.59786111, -84.55741667], + [37.58271111, -101.73281], + [34.89172583, -99.52675667], + [63.39387278, -153.2689733], + [37.11560444, -87.85556944], + [35.2343025, -87.25793222], + [35.43816667, -94.80277778], + [32.35347778, -89.48867944], + [35.27897583, -89.93147611], + [39.94378056, -120.9468983], + [38.57851778, -122.4352572], + [37.11244417, -120.2468406], + [36.81382111, -118.2050956], + [35.50592472, -98.34236111], + [45.38620833, -86.92448056], + [38.5790725, -121.8566322], + [31.64599472, -88.63475667], + [30.63762083, -86.99365278], + [30.50190833, -88.27511667], + [28.8250075, -97.86558333], + [47.45815333, -122.4773506], + [45.29567333, -122.9553783], + [42.58319167, -121.8761261], + [47.75320639, -118.7438936], + [34.18513639, -102.6410981], + [37.277505, -107.0558742], + [40.16367139, -105.1630369], + [40.10032333, -102.24096], + [40.10415306, -102.7129869], + [38.60053667, -77.07296917], + [38.31536111, -76.55011111], + [59.5624775, -139.7410994], + [42.38748056, -94.61803333], + [32.67535389, -102.652685], + [42.12787528, -71.37033556], + [46.52511111, -114.0528056], + [31.05527778, -85.88033333], + [34.16677639, -89.68619722], + [39.21837556, -75.59642667], + [47.12487194, -118.3927539], + [34.50705556, -81.94719444], + [42.53098278, -85.82513556], + [45.58944444, -120.6741667], + [37.96946389, -101.2554472], + [41.79067944, -123.3889444], + [40.48180556, -111.4288056], + [36.16565278, -92.14523611], + [35.37880028, -78.73362917], + [64.36263194, -161.2025369], + [46.38881583, -112.7669842], + [38.36247972, -111.5960164], + [40.39834833, -74.65760361], + [31.68932389, -87.7613875], + [34.26870833, -86.85833611], + [36.41008417, -83.55546167], + [35.02397611, -80.08127333], + [37.67162778, -97.07787222], + [42.10092806, -72.03840833], + [45.46302778, -69.55161111], + [42.09824111, -70.67212083], + [41.38390472, -72.50589444], + [43.66291528, -84.261325], + [42.20680306, -88.32304028], + [43.54691667, -83.89550222], + [46.19424889, -91.24640972], + [45.13535778, -87.18586556], + [44.62506389, -86.20061944], + [32.07345972, -93.76551889], + [32.86133333, -94.01015361], + [35.80685278, -96.42185556], + [43.43890528, -85.99478], + [45.03191861, -99.11566417], + [41.00158222, -81.75513111], + [40.90297222, -82.25563889], + [43.23472222, -77.12097222], + [43.03404639, -86.1981625], + [38.91463889, -82.09858333], + [39.91344194, -84.40030889], + [32.49268694, -80.99233028], + [33.59766667, -83.139], + [39.04327556, -96.84328694], + [37.99167972, -101.7462822], + [38.73290861, -89.80656722], + [38.45696333, -101.3532161], + [40.15847222, -89.33497222], + [39.16635306, -89.67489694], + [36.518375, -86.05828083], + [33.38900611, -88.00557806], + [33.56044333, -92.08538861], + [40.79525917, -89.6134025], + [40.32988667, -74.34678694], + [47.25996056, -95.92809778], + [47.72423333, -97.59042222], + [37.26271722, -120.9632586], + [34.97979444, -97.38586167], + [35.16755222, -99.65787361], + [34.37258444, -98.40588583], + [36.89334528, -121.4102706], + [36.5775775, -94.86190028], + [28.36455528, -97.79208194], + [28.973255, -95.86345528], + [30.16173611, -92.48396111], + [31.54489667, -93.48645306], + [30.24269333, -92.67344778], + [42.10372417, -123.6822911], + [42.51011722, -123.3879894], + [45.24651889, -120.1664233], + [43.43341028, -83.86245833], + [38.84866139, -90.50011833], + [45.042185, -92.0293475], + [29.90930556, -96.9505], + [41.83590806, -86.22517611], + [46.15313278, -112.86784], + [47.48133194, -112.8697678], + [48.16247972, -110.1132631], + [40.33423194, -103.8039508], + [44.78777778, -88.56152444], + [42.98508917, -91.79060417], + [41.36276778, -94.02106194], + [59.23495111, -135.4407181], + [30.06927778, -83.58058333], + [39.97897222, -75.86547222], + [40.98607, -109.6784811], + [39.32912833, -111.6146397], + [36.07079222, -91.82914667], + [43.55974139, -85.77421944], + [29.84475, -82.04752778], + [48.11595861, -105.1821928], + [35.38819528, -79.79281667], + [45.18338806, -69.2328225], + [41.70742861, -73.73802889], + [34.89107083, -79.75905806], + [41.71932528, -82.82196917], + [30.33633806, -94.25754361], + [34.85508722, -83.996855], + [47.45111111, -99.15111111], + [41.98458333, -73.83596556], + [34.31058333, -84.42391667], + [34.71258333, -79.95794444], + [40.52438417, -74.59839194], + [40.63750778, -100.4712539], + [32.39936111, -83.27591667], + [43.83111111, -84.74133333], + [38.68704444, -80.65176083], + [38.47110278, -99.90806667], + [48.56666472, -108.7729339], + [40.010225, -105.047975], + [34.62786417, -84.52492889], + [32.77333333, -96.80027778], + [34.52751083, -114.4310697], + [43.67676, -92.17973444], + [60.86674556, -162.2731389], + [34.01869444, -85.14647222], + [35.89893667, -92.65588611], + [34.68897278, -86.0058125], + [33.38911111, -84.33236111], + [34.4728925, -85.72221722], + [42.56072611, -73.83395639], + [42.75840889, -74.13290472], + [43.87700278, -73.41317639], + [43.86256083, -73.74262972], + [41.69037667, -72.8648225], + [41.91676389, -72.77731778], + [40.99445361, -92.76297194], + [42.77420167, -84.73309806], + [40.11389972, -99.34565306], + [32.17608333, -94.29880556], + [32.699, -94.94886111], + [41.44683167, -80.39126167], + [42.7008925, -78.91475694], + [39.77904472, -81.10277222], + [42.38214444, -77.6821125], + [39.44816667, -80.16702778], + [37.68760139, -82.26097306], + [40.32872222, -82.52377778], + [39.63359556, -86.8138325], + [40.52452778, -82.85005556], + [31.21272417, -81.90539083], + [31.21255556, -83.22627778], + [30.80575139, -83.58654889], + [30.75468028, -81.55731917], + [59.78960972, -154.1238331], + [57.92287611, -152.5005111], + [40.73210556, -92.42826889], + [60.57559667, -165.2731272], + [36.38340333, -93.61685667], + [34.80823, -91.71205083], + [35.59785528, -92.45182472], + [36.79991667, -86.81016667], + [34.64870694, -91.39457111], + [36.40423139, -90.64792639], + [41.12854806, -74.34584611], + [36.74511583, -97.34959972], + [33.909325, -94.85835278], + [36.78336306, -98.35035083], + [35.79167222, -110.4234653], + [31.01546028, -89.48256556], + [31.47210861, -87.89472083], + [30.4621125, -87.87801972], + [46.78865556, -90.75866944], + [30.46628389, -92.42379917], + [30.26048083, -88.12749972], + [42.41344444, -124.4242742], + [45.67261833, -121.5364625], + [45.35709583, -117.2532244], + [45.21632417, -122.5900839], + [39.66738111, -119.8754169], + [32.45609722, -96.91240972], + [48.51072222, -110.9908639], + [47.41861972, -105.5619431], + [40.09469917, -108.7612172], + [37.69640056, -104.7838747], + [42.11222889, -98.0386775], + [34.60183722, -78.57973306], + [62.18829583, -159.7749503], + [55.90331972, -130.0067031], + [40.75873222, -87.42821917], + [33.18605556, -80.03563889], + [40.11611111, -96.19445278], + [29.85033333, -97.67241667], + [46.34858333, -98.73555556], + [65.14370889, -149.3699647], + [33.61212528, -83.46044333], + [32.63388889, -105.6863889], + [34.24459889, -80.23729333], + [38.63334222, -95.80859806], + [30.7313, -86.15160833], + [44.68032028, -84.72886278], + [30.61170083, -81.462345], + [46.60400083, -121.6778664], + [40.88336139, -83.3145325], + [38.34688889, -93.345425], + [46.01649694, -123.9054167], + [44.30285556, -68.91058722], + [42.79711111, -88.3725], + [45.63199111, -70.24728944], + [34.01580528, -88.72618944], + [33.46540139, -89.72924806], + [59.28256167, -158.6176725], + [32.93346222, -84.68881639], + [43.05126111, -73.86119444], + [41.81974056, -71.90096306], + [42.69091194, -73.57956], + [68.06543944, -149.5797392], + [42.99297222, -84.1389125], + [33.20370556, -101.340415], + [32.78850806, -93.00366083], + [42.98136667, -77.93751389], + [40.88544444, -83.86863889], + [40.37645722, -79.60837583], + [41.7358775, -83.65541056], + [60.90415028, -149.6238389], + [40.17792583, -86.21729889], + [44.40416667, -118.9625], + [34.08848361, -78.86462028], + [38.45418222, -101.7462828], + [34.40823444, -86.93295056], + [34.2626, -91.30984194], + [33.84593722, -92.36542861], + [37.33616222, -88.11113611], + [46.85469528, -97.20870028], + [47.35940778, -97.06041639], + [63.0174475, -154.3639608], + [58.73288056, -157.0199197], + [59.97904306, -154.8396944], + [30.498585, -97.96947222], + [30.42769722, -87.70082], + [29.25427778, -96.15438889], + [30.44117222, -93.47349722], + [63.49005056, -162.1103692], + [32.08348611, -97.09722722], + [31.88098556, -106.7048131], + [28.85719361, -100.5122997], + [63.13382361, -142.5219339], + [45.27175833, -111.6486389], + [47.59664, -110.2660367], + [36.6977775, -108.7011986], + [43.83332611, -101.4970881], + [35.7029175, -79.50529972], + [58.29888889, -134.4077778], + [63.54171472, -150.9939547], + [33.64870417, -99.26063056], + [33.90850556, -78.43667222], + [31.97987056, -87.33888056], + [35.94748028, -114.8610967], + [42.96320278, -88.81762806], + [45.52527778, -122.6709289], + [43.79984528, -123.0289678], + [41.26672278, -80.92897778], + [30.16927167, -96.98001083], + [43.23653139, -120.6660967], + [56.81131972, -132.9600567], + [43.96117222, -89.78804889], + [48.54156944, -117.8844247], + [33.222645, -82.38373611], + [48.72632639, -116.2954761], + [44.41761111, -103.3747778], + [36.83497556, -114.0552453], + [56.466325, -132.3800181], + [47.65404528, -118.1677519], + [32.56736694, -84.25074833], + [33.22697222, -84.27494444], + [35.19453167, -83.86490194], + [36.41789833, -81.82511528], + [66.55194444, -152.6222222], + [43.98478278, -73.09594889], + [43.02090306, -75.17043861], + [42.46045361, -71.51791444], + [44.56911417, -72.01797889], + [42.91395583, -76.44076889], + [43.14228139, -85.25380722], + [46.94100778, -98.01762611], + [34.70777139, -95.07378583], + [41.60880861, -79.74133111], + [40.00243139, -81.19183], + [37.63355556, -85.24216667], + [33.79463889, -81.24586111], + [33.1955, -80.50847222], + [33.92680111, -81.79455306], + [42.47083694, -97.88367778], + [36.29014667, -98.47582833], + [63.32881806, -142.9536194], + [37.85567778, -81.91589722], + [36.21673389, -91.75014556], + [40.12916667, -91.67833333], + [34.78027778, -90.81055556], + [35.53341472, -90.40149028], + [40.74260167, -73.97208306], + [40.73399083, -73.97291639], + [41.96217028, -100.5690139], + [30.35643, -95.00801472], + [57.21810306, -153.2697494], + [30.78450278, -98.66025083], + [45.80638889, -109.9811111], + [43.97901, -124.1095631], + [45.6291075, -109.2507167], + [46.25149444, -114.1255403], + [45.70308833, -108.7610886], + [43.29525056, -103.8435325], + [37.06374667, -81.79826944], + [43.99498861, -102.2504367], + [38.23879833, -108.5632597], + [30.88797667, -84.15473528], + [31.43113889, -85.61922222], + [47.23683778, -117.4210244], + [42.78054722, -90.68096028], + [32.4121375, -80.63455083], + [39.88083333, -80.73577778], + [48.4989925, -122.6623956], + [40.27829167, -110.0512619], + [31.68545833, -83.63211194], + [42.72086583, -82.59574694], + [43.31183, -83.09091444], + [43.93206889, -123.0067483], + [43.45908333, -83.44522222], + [39.16620778, -80.06258056], + [31.30875278, -86.39376083], + [47.84583333, -110.6336111], + [32.68147222, -87.66208333], + [32.46381944, -87.95406389], + [32.81204611, -85.22958111], + [33.12928722, -85.366615], + [35.94457028, -81.99566944], + [42.32816806, -72.61151667], + [42.54294389, -83.17790861], + [33.03622222, -96.24313889], + [33.59316472, -95.06355528], + [31.81682333, -97.56696361], + [31.91681306, -98.600325], + [43.18118194, -77.91362333], + [41.44960972, -81.06292972], + [40.41208333, -83.73686111], + [37.56173889, -82.56660694], + [59.44689528, -135.3226633], + [37.45832417, -86.84995194], + [42.45416111, -96.47253111], + [60.86890528, -146.6864653], + [33.62022111, -91.36484056], + [34.52926056, -93.52713472], + [35.69114639, -90.01012028], + [35.51069583, -93.8393075], + [36.37820556, -90.16624167], + [29.95194444, -90.08166667], + [42.17590722, -77.11219278], + [39.73556333, -75.39772111], + [47.57076861, -114.0967783], + [45.53325917, -112.3091656], + [44.86676444, -123.1982475], + [46.50410722, -110.9132667], + [48.29997583, -112.2508711], + [38.81416194, -106.1206939], + [40.08473556, -98.54061694], + [35.5623925, -75.95518417], + [34.19260083, -95.64985889], + [44.15742611, -70.48129583], + [43.83872167, -90.13768389], + [41.15331528, -104.1302292], + [45.89029056, -84.73755083], + [44.984375, -101.2510417], + [55.73963611, -132.2550183], + [30.03048028, -97.16687194], + [35.70140278, -109.5103814], + [35.12061417, -98.5806175], + [32.883215, -90.4636475], + [43.10491444, -89.18553833], + [42.88355556, -88.59743056], + [32.99512944, -81.27024583], + [48.96885444, -115.0704464], + [41.60282583, -82.684625], + [34.22910972, -86.25575806], + [34.39944167, -86.27016111], + [36.41217389, -85.31154861], + [44.991895, -70.66462472], + [43.94424111, -88.1134775], + [45.67079278, -96.99619167], + [43.12860833, -85.67689778], + [44.89570278, -97.71191361], + [44.02914056, -97.53784778], + [33.25463889, -97.58055556], + [41.90755611, -79.64105083], + [40.23820667, -81.01256917], + [40.80161944, -80.16072889], + [37.83057667, -100.3504222], + [55.38965028, -131.7380742], + [34.58981806, -88.64699861], + [47.69543861, -114.1851178], + [47.51484611, -120.4848025], + [32.89783333, -79.78286111], + [46.77917333, -105.3047083], + [46.33111111, -111.4813889], + [42.56250167, -99.03787611], + [45.15904694, -93.84330361], + [43.2969325, -89.75595639], + [35.15426444, -95.62026389], + [44.17508056, -68.67863722], + [43.28333333, -90.29827778], + [35.60393694, -99.70343889], + [41.23334583, -97.11698111], + [36.69741667, -93.90052778], + [36.28340306, -96.46418833], + [48.94057222, -97.902775], + [56.11631056, -133.1217153], + [45.87791444, -104.5375072], + [44.70414917, -100.1087353], + [33.30515528, -81.10898917], + [41.55834528, -98.54618528], + [33.6324825, -83.84955806], + [61.58317306, -159.2359667], + [34.65938889, -87.34883333], + [34.68896917, -85.29023333], + [34.78933333, -81.19577778], + [57.5278675, -157.3993056], + [43.8958525, -85.27920861], + [44.54165056, -99.44622306], + [43.22174722, -99.4033], + [45.58055222, -103.5296356], + [48.4841675, -99.23680389], + [42.66361778, -85.34625944], + [42.86200306, -78.71658528], + [40.60423333, -79.82060611], + [43.02108667, -78.48296778], + [43.18200222, -78.55780528], + [40.46121083, -78.77524389], + [40.221155, -90.02289361], + [37.91453139, -83.25212111], + [59.43264556, -154.8027058], + [38.7842425, -93.80285417], + [38.74750889, -98.23061222], + [37.66660278, -98.12264722], + [33.3034575, -89.22840028], + [32.84921361, -91.40390611], + [34.32842917, -92.35098583], + [48.80772722, -105.43947], + [47.16825944, -114.8537411], + [45.87852778, -111.5691389], + [47.55164778, -109.3776792], + [45.45263139, -119.6886361], + [48.85417361, -108.4090214], + [39.46798056, -117.1953703], + [41.03829806, -107.4972869], + [42.73748639, -102.4448947], + [43.16564083, -101.7126953], + [43.76612222, -99.32134], + [36.39893194, -76.01631111], + [34.15987361, -85.63512944], + [58.906485, -157.7141078], + [57.05213778, -135.3462086], + [41.55819444, -122.8553103], + [41.88709222, -121.9755614], + [60.33534556, -162.6670094], + [59.07562167, -160.2730436], + [56.25504722, -158.7753614], + [59.87644778, -163.1675583], + [29.72754583, -85.02744778], + [37.74755556, -97.22113889], + [37.35827778, -85.30941667], + [41.483, -120.5653611], + [40.65236278, -75.44040167], + [32.41132, -99.68189722], + [18.45111111, -66.67555556], + [35.04022222, -106.6091944], + [45.44905556, -98.42183333], + [31.535515, -84.19447333], + [44.98857611, -85.198355], + [32.11079917, -84.18884806], + [41.25305194, -70.06018139], + [44.07346389, -93.55294361], + [31.61128833, -97.23051917], + [40.97811528, -124.1086189], + [39.45758333, -74.57716667], + [34.71789028, -78.00362444], + [46.45026972, -95.21095472], + [41.86943667, -84.07480528], + [34.80434056, -96.6712775], + [51.87796389, -176.6460306], + [34.30320667, -97.01952167], + [57.74996778, -152.4938553], + [32.96855944, -96.83644778], + [39.84013889, -101.0420278], + [41.70137556, -94.92054167], + [35.14515278, -106.7951617], + [43.68151278, -93.36723778], + [31.32737167, -92.54855611], + [56.96048139, -133.9082694], + [40.13648833, -80.29020083], + [40.60688889, -95.86569444], + [67.10610472, -157.8536203], + [42.80513417, -72.00302194], + [42.71124583, -110.9421639], + [32.98763889, -97.31880556], + [40.35440139, -79.93016889], + [57.50355528, -134.5850939], + [33.22802111, -93.21696861], + [33.369955, -81.96449611], + [43.06332694, -98.29618972], + [45.28114833, -92.37539222], + [33.94859528, -83.32634694], + [56.24684222, -134.6481539], + [41.24133333, -96.59402778], + [42.05325, -102.8037222], + [40.10862139, -85.61299472], + [45.15419444, -89.11072222], + [33.64955556, -81.68447222], + [41.40726722, -95.04690639], + [46.5484225, -93.6768], + [33.10706889, -88.19725167], + [39.36002778, -74.45608333], + [38.096035, -92.5494875], + [56.3114625, -158.3732369], + [38.60654722, -87.72669417], + [33.89765389, -117.60244], + [34.50081944, -83.55487], + [55.90806056, -159.1585781], + [52.22034833, -174.2063503], + [35.20265944, -81.1498675], + [60.90481194, -161.2270189], + [56.93869083, -154.1825556], + [58.67680167, -156.6492175], + [40.17563333, -103.2220278], + [68.1343225, -151.74168], + [41.0375, -81.46693944], + [55.57923333, -133.0759972], + [32.51235611, -87.38555472], + [42.74811944, -73.80297861], + [27.74088889, -98.02694444], + [32.83994444, -105.9905833], + [38.89029083, -90.04604306], + [42.55708139, -92.40034361], + [37.43491667, -105.8665556], + [46.09456167, -118.2880367], + [32.91475167, -85.96295611], + [35.2193725, -101.7059272], + [31.53605556, -82.50655556], + [43.3221425, -84.68794917], + [38.85148778, -83.56627778], + [41.99206972, -93.62180139], + [33.58816667, -85.85811111], + [61.17432028, -149.9961856], + [34.49494444, -82.70902778], + [45.145, -93.21138889], + [61.58159694, -159.5430428], + [41.63969833, -85.08349333], + [62.64858333, -160.1898889], + [42.57922222, -99.99297222], + [37.15852194, -98.07964667], + [43.60343056, -113.3340972], + [40.70694444, -84.02666667], + [40.29637222, -78.32002306], + [39.57012833, -104.8492942], + [38.21319444, -122.2806944], + [26.15247222, -81.77544444], + [45.0780675, -83.56028583], + [35.06067778, -85.58531667], + [34.57528944, -117.1861792], + [55.5546575, -133.1016928], + [59.75700722, -161.8794789], + [70.20995278, -151.0055611], + [42.69591417, -73.17038306], + [60.96609583, -149.1257892], + [30.03775833, -91.88389611], + [42.22298361, -83.74560722], + [68.11608083, -145.5761114], + [36.12534667, -90.92461944], + [41.77192944, -88.47565917], + [43.99192222, -76.02173861], + [45.92792556, -89.73094278], + [30.345055, -89.82078833], + [39.22316, -106.868845], + [36.17641056, -94.11925833], + [42.78176306, -71.51477944], + [36.29752583, -77.17085556], + [32.5205, -94.30777778], + [33.56991111, -86.05085833], + [46.15797222, -123.8786944], + [41.2747, -85.84005556], + [46.54852806, -90.91896639], + [33.101805, -94.19532694], + [70.46727611, -157.4357361], + [33.64044444, -84.42694444], + [32.85252806, -104.4676864], + [44.25740806, -88.51947556], + [44.91398056, -97.15471944], + [44.32064972, -69.79731806], + [40.89413889, -97.99455556], + [62.68004417, -164.6599253], + [43.66499083, -92.933385], + [38.95476944, -121.0820806], + [32.61635417, -85.43355944], + [30.19453278, -97.66987194], + [44.92847222, -89.62661111], + [36.68827778, -78.05447222], + [36.77317, -98.66994611], + [35.43619444, -82.54180556], + [27.591145, -81.52785333], + [41.33814944, -75.7242675], + [32.40939028, -111.2185086], + [33.40494444, -118.4158611], + [41.27610083, -91.67344389], + [70.638, -159.99475], + [35.13505861, -90.23444639], + [48.16074833, -122.1590208], + [43.07791056, -94.27199278], + [45.86629833, -95.39466806], + [34.69878194, -99.3381], + [40.49338889, -84.29894444], + [36.42240972, -105.2892967], + [31.24905556, -82.39530556], + [36.95994444, -113.0138889], + [31.88465639, -82.64738778], + [42.234875, -85.5520575], + [43.42507111, -73.26205306], + [39.40324917, -119.2518292], + [43.08027611, -76.53837556], + [43.46411111, -70.47238889], + [45.08616639, -70.21617778], + [42.15773111, -72.71562028], + [39.26191861, -85.89634556], + [40.59904583, -116.8743358], + [43.78091667, -82.98566667], + [29.7045, -98.04222222], + [45.3319325, -95.650565], + [31.17816667, -99.32463889], + [34.62170861, -79.73435944], + [41.43645056, -99.64216861], + [37.20782361, -80.40832778], + [37.70637111, -112.1454725], + [44.25073861, -90.85528028], + [26.37848667, -80.10769667], + [61.41612444, -149.50888], + [48.72741667, -94.61030556], + [37.58303472, -109.4832889], + [41.93887417, -72.68322833], + [35.13619528, -92.71349722], + [41.16348417, -73.12617861], + [45.433325, -105.4172133], + [42.46995306, -71.28903], + [42.12858333, -86.4285], + [60.77977639, -161.8379975], + [41.80306778, -78.64012083], + [41.87402778, -103.5956389], + [47.52998917, -122.3019561], + [36.86330139, -99.61873056], + [35.43359806, -119.0567681], + [30.62646944, -88.06799861], + [38.84003306, -86.44536361], + [47.24902778, -91.41558333], + [35.70004194, -101.3940536], + [30.97152778, -84.63744444], + [35.17753417, -86.06616722], + [42.20848278, -75.97961361], + [61.53556806, -149.8138975], + [44.80744444, -68.82813889], + [44.44969444, -68.3615], + [31.71383333, -82.39377778], + [46.34763639, -104.2594475], + [33.56294306, -86.75354972], + [41.16811889, -71.57784167], + [40.30127778, -96.75411111], + [63.99454722, -145.7216417], + [37.37309556, -118.3636089], + [45.8076625, -108.5428611], + [46.77411111, -100.7467222], + [42.74316667, -86.10502778], + [39.90878667, -105.1172158], + [47.50942417, -94.93372333], + [40.87480556, -81.88825], + [32.71904694, -98.89099972], + [44.83733333, -117.8090833], + [41.5175, -81.68333333], + [28.47359722, -82.45542139], + [37.78732833, -81.12416417], + [44.30483333, -96.81694444], + [37.29579944, -81.20769056], + [33.61916278, -114.7168764], + [48.79275, -122.5375278], + [40.18691806, -74.12488694], + [38.54517861, -89.83518444], + [41.55239139, -112.0622625], + [39.14602139, -86.61668278], + [40.47798556, -88.91595278], + [44.57537278, -71.17593167], + [30.73894444, -98.23858333], + [30.07044111, -94.21553806], + [36.12447667, -86.67818222], + [57.08882583, -134.8331414], + [33.92307111, -116.8505756], + [33.25777778, -81.38833333], + [43.59212778, -118.9549789], + [42.04956944, -93.84757222], + [43.56444444, -116.2227778], + [42.07455556, -124.2900939], + [42.3643475, -71.00517917], + [27.9433575, -81.78344167], + [42.58506972, -110.1111531], + [36.36894194, -92.47052806], + [29.95083333, -94.02069444], + [31.25902778, -81.46630556], + [18.49486111, -67.12944444], + [46.39785806, -94.1372275], + [40.783225, -91.12550556], + [25.90683333, -97.42586111], + [71.2854475, -156.7660019], + [37.81432167, -85.49963806], + [44.40966667, -69.01225], + [70.13390278, -143.5770444], + [42.30727806, -85.25147972], + [45.95479528, -112.49746], + [45.81522222, -97.74313889], + [40.77692611, -79.94972417], + [66.91528667, -151.5280556], + [44.47300361, -73.1503125], + [36.86105722, -116.7870036], + [41.77669444, -99.14975], + [42.94052472, -78.73216667], + [38.28977028, -94.34012694], + [34.20061917, -118.3584969], + [36.04854333, -79.47488694], + [40.77248083, -80.39142556], + [65.98228611, -161.1519778], + [41.72857778, -98.05575972], + [36.76247611, -96.01115167], + [48.47088889, -122.4208611], + [35.726105, -91.64736083], + [42.58417111, -70.91651833], + [32.9931, -115.5169325], + [31.79362222, -98.95649528], + [36.96451667, -86.41967917], + [39.17540167, -76.66819833], + [46.24640083, -96.6056825], + [30.81368639, -89.86496444], + [33.04093056, -82.00397917], + [33.42088556, -112.6863], + [64.07830278, -141.113375], + [44.38108528, -106.7217897], + [42.54260361, -113.7715442], + [45.77690139, -111.1530072], + [41.248645, -90.73708361], + [60.07730556, -147.9918889], + [41.42541667, -88.41869444], + [40.48820611, -89.67591083], + [42.03111083, -91.52934222], + [41.4775, -87.84047222], + [42.7419525, -92.50793528], + [43.11424444, -89.53073222], + [40.48578389, -88.2672725], + [43.52589944, -89.98322194], + [43.5600925, -89.48309278], + [42.69056389, -88.30464], + [41.37756167, -87.68137528], + [41.47271639, -85.26080833], + [41.36513333, -86.30050417], + [40.92970444, -90.63110722], + [31.29600472, -91.05288167], + [41.83369889, -89.44621333], + [41.01928583, -89.38642222], + [42.32268639, -88.83651833], + [36.16313889, -120.2938139], + [42.32461111, -88.07408806], + [37.8284525, -121.6258219], + [41.99293417, -86.1280125], + [44.27531333, -85.41892694], + [33.93884, -81.11953944], + [40.49522139, -107.5216467], + [40.91631194, -81.44246556], + [36.44585972, -103.1546583], + [46.8715, -68.01791667], + [42.74194389, -93.75890944], + [39.61541667, -78.76086361], + [41.25947222, -95.75997222], + [45.55854639, -93.26464361], + [39.42753083, -101.0465719], + [34.11154056, -117.6875897], + [33.31208333, -84.77027778], + [37.98965639, -122.0568972], + [43.07260861, -92.61077833], + [55.20559972, -162.7242628], + [37.70097028, -113.098575], + [33.62279917, -92.76339528], + [39.97504417, -81.57759528], + [29.137745, -83.04984361], + [34.28358333, -80.56486111], + [42.83755556, -103.0954167], + [60.49183389, -145.4776503], + [40.87522278, -74.28135667], + [41.78015722, -124.2365333], + [42.19826389, -72.53425833], + [40.61791667, -96.92488889], + [65.57380667, -144.7832908], + [34.67205556, -82.88644444], + [39.69803139, -85.13124528], + [30.77883333, -86.52211111], + [36.66458333, -88.37277722], + [37.30299778, -108.6280658], + [30.71569444, -96.33136111], + [39.97562861, -86.91986361], + [60.14922556, -164.2856325], + [32.95284306, -109.2103453], + [37.0940475, -95.57189417], + [55.47883139, -133.1478011], + [28.86727778, -82.57130556], + [38.53930556, -76.03036111], + [41.56512389, -81.48635389], + [37.22531694, -89.57075167], + [38.98058333, -76.92230556], + [41.85884389, -87.60791167], + [32.95488889, -111.7668333], + [35.03526833, -85.20378778], + [33.26908333, -111.8111389], + [35.09614694, -97.96618361], + [38.13863889, -78.45286111], + [65.48547222, -144.6107836], + [32.89864639, -80.04050583], + [39.78215278, -93.49568056], + [43.59635861, -91.50394639], + [39.79538278, -121.8584231], + [41.88458833, -91.71087222], + [47.82528056, -112.1662136], + [66.64969083, -143.7359492], + [42.04619444, -94.789], + [37.06447222, -89.21961111], + [46.25075194, -84.47238528], + [38.5267075, -77.85885528], + [61.86902194, -158.1371178], + [39.29663889, -80.22808333], + [47.83830556, -90.38313889], + [31.98883333, -83.77391667], + [33.71722222, -79.85697222], + [34.29971, -90.51231611], + [47.84169417, -96.62162028], + [42.73147222, -95.55613889], + [60.54390333, -145.7267042], + [36.62188083, -87.41495361], + [64.07133833, -141.9522792], + [33.127231, -117.278727], + [41.41089417, -81.84939667], + [44.61381306, -88.73126667], + [35.53832778, -98.932695], + [30.58858944, -96.36382417], + [48.12019444, -123.4996944], + [58.84230472, -158.5452331], + [46.67649194, -122.9792967], + [35.21401111, -80.94312583], + [27.97668639, -82.75874028], + [34.21375472, -119.0943264], + [39.99798528, -82.89188278], + [40.03925, -88.27805556], + [47.16841722, -88.48906083], + [43.95834806, -90.7378975], + [41.01962389, -93.35968028], + [43.37043194, -72.36867667], + [39.54925139, -97.65231667], + [32.33747222, -104.2632778], + [33.97469444, -117.6366111], + [41.07747222, -102.4640556], + [37.66879722, -95.48506444], + [31.63783139, -97.07413889], + [38.75495611, -109.7548439], + [44.52019417, -109.0237961], + [47.77429167, -116.8196231], + [28.34158944, -80.6854975], + [31.84113889, -99.40361111], + [43.20273278, -71.50228556], + [46.70016833, -92.50552861], + [38.80580556, -104.70025], + [28.45825583, -99.22016389], + [38.81809306, -92.21962917], + [34.27287278, -78.71499278], + [36.66561833, -76.32066389], + [33.89001611, -118.2436831], + [42.90835556, -106.4644661], + [38.57072444, -90.15622111], + [18.31328917, -65.30432444], + [40.48408333, -84.56011111], + [35.72381556, -96.82027306], + [41.68840028, -69.98952417], + [65.83049389, -144.0758128], + [33.81175, -78.72394444], + [30.33633333, -81.51444444], + [36.10245111, -119.5948469], + [27.77036083, -97.50121528], + [33.12822222, -117.2802222], + [32.02748861, -96.39803611], + [33.17833278, -91.88018806], + [38.37315083, -81.59318972], + [34.91496778, -88.60348361], + [40.30658333, -100.1620833], + [32.51633333, -84.93886111], + [35.33983917, -99.20049944], + [41.02146139, -94.36331917], + [35.95129194, -85.08497806], + [48.60835444, -112.3761464], + [33.63102778, -85.15202778], + [40.56909444, -90.07484], + [29.63552778, -83.10475], + [34.97561194, -78.36461528], + [33.97047222, -80.99525], + [35.949925, -96.77305278], + [38.08947917, -88.12306111], + [43.73331611, -103.6176947], + [39.04614278, -84.6621725], + [36.26487139, -91.56264111], + [34.42513889, -103.0792778], + [44.49719361, -123.2898297], + [45.30477778, -85.27477778], + [44.77761917, -89.66677944], + [30.21059167, -93.14318944], + [41.8311125, -90.32913056], + [32.19505556, -81.86955556], + [61.58285917, -144.4270969], + [36.78833556, -78.50155361], + [67.25163417, -150.2065672], + [32.66950333, -115.5133281], + [30.35183333, -95.4144675], + [39.19222972, -119.7343611], + [31.21291667, -84.23680556], + [40.21713889, -76.85147222], + [39.51600611, -82.98215361], + [41.1557225, -104.8118381], + [39.38713889, -97.15721417], + [40.86911111, -100.0042222], + [42.07853583, -76.09633306], + [34.45678278, -84.93949944], + [62.07118972, -142.0483742], + [28.52225111, -99.82363444], + [46.18699111, -103.4280806], + [47.65594444, -101.4372222], + [45.03609417, -102.0198803], + [48.83039167, -100.4171361], + [43.62080278, -96.21864028], + [42.66010111, -78.99115556], + [46.12197222, -89.88233333], + [42.90718611, -77.32162639], + [44.23107, -94.99893444], + [48.92851556, -103.2972514], + [48.75301778, -98.39333694], + [46.81278306, -101.8601556], + [48.3805325, -102.8979853], + [33.78149889, -83.69355389], + [42.92228111, -78.61224889], + [45.42556528, -84.91338389], + [43.06703333, -83.27244444], + [42.79699083, -82.97526583], + [29.17991667, -81.05805556], + [34.85371333, -116.7866875], + [32.84711389, -96.85177222], + [36.57286111, -79.33611111], + [43.28406194, -70.92925472], + [39.90237583, -84.219375], + [32.56445806, -82.98525556], + [42.40295944, -90.70916722], + [38.85208333, -77.03772222], + [66.94333806, -156.9046739], + [34.65264667, -86.94536778], + [38.70042333, -87.12973222], + [37.76312194, -99.96542389], + [42.8913325, -73.2464075], + [39.8345625, -88.86568917], + [29.06698056, -81.28394167], + [66.06820583, -162.7666028], + [43.27550139, -91.73937389], + [39.85840806, -104.6670019], + [34.04699556, -94.39936556], + [42.40919444, -83.00986111], + [47.96663889, -117.4266667], + [41.3375, -84.42880556], + [32.89595056, -97.0372], + [42.79725, -105.3857361], + [31.32133917, -85.44962889], + [36.022585, -102.5472775], + [46.79738889, -102.8019528], + [41.93188111, -88.70829861], + [42.49333528, -79.27204167], + [35.96383361, -83.87365389], + [59.0454125, -158.5033389], + [46.84209028, -92.19364861], + [43.52195389, -89.77090222], + [45.25536056, -112.5525067], + [35.74558056, -119.2365039], + [45.61854556, -121.1673439], + [40.27970139, -83.11480167], + [65.75861111, -168.9530556], + [32.26230917, -107.7206397], + [38.70688889, -93.17611111], + [39.60827778, -77.00766667], + [33.46663667, -82.03933917], + [34.72174833, -84.86910806], + [41.9864325, -95.38072083], + [40.19946861, -87.59553528], + [39.1301125, -75.46631028], + [41.90688333, -88.24841722], + [35.00006444, -77.981695], + [31.47780833, -82.85961556], + [30.83152778, -93.33963889], + [37.15151667, -107.7537692], + [29.37181222, -100.9232339], + [41.53493306, -93.66068222], + [42.57089972, -77.71305083], + [39.38328861, -112.5096683], + [46.82520861, -95.8856875], + [32.54021889, -93.7450225], + [33.20072167, -97.19797722], + [30.40006111, -86.47147722], + [42.21205889, -83.34883583], + [33.942265, -96.39451806], + [34.470875, -97.95986111], + [31.46902778, -109.6036667], + [41.17826611, -78.89869778], + [53.90013889, -166.5435], + [35.85792833, -102.0130978], + [59.95950583, -162.8817231], + [37.57791667, -84.76969444], + [48.11424528, -98.90877833], + [41.6102775, -90.58832528], + [38.14351944, -122.5572167], + [33.68831667, -112.0825614], + [30.06186111, -95.55277778], + [38.5545, -82.738], + [36.77747, -89.94117333], + [41.37153528, -73.48219056], + [44.98624, -96.17773611], + [33.06344444, -80.27933333], + [40.33305028, -75.12233833], + [35.99850694, -89.40608333], + [46.72186083, -92.04343889], + [31.58246583, -102.9090428], + [32.45679139, -103.2404708], + [32.66106083, -107.1979339], + [32.95394444, -103.4087778], + [33.26122278, -103.2768939], + [32.33111111, -102.5295278], + [33.11022222, -98.55527861], + [36.23372611, -101.4321894], + [33.81255056, -109.9867658], + [33.96891833, -112.7985128], + [32.13107833, -103.1548506], + [31.51567306, -106.1471978], + [30.38422222, -103.6835833], + [36.221, -101.1945], + [34.59585278, -113.170195], + [35.23199833, -102.3990931], + [32.80700583, -111.58679], + [32.95810083, -112.6782181], + [34.64519778, -106.8336958], + [35.36671583, -104.1880314], + [36.11088056, -109.5754222], + [33.35283972, -108.8672858], + [31.99972222, -110.3572222], + [64.77639306, -141.1509206], + [42.05552528, -104.9327492], + [40.72702778, -99.00677778], + [47.39886111, -120.2068333], + [44.86525722, -91.48507194], + [42.43663889, -93.86886111], + [36.26057417, -76.17459778], + [43.88545056, -104.3179178], + [36.027735, -76.56709333], + [31.29972222, -85.89986111], + [34.76619444, -114.6232931], + [60.21590417, -162.0056092], + [42.89839944, -72.27078111], + [40.04886222, -107.8859067], + [33.17781083, -86.78323722], + [44.7342075, -103.8619925], + [29.60733333, -95.15875], + [44.88879722, -72.22915833], + [42.61493972, -89.59075583], + [42.01016667, -94.34258333], + [39.64256778, -106.9176953], + [43.10202056, -94.704675], + [37.32441028, -97.38732333], + [45.93179639, -89.26906778], + [37.00188194, -101.8821258], + [35.25555556, -81.60099722], + [37.8078425, -87.68569], + [58.18837472, -157.3809872], + [36.53531083, -89.59971722], + [40.80338889, -124.1127917], + [41.71935833, -86.00168361], + [38.88944444, -79.85713889], + [40.82492611, -115.7916964], + [36.85527778, -84.85613889], + [37.68694444, -85.92377778], + [33.31288444, -86.92591889], + [29.60301389, -96.32248444], + [33.2208625, -92.81325167], + [64.61400972, -162.2700681], + [35.42941083, -99.39425917], + [42.15991361, -76.89144333], + [47.03302778, -120.5306944], + [47.82454639, -91.83073056], + [31.80666667, -106.3778056], + [58.19518417, -136.3473928], + [39.29969444, -114.8418889], + [42.10951194, -77.99194806], + [41.82494611, -110.5590586], + [38.33211111, -96.19116667], + [34.08600889, -118.0348453], + [36.68691667, -77.48280556], + [60.572, -151.2475278], + [38.51479889, -89.09217944], + [62.78518639, -164.4910461], + [64.54898167, -149.0735053], + [40.71869528, -114.03089], + [42.5957075, -87.92780333], + [40.45990778, -91.42850111], + [36.81080556, -94.39169444], + [47.30758333, -119.5158889], + [44.91011111, -67.01269444], + [37.77410833, -96.81762778], + [35.01884306, -80.62023444], + [42.08202139, -80.17621556], + [29.976735, -99.08567972], + [46.31118694, -85.45731639], + [45.72266972, -87.09373139], + [31.3949025, -92.29577194], + [38.80416667, -76.069], + [43.40744444, -94.74641667], + [43.42219444, -88.12792667], + [35.93710083, -77.54663833], + [45.78046056, -96.54353972], + [32.41349167, -98.80975667], + [31.95131917, -85.128925], + [44.12326, -123.2186856], + [43.64186111, -116.6357778], + [29.05580556, -80.94836111], + [47.42507778, -92.49846944], + [40.35260167, -94.91552722], + [38.03799139, -87.53062667], + [41.27494528, -111.0321286], + [39.52038889, -75.72044444], + [41.67614167, -70.95694167], + [38.05710528, -97.27522861], + [35.07297222, -77.04294444], + [40.69249722, -74.16866056], + [60.93865417, -164.6412147], + [58.42049861, -135.4490328], + [35.78114028, -80.30378194], + [39.83070944, -86.29438056], + [24.55611111, -81.75955556], + [41.20520361, -89.96386], + [32.21425, -83.12802778], + [39.72755972, -94.276375], + [33.61172222, -96.17938889], + [34.27708306, -99.75926861], + [34.22566806, -99.28375], + [34.84561083, -100.1959481], + [35.29593194, -95.62526417], + [35.40687972, -96.01583278], + [32.14172222, -94.85172222], + [31.83158333, -94.15641667], + [32.35376389, -97.43375], + [34.73958944, -100.5297008], + [36.38559583, -97.27721083], + [32.64601, -93.29808556], + [35.47163639, -98.00599444], + [35.4880825, -97.82354556], + [34.52453278, -96.98973944], + [33.99287639, -96.64249722], + [34.24925806, -97.47391306], + [35.30421917, -98.96702167], + [27.51364889, -81.88063917], + [33.71411111, -96.67366667], + [32.32969444, -96.66388889], + [32.16384778, -95.82835306], + [26.84537306, -80.22148111], + [32.93059444, -96.43548556], + [33.48481, -101.6607158], + [32.93884556, -95.27886083], + [33.21530583, -95.2374925], + [32.44441583, -97.8169475], + [32.91019472, -99.73422972], + [33.57605556, -117.1279722], + [34.39833889, -96.14805972], + [35.42925306, -96.28778361], + [35.28910556, -95.09389722], + [33.72926389, -102.7338183], + [32.72495583, -92.33716583], + [32.20199028, -92.73293028], + [32.15431917, -91.70012472], + [35.54482944, -98.66849028], + [35.085875, -96.41666667], + [64.8136775, -147.8596694], + [37.76107917, -90.42859722], + [14.21577583, -169.4239058], + [46.91934889, -96.81498889], + [36.77619444, -119.7181389], + [34.99147222, -78.88], + [44.32468556, -93.31082889], + [41.39193583, -110.4067961], + [40.18297222, -97.16927778], + [48.31140472, -114.2550694], + [36.732365, -119.8198961], + [37.4065375, -77.52498667], + [44.82724111, -93.45714639], + [34.94199806, -90.77496611], + [39.41758333, -77.37430556], + [34.35219472, -98.98460222], + [34.31547222, -81.10880556], + [41.01352778, -83.66869444], + [42.24626722, -89.58223944], + [41.44913889, -96.52019444], + [36.01822278, -75.67128694], + [33.35725, -84.57183333], + [41.05332417, -91.97892333], + [46.28439389, -96.15668556], + [38.18248861, -84.90470083], + [33.46083333, -111.7283333], + [38.54180556, -83.74338889], + [48.52197222, -123.0243611], + [31.58847222, -110.3443889], + [41.04861306, -78.41310306], + [42.55412194, -71.75895639], + [41.37787361, -79.86036167], + [36.69817806, -76.90312694], + [40.27343083, -86.56217028], + [43.77117417, -88.48842917], + [35.13845472, -111.6712183], + [26.07258333, -80.15275], + [34.18536111, -79.72388889], + [36.29087528, -92.59023417], + [62.45264889, -157.98907], + [39.499545, -118.7490197], + [39.08538667, -76.75941444], + [36.74125, -108.2299444], + [26.58661111, -81.86325], + [40.58569444, -97.57305556], + [40.07878611, -95.59199167], + [40.45182722, -105.0113356], + [58.25438583, -134.8979067], + [42.96550333, -83.74345639], + [38.66494528, -88.45299556], + [42.55145611, -94.19255111], + [38.95095194, -95.66361444], + [40.84365472, -72.63178917], + [40.55393583, -124.1326589], + [27.49505556, -80.36827778], + [35.42822222, -81.93507778], + [40.72878111, -73.41340722], + [38.50622139, -86.63693528], + [43.64394111, -94.41561556], + [38.9175325, -78.25351472], + [43.58135111, -96.74170028], + [47.59282028, -95.77349889], + [37.79843056, -94.76938111], + [35.33659028, -94.36744111], + [44.94028083, -73.09746], + [30.91566667, -102.9161389], + [34.48339944, -104.2171967], + [40.6592625, -91.3268175], + [39.78525, -104.5431389], + [38.83987472, -92.00421056], + [32.81977778, -97.36244444], + [33.77913889, -84.52136111], + [33.87201417, -117.9797842], + [47.28550417, -68.31275], + [37.35752861, -78.43779806], + [40.97846583, -85.19514639], + [38.37863306, -88.41265222], + [41.20020667, -74.62305056], + [32.56522778, -97.30807778], + [26.19728, -80.17070833], + [43.23473417, -93.6241025], + [35.20592, -89.39441667], + [35.05836278, -86.56441139], + [66.57149028, -145.2504169], + [36.00509472, -94.17005694], + [31.68368667, -83.27046056], + [41.19083111, -83.39453639], + [43.35077528, -76.38805361], + [38.92409111, -117.9590072], + [33.97262528, -86.08900139], + [48.40469444, -97.37094444], + [36.29553889, -99.77642361], + [39.16833611, -77.166], + [64.73617806, -156.9374164], + [63.76676556, -171.7328236], + [38.83410833, -82.16342306], + [38.34441861, -98.85917028], + [40.93800194, -90.43112556], + [68.47906306, -149.4900214], + [42.18421417, -73.40324056], + [44.34889806, -105.5393614], + [37.92751556, -100.7244147], + [36.29441667, -95.47966667], + [35.95235389, -112.1469647], + [41.68776417, -94.43524611], + [36.19299083, -82.81507028], + [42.54986639, -72.01602194], + [47.13871861, -104.8071994], + [43.97063278, -84.47503861], + [37.23240111, -82.12499083], + [38.68919444, -75.35888889], + [47.61985556, -117.5338425], + [38.88195778, -83.88273278], + [33.52726278, -112.2951564], + [44.51644444, -108.0831944], + [39.58316583, -85.80481], + [47.949255, -97.17611111], + [43.34121, -73.6103075], + [41.32702778, -94.44572222], + [33.31169444, -79.31958333], + [40.86952778, -101.7328611], + [32.38486111, -94.71171], + [41.70916083, -92.73491278], + [40.71126139, -86.37449917], + [48.21246417, -106.6148231], + [35.83742722, -87.445375], + [45.64389167, -95.32043056], + [28.06291667, -81.75330556], + [39.1224125, -108.5267347], + [41.62652667, -80.2147275], + [62.15488889, -145.4566389], + [35.85775889, -83.52870472], + [32.66241528, -97.09391139], + [39.37062194, -101.6989919], + [33.65136111, -97.19702778], + [33.48288111, -90.98561389], + [45.01354806, -84.70318944], + [29.26532333, -94.86040667], + [37.03205556, -85.95261111], + [38.35657306, -93.68417694], + [36.60527056, -94.73856667], + [34.84794444, -82.35], + [40.08970806, -105.9172367], + [33.83253, -89.79822806], + [42.91716639, -114.7651575], + [35.16531472, -107.9006142], + [59.11727556, -161.5813967], + [29.69005556, -82.27177778], + [35.84980556, -97.41560833], + [41.33005778, -72.04513556], + [39.33046528, -94.30997361], + [32.69858333, -97.04652778], + [30.40728028, -89.07009278], + [47.21110333, -93.50984472], + [40.75338889, -82.72380556], + [44.48507333, -88.12959], + [34.24872222, -82.15908333], + [38.83615778, -89.37841111], + [40.96747222, -98.30861111], + [31.06489778, -97.82779778], + [42.80597222, -102.17525], + [14.1743075, -145.2425353], + [42.88081972, -85.52276778], + [41.52716028, -85.79210278], + [15.11900139, -145.7293561], + [36.09774694, -79.9372975], + [34.89566722, -82.21885833], + [58.42438139, -135.7073814], + [47.48200194, -111.3706853], + [33.45033444, -88.59136861], + [30.67880889, -97.67938389], + [38.53396333, -106.9331817], + [13.48345, -144.7959825], + [35.51105833, -108.7893094], + [36.68507194, -101.5077817], + [34.27290389, -83.82681333], + [43.03172639, -78.16759972], + [33.06783889, -96.0653325], + [33.49432667, -90.084705], + [46.21872222, -97.64325], + [35.46055444, -77.96493306], + [40.43561833, -104.6321156], + [34.75831917, -82.376415], + [33.42281972, -112.3759919], + [41.61627306, -87.41278806], + [31.41580111, -87.04404333], + [35.15371972, -87.05681444], + [36.63301806, -95.15136111], + [34.91954278, -95.39469722], + [39.36993361, -91.21925556], + [37.97468528, -92.69161528], + [42.84381889, -75.56140194], + [35.47069417, -93.427155], + [39.15751389, -91.81826667], + [35.27467806, -96.67516194], + [36.72092222, -95.62525583], + [36.22539389, -95.33006333], + [38.36062611, -92.57157139], + [37.605825, -90.28731389], + [36.43340222, -96.38362861], + [38.00675111, -88.93441528], + [36.38338556, -96.8103125], + [34.11757222, -87.99819583], + [39.72448944, -91.44367944], + [37.51382944, -122.5010892], + [41.95975, -85.59338889], + [39.36448861, -84.52457722], + [65.20098944, -161.1567792], + [48.76838333, -101.5369953], + [31.26506556, -89.2530325], + [34.9913075, -99.0513525], + [27.34955556, -98.73697222], + [35.51169389, -92.01300944], + [44.85890667, -94.38178917], + [48.75273139, -96.94300306], + [30.52096889, -90.41762056], + [40.45269444, -99.33733333], + [21.57947361, -158.1972814], + [35.22007306, -84.83244333], + [40.48118028, -107.2176597], + [29.35952778, -99.17666667], + [34.57648972, -90.67588639], + [38.72141667, -77.51544444], + [46.01494444, -102.6559722], + [40.56943056, -102.2726875], + [31.61366111, -91.29733639], + [41.73626861, -72.65021389], + [39.62841667, -86.08788889], + [39.70794444, -77.7295], + [35.89530778, -100.4036397], + [40.85299, -85.45941917], + [32.224384, -80.697629], + [33.92283972, -118.3351872], + [34.03482556, -95.54190611], + [22.20919, -159.4455339], + [47.38659917, -92.83899333], + [44.36761639, -71.54447111], + [39.07334639, -93.67716083], + [34.56816056, -114.3561783], + [45.54039389, -122.9498258], + [40.15225, -97.58697222], + [36.31852194, -119.6288675], + [35.94040667, -89.83080583], + [32.3347725, -90.22253167], + [35.74114639, -81.38954889], + [39.37883611, -99.83149444], + [40.175, -80.64627778], + [46.60681806, -111.9827503], + [36.76611472, -80.82356556], + [33.73398167, -117.0225258], + [40.08536861, -78.51221778], + [38.24902583, -86.95371833], + [58.09609139, -135.4096975], + [21.31869111, -157.9224072], + [20.79563722, -156.0144378], + [41.58438889, -95.33963889], + [59.24522806, -135.5221086], + [36.36156111, -78.52916639], + [32.68752778, -103.2170278], + [39.18875944, -83.53880694], + [31.05591667, -82.77413889], + [59.64555556, -151.4765833], + [44.38520056, -98.2285425], + [34.47803389, -93.09620833], + [29.64541861, -95.27888889], + [61.52418306, -166.1467797], + [41.06695778, -73.70757444], + [42.72372361, -93.22634056], + [37.16308056, -101.3705267], + [46.97120167, -123.9365581], + [33.52972639, -82.51678556], + [32.74696278, -96.53041722], + [45.82822222, -119.2591667], + [26.22850611, -97.65439389], + [36.26152056, -93.15472889], + [63.86620806, -148.9689842], + [38.68322389, -96.80800639], + [34.85761639, -102.3272017], + [30.36780778, -89.45461083], + [37.8115, -88.54913889], + [35.2327875, -75.617795], + [40.60525, -98.42788889], + [65.70055556, -156.3875], + [37.95144444, -79.83389444], + [43.36824528, -103.3881378], + [34.6404475, -86.77310944], + [38.54436583, -118.6343003], + [44.35980556, -84.67111111], + [40.95957778, -72.25185056], + [38.36666667, -82.55802778], + [39.45146361, -87.30756111], + [46.12308333, -67.79205556], + [29.5665, -90.66041667], + [66.04112167, -154.2631903], + [38.06548306, -97.86063361], + [36.85658333, -87.45725], + [38.41803722, -110.7040378], + [41.26389889, -72.8871], + [48.542985, -109.7623419], + [34.40308333, -80.11922222], + [37.65926528, -122.1224083], + [58.12744139, -134.7559531], + [26.00142417, -80.24052056], + [46.4541225, -109.8549061], + [40.81676528, -72.86204722], + [32.22436111, -80.69747222], + [43.34927806, -88.39112528], + [41.66933639, -70.28035583], + [55.20631611, -132.8283131], + [29.89361111, -97.86469444], + [55.48158833, -132.6460942], + [46.02585722, -91.44424278], + [38.84494167, -99.27403361], + [33.8285, -79.12216667], + [36.08930722, -88.46329778], + [47.28986111, -101.5809444], + [40.98677778, -75.99488889], + [30.71832333, -91.47866972], + [41.77797528, -80.69551333], + [37.54083333, -87.95183333], + [40.24127944, -84.15101167], + [37.60044444, -81.55927778], + [38.92977778, -81.81947222], + [39.69172639, -83.99023806], + [40.16885083, -84.92585333], + [39.57040167, -83.42052444], + [37.41678056, -81.52899417], + [38.13341472, -83.53796528], + [39.32691111, -85.52252694], + [36.85981028, -83.36101639], + [37.63152778, -84.33244444], + [40.30918056, -81.85338194], + [38.58338806, -86.46248778], + [38.98135194, -82.57785667], + [37.85008167, -83.84575194], + [39.16693333, -82.928175], + [39.9875, -90.80416667], + [39.50286111, -83.86305556], + [39.25894444, -84.77430556], + [39.46217306, -84.25184722], + [39.07839722, -84.21020722], + [40.12928306, -83.7548775], + [41.05221889, -93.68966222], + [40.78631889, -86.14638306], + [40.22469444, -83.35161111], + [38.60200167, -86.13997889], + [39.69159667, -82.19778583], + [40.92372222, -88.6255], + [37.78505944, -86.44192194], + [40.61072, -83.64359694], + [38.94453194, -77.45580972], + [43.10725861, -78.94538139], + [29.98047222, -95.33972222], + [66.97937611, -160.4358597], + [41.18805556, -103.6773889], + [40.72178361, -95.02642667], + [37.64995889, -97.43304583], + [43.51455556, -112.0701667], + [40.63222222, -79.10552778], + [33.48574611, -90.67887611], + [37.15837222, -95.77838333], + [60.7772125, -148.7215775], + [43.02257694, -102.5110728], + [31.73572, -93.09913639], + [42.47078639, -93.26995361], + [35.15738889, -114.5595278], + [59.32373528, -155.9032733], + [35.25947222, -113.9380556], + [41.53988889, -87.53216667], + [60.47032722, -164.6856414], + [42.45359833, -91.94761833], + [59.93295111, -164.0305131], + [33.77987528, -82.81661639], + [41.74404028, -72.18023583], + [39.77429694, -90.23856583], + [41.07140417, -87.84626861], + [41.69128556, -93.56630333], + [31.08583333, -97.6865], + [39.67872222, -75.60652778], + [59.75380028, -154.9109597], + [34.27061111, -77.90255556], + [40.50930556, -101.6205278], + [26.43316667, -81.40102778], + [38.75888889, -85.46552778], + [45.81835417, -88.1145425], + [39.76587639, -86.148875], + [39.71732917, -86.29438417], + [31.77962833, -103.2013619], + [48.56618722, -93.40306667], + [36.13372222, -80.222], + [35.02191667, -110.7225278], + [38.05813889, -83.97958333], + [41.63924389, -91.54650333], + [35.48332889, -81.16125833], + [32.83422028, -115.5787456], + [41.24183583, -76.92109556], + [40.09364444, -92.54496917], + [41.8128725, -85.43906111], + [28.28980556, -81.43708333], + [48.17793861, -103.6423467], + [35.32807944, -77.61552611], + [40.7952425, -73.10021194], + [45.97464056, -86.17183056], + [44.36033833, -89.83897056], + [39.24669444, -84.38897222], + [42.49102778, -76.45844444], + [19.72026306, -155.0484703], + [39.2425, -102.2853889], + [33.30783333, -111.6554722], + [46.52747472, -90.13139667], + [40.76195972, -85.79873417], + [43.96141667, -69.71255556], + [65.62394028, -168.0991719], + [29.81819444, -95.67261111], + [38.83090472, -94.89030333], + [35.65884306, -117.8295122], + [61.57196083, -149.5405556], + [34.60682028, -120.0755617], + [43.99114472, -70.94787444], + [43.60732417, -110.7377389], + [32.31116667, -90.07588889], + [30.89058333, -94.03483333], + [36.33457556, -84.16234472], + [30.49405556, -81.68786111], + [35.83186111, -90.64616667], + [30.51126, -99.76345528], + [47.33333417, -106.9339564], + [38.59117917, -92.15614389], + [42.72663639, -114.4571506], + [31.55408333, -81.88344444], + [40.63975111, -73.77892556], + [33.90199528, -87.31416639], + [20.96293639, -156.6730317], + [42.15336861, -79.258035], + [30.28951667, -87.67371472], + [46.83919194, -96.66313028], + [37.59386111, -83.31725], + [37.15181361, -94.49826833], + [45.88609722, -93.27177833], + [46.92971944, -98.67819528], + [58.35496194, -134.5762764], + [35.54094139, -78.39032944], + [41.51805833, -88.17525583], + [35.38520694, -80.70971389], + [40.75454583, -74.00708389], + [40.70121361, -74.00902833], + [21.30735389, -158.0703017], + [31.86933667, -95.21739028], + [40.31611111, -78.83394444], + [42.61958222, -89.04034028], + [38.36562278, -85.73829639], + [35.86469444, -98.42075], + [36.18236194, -86.88672278], + [42.25978556, -84.45940361], + [43.98631833, -94.55793722], + [32.64544861, -81.59649722], + [41.92126083, -84.5857625], + [39.07797222, -77.5575], + [40.89675, -97.62277778], + [32.70086111, -80.00291667], + [34.45147972, -84.45659278], + [59.72664194, -157.2594722], + [40.38750167, -95.78916167], + [37.86866667, -89.86213889], + [39.97338139, -90.40373556], + [43.45340222, -74.51765083], + [38.11045, -92.68054583], + [37.38783833, -83.26205889], + [37.75102778, -82.63669444], + [37.00888889, -85.10277778], + [64.89788278, -163.7034472], + [37.61523333, -91.60444167], + [38.80708333, -94.95602778], + [38.37594333, -90.97073944], + [41.41805139, -96.1136275], + [65.24089806, -166.3360067], + [40.44583139, -95.36275806], + [39.57052472, -95.18033139], + [39.47115222, -98.12878389], + [38.70423611, -84.39160417], + [37.15978667, -95.04246222], + [38.27918833, -95.21691833], + [38.90405583, -97.23585389], + [38.53751389, -94.92524194], + [39.76112278, -98.79343639], + [39.90416667, -95.7794325], + [37.87008333, -95.38638889], + [39.72870694, -92.464455], + [39.78086528, -88.30616], + [56.97299639, -133.9456147], + [64.32571917, -158.7441475], + [56.00324444, -132.8419689], + [56.31116306, -158.5359264], + [59.35214833, -151.9251558], + [59.35399444, -157.4744092], + [54.84744583, -163.4103222], + [62.89456056, -160.0649042], + [55.89753333, -159.4886689], + [36.22802139, -121.1218614], + [64.93404056, -161.158145], + [58.19094611, -152.3704875], + [61.53627389, -160.3413306], + [59.11816472, -156.8652169], + [46.118, -122.8983889], + [37.01110583, -112.5311936], + [59.44955333, -157.3271908], + [19.73876583, -156.0456314], + [56.35185972, -133.6225864], + [54.45912028, -162.6936406], + [54.13246694, -165.7853111], + [62.06048639, -163.3021108], + [55.68796194, -132.5366758], + [55.35556861, -131.71374], + [65.33136111, -166.4631667], + [55.1163475, -162.2662272], + [67.73125333, -164.5518019], + [60.80425194, -161.44535], + [55.53741389, -132.3975144], + [57.56706389, -154.4503714], + [64.87714278, -157.7158358], + [32.84032361, -115.2674806], + [35.72828472, -118.4198069], + [36.46383694, -116.8814425], + [33.25902778, -116.3209722], + [34.08526167, -117.1463789], + [35.97636444, -115.1327708], + [35.14107806, -119.4412294], + [33.35419806, -117.2508686], + [35.61967889, -119.3537242], + [34.37722333, -117.3158783], + [30.44505417, -89.98887889], + [34.26361944, -116.854475], + [30.17135306, -90.94039583], + [31.16819444, -93.34245833], + [30.75016667, -92.68847222], + [35.32483333, -118.9958333], + [29.44482222, -90.26111667], + [35.10136472, -120.6221153], + [34.12934361, -117.4016303], + [34.50415889, -118.3128561], + [35.15125306, -118.0166667], + [35.81245333, -117.3272783], + [30.13138889, -93.37611111], + [29.74779194, -90.83289889], + [35.62357083, -119.6862383], + [37.36246083, -115.1944622], + [38.06969444, -102.6885], + [40.41231694, -86.93689889], + [27.98891667, -82.01855556], + [35.87980194, -106.2694153], + [42.7787, -84.58735806], + [41.31205, -105.6749864], + [36.08036111, -115.1523333], + [34.56771444, -98.41663667], + [33.94253611, -118.4080744], + [33.66363889, -101.8227778], + [40.27594, -79.40479722], + [41.12621194, -100.6836542], + [37.04420944, -100.9598611], + [37.64718056, -92.65375778], + [34.60991667, -79.05944444], + [29.10863889, -95.46208056], + [42.24188889, -96.98141667], + [30.1260975, -93.22340361], + [43.57272806, -71.41890028], + [39.81375917, -82.92786472], + [30.18205556, -82.57686111], + [40.61744722, -74.24459417], + [43.96253278, -86.40791528], + [43.62637222, -72.30426722], + [28.82274417, -81.80900722], + [45.91869722, -102.1061778], + [44.04847278, -70.2835075], + [38.03697222, -84.60538889], + [31.23401389, -94.75], + [30.20527972, -91.987655], + [40.77724306, -73.87260917], + [33.81772222, -118.1516111], + [33.00884694, -85.07260556], + [45.29020944, -118.0071108], + [41.78773083, -111.8526822], + [61.18000361, -149.9719322], + [38.90916111, -121.3513361], + [39.75564722, -82.65711], + [41.13618028, -77.42053556], + [38.05134111, -103.5106908], + [36.02334528, -78.33027139], + [39.272765, -103.6663392], + [21.97598306, -159.3389581], + [34.72939611, -92.22424556], + [45.09712889, -94.50726833], + [44.26447361, -73.96186639], + [34.72291667, -80.85458333], + [38.00983333, -77.97013889], + [42.16111111, -120.3990703], + [44.52297806, -114.2175642], + [33.6385525, -91.75101833], + [37.4894925, -94.31150444], + [33.14620944, -89.06247917], + [42.15614361, -121.7332081], + [26.593, -80.08505556], + [32.57919111, -96.71905111], + [42.81523611, -108.7298392], + [40.85097222, -96.75925], + [46.15387722, -89.21194417], + [41.68391667, -81.39030556], + [36.98743194, -82.53017361], + [40.12171528, -76.29609778], + [20.78561111, -156.9514181], + [40.066405, -118.5651664], + [41.60844444, -88.09094444], + [38.228, -85.66372222], + [37.08727778, -84.07677778], + [34.66561028, -120.4667883], + [41.34427778, -82.17763889], + [34.80997222, -82.70288889], + [38.20809667, -99.08607306], + [27.54373861, -99.46154361], + [45.36216083, -68.53474694], + [42.77801778, -96.19368944], + [32.28941667, -106.9219722], + [32.33278083, -108.6909742], + [43.87937972, -91.25653778], + [42.75380806, -104.4045536], + [37.06290556, -120.8692511], + [35.506975, -86.80388611], + [39.10334417, -84.41861417], + [31.67255139, -89.17222417], + [21.21104028, -156.9735972], + [29.52130556, -95.24216667], + [37.69339944, -121.8203519], + [45.69938889, -110.4483056], + [44.62785361, -93.22810806], + [35.65422222, -105.1423889], + [37.85830556, -80.39947222], + [39.01115222, -95.21657694], + [40.63333306, -93.90217028], + [41.11853306, -114.9222661], + [42.71720944, -71.12343], + [46.37449806, -117.0153944], + [47.04913944, -109.4666006], + [38.76429639, -87.60549556], + [45.94943778, -94.34708472], + [40.791, -99.77727778], + [38.95975, -94.37158333], + [39.2202675, -106.3166906], + [31.63983472, -96.51472222], + [37.32668528, -79.20043056], + [38.34261472, -98.22709639], + [33.97807611, -83.96237722], + [35.20069278, -90.05397694], + [36.12931722, -87.43007056], + [35.08080778, -92.42496167], + [35.583365, -89.58722167], + [36.17506917, -89.67508], + [35.21445944, -89.04336222], + [37.12671694, -90.7128975], + [31.90293639, -90.36870222], + [30.78602056, -89.50450694], + [35.59590306, -87.87669361], + [32.30334111, -90.40848333], + [37.59693194, -93.34765], + [33.72008889, -93.65884556], + [35.63771778, -91.17637556], + [37.22561111, -87.15752778], + [34.44953972, -87.71030833], + [32.31181111, -89.13589194], + [30.84324389, -89.15977333], + [36.76911111, -88.58472222], + [34.87509944, -94.10993056], + [35.38507528, -87.96752833], + [37.18588722, -88.75061], + [33.3459775, -91.31569833], + [36.37684472, -86.40875861], + [37.00950028, -88.29586639], + [34.88000194, -91.1764375], + [33.77639167, -90.52500833], + [34.54539444, -94.20265278], + [33.87374861, -88.48967833], + [34.80434611, -89.5211075], + [31.59544583, -89.90619056], + [33.89177944, -89.02367194], + [45.85285, -106.7092722], + [37.33009167, -91.97316944], + [35.65131944, -88.37893444], + [35.80218, -88.87494944], + [36.19041667, -86.31569444], + [36.90621528, -94.01275833], + [31.31739944, -88.93504778], + [35.27175278, -91.27040417], + [35.23160167, -90.76155111], + [36.24551111, -90.95520444], + [34.54722222, -89.02416667], + [34.41232833, -91.46634722], + [48.36694167, -107.9193444], + [30.48748472, -89.65119306], + [33.99673833, -93.83813583], + [34.33331583, -92.76149944], + [32.48633611, -91.77087528], + [34.85645028, -86.55621472], + [33.58403556, -88.66668694], + [34.09984639, -93.06611694], + [36.53726194, -86.92068917], + [33.71221972, -87.81504639], + [34.69232306, -90.35065389], + [34.55656472, -92.60693972], + [32.82213889, -83.56202778], + [36.9857175, -120.1119844], + [31.94252778, -102.2019139], + [30.83780556, -85.18188889], + [44.85365722, -74.32894972], + [34.18116667, -79.33472222], + [36.60055694, -89.99220278], + [18.25569444, -67.14847222], + [45.54650361, -100.4079192], + [44.27319722, -86.2490025], + [32.43866444, -90.10309222], + [43.53291472, -84.07964722], + [35.87748444, -86.37753222], + [39.46392583, -92.42759778], + [31.17845444, -90.47187528], + [45.86493444, -84.63734444], + [37.28472861, -120.5138858], + [62.95287361, -155.6057625], + [39.29760528, -94.71390556], + [40.20638889, -100.5918056], + [32.69284944, -83.64921083], + [28.42888889, -81.31602778], + [43.1577925, -93.33126056], + [40.70881639, -86.76676139], + [35.86219306, -77.17820278], + [32.03652444, -102.1010278], + [36.48475778, -99.19415778], + [37.77809583, -89.25203111], + [63.10577694, -154.7189806], + [44.01597222, -97.08593333], + [40.19349528, -76.76340361], + [41.7859825, -87.75242444], + [45.10097556, -90.30341], + [34.79193917, -79.36584778], + [32.33313333, -88.75120556], + [37.27938889, -100.3563056], + [35.04241667, -89.97666667], + [37.38048056, -120.5681889], + [39.00030889, -119.7508064], + [42.178295, -95.79364528], + [40.82141667, -82.51663889], + [26.17583333, -98.23861111], + [44.63687972, -90.18932667], + [42.37422778, -122.8734978], + [37.64688889, -75.76105556], + [41.70331694, -86.82124167], + [41.50998278, -74.26465056], + [32.30064417, -86.39397611], + [31.08490917, -83.80325528], + [39.6429075, -79.91631417], + [39.58897222, -84.22486111], + [43.77483333, -98.03861111], + [39.14096722, -96.67083278], + [39.09575472, -93.20287889], + [63.880565, -152.3006756], + [32.37388889, -82.07919444], + [38.55389694, -121.2975908], + [42.93451639, -71.43705583], + [35.05936472, -118.1518561], + [25.79325, -80.29055556], + [48.415769, -101.358039], + [45.06198611, -93.3539375], + [40.24234806, -85.39586], + [36.90922083, -94.88750028], + [35.50592944, -119.1915236], + [39.36780556, -75.07222222], + [42.11272639, -92.91778778], + [43.65004111, -94.98654611], + [39.92749806, -74.29237917], + [44.52524444, -98.95811444], + [39.12324111, -94.592735], + [42.94722222, -87.89658333], + [43.16948806, -86.23822306], + [36.8948525, -81.349955], + [21.15288583, -157.0962561], + [35.59987944, -88.91561611], + [35.65773028, -95.36164889], + [44.22164528, -93.91874333], + [31.09466, -92.06906861], + [25.99502778, -81.67252778], + [28.10275, -80.64580556], + [34.88240194, -95.78346278], + [41.196, -96.11227778], + [38.4266325, -113.0124564], + [41.44852639, -90.50753917], + [33.15419444, -83.24061111], + [61.8659225, -162.0690456], + [46.42795972, -105.8862397], + [45.64783611, -68.68556194], + [32.51086556, -92.03768778], + [64.99756472, -150.6441297], + [37.62404861, -118.8377722], + [35.39730333, -84.56256861], + [41.50871472, -72.82947833], + [44.45006611, -95.82234028], + [40.79935, -74.41487472], + [45.19444444, -123.1359444], + [36.99282694, -91.71445611], + [33.58711111, -80.20866667], + [45.12665028, -87.63844056], + [40.61625, -83.06347222], + [35.54537222, -84.380235], + [31.66592639, -98.1486375], + [38.59163472, -90.99761444], + [38.61102222, -94.34213056], + [30.69141667, -88.24283333], + [37.62581722, -120.9544214], + [43.62166833, -84.737485], + [36.17939639, -83.37544944], + [48.25937778, -101.2803339], + [62.09536222, -163.6820594], + [45.56651667, -95.96763611], + [32.7995775, -89.12589472], + [35.13886306, -92.90919694], + [41.1374775, -75.37887833], + [38.35243722, -97.69133028], + [44.203505, -72.56232944], + [40.94661389, -91.511075], + [40.52034556, -90.65246389], + [35.91898806, -75.69553944], + [39.84348556, -85.89706389], + [46.353639, -87.395361], + [32.09577778, -82.88002778], + [36.00897944, -86.52007667], + [39.40193278, -77.98458139], + [35.55413889, -87.17891667], + [30.37147222, -104.0166944], + [34.73355028, -76.66059611], + [61.21437861, -149.8461614], + [42.88532917, -90.23198583], + [35.82149222, -81.61073639], + [36.5869825, -121.8429478], + [33.12936111, -94.97563889], + [34.74532028, -87.61023222], + [43.13985778, -89.33751361], + [46.91630556, -114.0905556], + [44.88054694, -93.2169225], + [44.93582722, -74.84554583], + [41.70164917, -74.79501389], + [29.99338889, -90.25802778], + [24.72614083, -81.05137806], + [38.50886722, -107.8938333], + [55.13104528, -131.5780675], + [39.32566333, -76.41376556], + [39.47793722, -88.27923833], + [41.07694333, -71.92039972], + [36.63074861, -80.01834917], + [44.1287725, -87.68058472], + [20.00132694, -155.6681072], + [41.36786333, -91.14821639], + [31.45805306, -87.35104028], + [44.96905556, -95.71025], + [37.52855833, -106.0460533], + [44.53460806, -72.61400444], + [44.70311111, -67.47861111], + [38.32335444, -88.85847917], + [41.39302583, -70.6143325], + [37.75313528, -89.01159694], + [43.11092694, -88.03442194], + [47.20770806, -119.3201897], + [36.459735, -80.55295722], + [32.78160556, -98.060175], + [43.91340167, -95.10940833], + [39.53102778, -84.39527778], + [35.89444444, -90.15456944], + [42.22611111, -91.16708333], + [32.81573306, -117.1395664], + [61.33567417, -142.686775], + [44.88879556, -116.1017497], + [33.67975, -78.92833333], + [60.37142, -166.2706083], + [39.09777278, -121.569825], + [39.85416833, -96.63021389], + [32.50984389, -111.3253339], + [40.49037278, -85.67914389], + [42.27230778, -74.39403667], + [42.59264528, -76.2148825], + [41.27118222, -72.54972972], + [40.94752444, -74.31450139], + [40.20404833, -75.43026306], + [40.0667825, -74.17764167], + [40.99778111, -76.43605583], + [39.93427778, -74.80725], + [42.30258, -75.41595639], + [36.80030556, -105.5975], + [41.74324028, -76.44457083], + [34.09450778, -107.2978142], + [41.51533861, -75.25148139], + [40.96667472, -78.93000528], + [41.62249167, -74.70141111], + [41.72790028, -77.39651139], + [40.56626889, -74.97864139], + [40.26040083, -75.67085306], + [40.58286278, -74.73656222], + [41.03587167, -75.16067889], + [39.83052639, -75.76974472], + [42.52476694, -75.06446167], + [40.13647333, -75.26702972], + [39.97295167, -77.64326778], + [41.57698222, -73.73235278], + [41.28759361, -74.28709472], + [39.90415167, -74.74954917], + [40.83692306, -76.55245611], + [39.66746889, -74.75773444], + [41.59720444, -74.45840722], + [40.58757389, -75.01942056], + [40.21394333, -74.60179472], + [41.72787111, -74.37737583], + [64.55305556, -163.0088889], + [39.99472222, -75.58333333], + [36.43722083, -79.85101], + [36.43243111, -81.41968472], + [48.78388139, -97.62981028], + [46.01247194, -98.51287889], + [47.79123306, -99.93174222], + [48.66758278, -102.0475944], + [48.0313875, -98.32788111], + [46.34663556, -98.28371], + [46.21830472, -100.2450028], + [46.359725, -102.3229389], + [47.35305, -101.0273681], + [30.04242056, -90.02825694], + [43.77923806, -71.75369056], + [43.13472111, -75.64890417], + [35.35666667, -89.87027778], + [39.84914444, -99.89320583], + [64.72981944, -158.0731889], + [37.85206528, -94.30486472], + [42.99821222, -74.32955111], + [39.82073556, -120.3543767], + [40.28235278, -121.2411683], + [39.17903, -121.9933611], + [39.79015444, -123.2664025], + [35.75703083, -94.64994417], + [37.48743556, -120.6968669], + [40.08597806, -123.8136397], + [39.22402778, -121.0030833], + [40.7193, -123.9275531], + [41.04290778, -123.6683894], + [38.03042306, -120.4145556], + [37.95825861, -119.1065375], + [36.58826667, -118.0520314], + [37.75634472, -120.8002089], + [39.45129778, -123.3722844], + [38.65352083, -122.8994397], + [36.66633917, -119.4498483], + [34.70839417, -99.90871194], + [39.72124194, -122.1466508], + [38.67387639, -121.8720772], + [36.39883833, -119.1073289], + [39.00408444, -119.1579303], + [36.85708306, -101.2270903], + [41.47487, -122.4530739], + [35.48201417, -96.71862944], + [39.26203778, -123.7537347], + [39.12655889, -121.6091328], + [36.79058417, -97.74899722], + [40.7457, -122.92197], + [38.26241917, -119.2257094], + [41.55267139, -120.1663339], + [38.7743525, -122.9922217], + [38.68407028, -120.9871642], + [36.11253667, -98.3086825], + [37.51077, -120.0418439], + [38.2578325, -122.6055406], + [38.37680111, -120.7939075], + [41.88738, -121.3594331], + [40.57487278, -122.4080642], + [40.98320111, -122.6941889], + [38.1935, -121.7023889], + [41.01877417, -121.4333136], + [34.82916444, -77.61213778], + [37.72129083, -122.2207167], + [36.68190278, -121.7624492], + [27.26282306, -80.84978306], + [66.90917056, -156.8610575], + [29.17261111, -82.22416667], + [31.57802778, -94.70954167], + [44.8735825, -87.9090525], + [35.57046806, -77.04981306], + [31.92056722, -102.3870892], + [41.62425, -98.95236111], + [41.93344861, -85.052585], + [39.10994444, -100.8164444], + [45.30858944, -92.69008056], + [41.98546389, -97.43511111], + [37.7080325, -77.43601028], + [41.11961111, -101.7689444], + [33.46094444, -80.85891667], + [41.19594417, -112.012175], + [20.89864972, -156.4304578], + [46.84547028, -89.36708806], + [44.68185361, -75.46549917], + [41.37427778, -84.06791667], + [41.24476583, -82.55122722], + [41.63674333, -82.82833333], + [42.56655417, -75.52411167], + [39.83378278, -100.5394236], + [38.84760194, -94.73758583], + [33.21797639, -117.3515075], + [35.39308833, -97.60073389], + [40.5281775, -86.05899], + [35.66813889, -95.94869444], + [41.40097222, -102.3550278], + [39.14352139, -78.14444444], + [32.96672222, -82.83816667], + [44.9525, -68.67433333], + [42.24006611, -78.371685], + [48.09451778, -105.5750536], + [46.9705, -122.9022083], + [31.41772222, -110.8478889], + [41.448, -97.34263889], + [34.97875, -89.78683333], + [38.72182722, -88.17643278], + [42.68084472, -91.97447833], + [41.30251861, -95.89417306], + [64.51220222, -165.4452458], + [38.24721639, -78.04561028], + [48.46440222, -119.5180503], + [29.30113889, -81.11380556], + [44.07721306, -91.70831694], + [42.46988889, -98.68805556], + [34.02247222, -106.9031389], + [44.02052417, -117.013635], + [44.58036111, -124.0579167], + [34.056, -117.6011944], + [33.35088056, -98.81916667], + [42.09860472, -83.16105861], + [41.22614944, -92.49388278], + [58.11215944, -135.451805], + [60.53337639, -165.1139636], + [25.907, -80.27838889], + [30.55840556, -92.099375], + [32.95458861, -84.26315222], + [41.5971525, -71.41215333], + [42.050075, -90.73880472], + [45.814825, -119.8205006], + [48.01592194, -92.85605139], + [42.99026444, -96.06279667], + [41.979595, -87.90446417], + [42.57011889, -72.28860667], + [36.89461111, -76.20122222], + [30.06916667, -93.80091667], + [42.26733944, -71.87570944], + [57.8853775, -152.8461011], + [28.54547222, -81.33294444], + [48.70816, -122.9137961], + [62.96133361, -141.9291369], + [66.82852667, -161.0277908], + [44.45260972, -83.38036389], + [43.98436639, -88.55705944], + [40.07977778, -83.07302778], + [33.09025889, -89.54201722], + [43.65506611, -95.57920917], + [43.41713889, -124.2460278], + [41.10659611, -92.44793972], + [66.88467694, -162.5985497], + [35.24556444, -97.47212861], + [39.48775, -121.622], + [39.04563667, -85.60533], + [43.16063056, -90.67421833], + [44.12339722, -93.26061667], + [37.74011111, -87.16683333], + [42.19079694, -71.17310389], + [38.53866667, -95.25297222], + [44.7155, -69.86647222], + [41.0355825, -83.98202444], + [38.31044444, -75.12397222], + [41.47855556, -73.13525], + [39.50203917, -84.7841425], + [41.3301875, -86.66473194], + [34.20080083, -119.2072164], + [41.29888556, -93.11381556], + [41.41247778, -78.50263139], + [30.73528028, -101.2029719], + [42.62950694, -83.98417361], + [32.45005694, -112.8673778], + [31.36399028, -109.8831286], + [32.93594444, -111.4265278], + [33.35314722, -110.6673611], + [34.93891389, -110.1395656], + [34.15063889, -114.2712222], + [35.30223222, -112.1940575], + [32.24540278, -109.8946319], + [40.10840556, -79.54142694], + [34.73002111, -112.0351569], + [40.20972222, -79.83144444], + [47.90762861, -122.2815892], + [37.06083333, -88.77375], + [21.89686833, -159.6033217], + [34.25683639, -111.3392558], + [37.46111944, -122.1150444], + [61.59474194, -149.0888242], + [34.17498722, -91.93472028], + [45.70895028, -90.40248472], + [26.68316194, -80.09559417], + [56.57735278, -169.6637361], + [67.23789833, -150.2860608], + [28.00021667, -82.16424167], + [41.51627778, -82.86869444], + [44.33368778, -89.01549861], + [43.01928889, -91.12374722], + [33.87560444, -84.30196778], + [45.69505556, -118.8414444], + [45.58872222, -122.5975], + [41.40006667, -92.94588333], + [57.95517222, -136.2362733], + [42.63813556, -77.05306083], + [31.3823575, -103.5107017], + [28.95419444, -98.51998917], + [30.21208333, -85.68280556], + [36.92611111, -111.4483611], + [26.92019444, -81.99052778], + [59.34825944, -151.8315389], + [36.06352944, -90.50986028], + [35.63523944, -77.38532028], + [40.47091667, -81.41975], + [37.13189556, -76.4929875], + [39.73530556, -99.31741667], + [33.45169472, -79.52620111], + [26.78503861, -80.69335528], + [39.87195278, -75.24114083], + [42.91095778, -82.52886139], + [68.34877417, -166.7993086], + [44.04862722, -101.5990603], + [36.33822472, -88.38287861], + [33.43416667, -112.0080556], + [40.66424333, -89.69330556], + [31.46714944, -89.33705778], + [27.91076333, -82.68743944], + [42.91130556, -112.5958611], + [26.16621, -97.34588611], + [32.84069444, -84.88244444], + [44.38267694, -100.285965], + [40.49146583, -80.23287083], + [69.732875, -163.0053417], + [37.97788417, -89.36044889], + [60.70369056, -161.7767367], + [39.34510333, -81.43920194], + [46.90062583, -95.07313278], + [45.95502361, -90.42441806], + [44.68751861, -73.52452306], + [40.45076167, -84.99007917], + [45.5709275, -84.796715], + [33.55883333, -86.24905556], + [48.9425, -97.24083333], + [34.62938889, -118.0845528], + [38.84047, -82.84731361], + [26.24713889, -80.11105556], + [40.95025, -95.91788889], + [42.22328722, -72.31138694], + [35.80843944, -76.75927694], + [42.79549917, -109.8070944], + [36.73058417, -97.09976833], + [40.08194417, -75.01058667], + [45.55986778, -93.60821611], + [45.20066667, -67.56438889], + [57.58038056, -157.5674444], + [30.47330556, -87.18744444], + [34.09164833, -117.7817803], + [36.77394444, -90.32484722], + [42.74280556, -94.64730556], + [41.62661111, -73.88411111], + [44.86797222, -108.793], + [35.61298806, -100.9962608], + [66.81288139, -150.6437925], + [37.33125778, -95.50900667], + [14.33102278, -170.7105258], + [41.57276194, -86.73413139], + [39.63885556, -90.77843111], + [46.68896, -68.04479972], + [30.46278111, -88.52922778], + [43.98330333, -96.30031083], + [18.339675, -65.62460583], + [35.67288611, -120.6270558], + [34.65447222, -112.4195833], + [39.70015944, -87.66961861], + [31.84540222, -86.61044583], + [41.82801306, -94.15990361], + [33.63660667, -95.45073194], + [40.88439139, -78.08734167], + [46.26468028, -119.1190292], + [18.00830278, -66.56301194], + [42.42684667, -73.29292806], + [56.80165194, -132.9452781], + [37.13734528, -80.67848167], + [43.07795889, -70.82327333], + [31.77969444, -95.70630556], + [33.82921556, -116.5062531], + [28.72751778, -96.2509675], + [37.18375833, -77.50738889], + [44.67666917, -74.94844639], + [56.95943333, -158.6318208], + [42.66520389, -83.41870917], + [29.71081917, -91.33971778], + [37.44855556, -94.73133333], + [37.7000175, -98.7462025], + [59.01135611, -161.8196661], + [36.02960778, -119.0627311], + [40.23957167, -75.55662528], + [38.28908722, -104.4965722], + [39.61391556, -110.7514183], + [42.68935583, -90.44439278], + [42.07199833, -70.22137667], + [41.72399917, -71.42822111], + [38.72421806, -120.753325], + [36.78014889, -76.44883472], + [34.71105361, -97.22321694], + [40.21919444, -111.7233611], + [34.16814722, -101.7173361], + [35.53455, -97.64721556], + [46.7247875, -94.3817], + [48.79030583, -104.533845], + [31.48491667, -97.31652778], + [42.11418083, -87.90148083], + [43.64616667, -70.30875], + [47.49275361, -122.7624286], + [32.51058333, -83.76733333], + [34.74213889, -80.34519444], + [41.90902444, -70.72878778], + [36.41200333, -100.7517883], + [45.40709667, -83.81288556], + [33.92395306, -102.3866831], + [34.56682472, -101.7814611], + [36.02502306, -106.0464114], + [33.70005472, -108.8506214], + [39.0126775, -123.3827864], + [39.45544417, -121.2913511], + [33.54980833, -102.3727333], + [40.49291944, -123.5997589], + [33.173675, -102.1926208], + [36.44856139, -119.3190056], + [34.14547222, -103.4103333], + [34.1286575, -109.3114756], + [33.64886139, -105.895685], + [34.00230056, -101.330435], + [36.32697806, -104.6197117], + [36.79891472, -100.5298708], + [36.85998861, -120.4644675], + [38.30491306, -121.4296736], + [34.56673556, -102.3226947], + [34.93442472, -104.643065], + [38.92111389, -120.8647944], + [37.86166667, -120.1778889], + [40.54708833, -123.1816953], + [36.75800528, -120.3712794], + [39.70960639, -121.6163617], + [38.67601389, -121.4455092], + [40.21125917, -123.2975231], + [37.08158611, -121.5968056], + [42.76119139, -87.81389806], + [33.95187528, -117.4451017], + [44.04532139, -103.0573708], + [32.68086111, -96.86819444], + [42.56966667, -99.56836111], + [43.23878306, -123.3558617], + [40.15065667, -122.2522903], + [32.92052778, -80.64125], + [64.72721556, -155.4698886], + [44.145094, -103.103567], + [41.06554833, -86.18170444], + [45.49825694, -91.00186361], + [40.50898361, -122.2934019], + [41.01052778, -95.25986111], + [44.25406722, -121.1499633], + [47.961167, -97.401167], + [35.87763889, -78.78747222], + [61.78764333, -157.3479344], + [45.18744472, -109.2673778], + [42.19536389, -89.09721111], + [28.29361694, -97.32304833], + [44.58935611, -92.48496889], + [45.63119306, -89.46745361], + [37.33287306, -121.8197947], + [37.50516667, -77.31966667], + [39.75721528, -84.84282], + [38.73643611, -112.0989444], + [39.526315, -107.7269403], + [38.4887975, -121.1024447], + [33.88057333, -117.2594836], + [43.064235, -108.4598411], + [44.06008333, -69.09925], + [28.08677778, -97.04461111], + [35.02162639, -94.6212525], + [41.5942175, -109.0651928], + [35.922295, -84.68966278], + [46.305635, -119.3041853], + [43.23379861, -75.40703333], + [34.35060111, -85.15801389], + [65.50786222, -150.1428047], + [42.25118111, -84.9554525], + [35.69870944, -85.84381722], + [45.14831139, -92.53806139], + [33.038905, -116.9136392], + [39.49857611, -119.7680647], + [47.49313889, -122.21575], + [33.76114056, -90.75787528], + [37.32546833, -79.97542833], + [43.11886611, -77.67238389], + [36.37229667, -94.10686972], + [14.078333, 101.378334], + [7.367222, 134.544167], + [45.69801389, -92.95298972], + [33.30155556, -104.5305556], + [48.85603806, -95.69703861], + [39.81790861, -97.659625], + [45.41809056, -91.77365194], + [46.47357528, -108.5576333], + [43.72263278, -85.50407333], + [35.65205556, -109.0673889], + [45.19927083, -89.71143389], + [48.94138889, -95.34838889], + [61.77967583, -161.3194772], + [38.87212222, -98.81177611], + [32.51444444, -92.58833333], + [43.90882639, -92.49798722], + [39.01604222, -87.649775], + [26.53616667, -81.75516667], + [36.74152778, -104.5021833], + [35.25914667, -93.09326611], + [48.39035917, -100.0242739], + [35.64588583, -80.52029306], + [43.52990694, -72.949615], + [32.05897222, -82.15172222], + [40.67737417, -77.62682833], + [36.45757917, -82.88503722], + [44.54720389, -95.082255], + [35.85498861, -77.89295611], + [41.8055975, -107.19994], + [41.09226306, -86.61287111], + [43.83391139, -111.805105], + [32.14308333, -111.1728611], + [43.16963222, -88.72321222], + [34.01315611, -84.59854472], + [40.94789861, -87.18257944], + [45.8227275, -92.37250083], + [39.44136778, -83.02251556], + [36.43945583, -77.70934139], + [48.16863889, -111.9764722], + [42.19028361, -122.6606283], + [43.08733083, -124.4095578], + [44.09483333, -121.2006389], + [47.86597139, -119.9427053], + [44.63781639, -123.0594486], + [47.94146583, -124.3929867], + [43.87633333, -121.4530556], + [48.70727528, -117.4126036], + [41.29570556, -83.03723056], + [47.79569972, -103.2536992], + [48.17856944, -114.3037408], + [48.99778194, -100.0434589], + [44.529845, -122.9295336], + [48.48259944, -122.9368444], + [47.42277361, -98.10587139], + [44.66623139, -121.1631], + [47.47243611, -114.900135], + [44.28699389, -120.9038328], + [46.212355, -119.7928122], + [47.90815306, -122.1054072], + [44.87761139, -124.0284472], + [45.41824194, -123.8143839], + [47.32815583, -122.2265092], + [48.42070056, -120.1470264], + [48.28384528, -115.4902453], + [47.75482, -122.2592931], + [47.14718944, -110.2299289], + [43.61488056, -116.9215372], + [43.58133333, -116.5230556], + [46.49129139, -116.2768061], + [46.97494083, -112.6447606], + [46.79486278, -119.0802875], + [48.59194444, -109.2488889], + [47.32768722, -116.5773906], + [46.21934028, -116.0134736], + [45.94255806, -116.1234158], + [47.54769889, -116.1885008], + [48.15333333, -104.5038889], + [44.20683056, -116.9623869], + [46.24710917, -116.4801447], + [47.18317583, -120.884525], + [46.8584975, -117.4137964], + [48.10486806, -119.7206128], + [41.44485944, -106.8235264], + [38.51252389, -121.4934689], + [32.85331278, -109.6349708], + [35.61677778, -106.0881389], + [32.73355611, -117.1896567], + [38.14893833, -89.69870972], + [29.53369444, -98.46977778], + [32.12758333, -81.20213889], + [46.35361111, -87.39583222], + [46.38087944, -94.80660167], + [34.42621194, -119.8403733], + [34.09535361, -117.2348742], + [43.76949444, -87.85158944], + [41.70895361, -86.31847417], + [32.60825, -82.36869444], + [35.23705806, -120.6423931], + [40.51625944, -106.8663006], + [43.59534389, -94.09284833], + [48.54125278, -111.8720722], + [38.34052611, -75.51028806], + [41.61033333, -96.62986111], + [70.19475583, -148.4651608], + [33.17183583, -86.30553778], + [40.851206, -77.846302], + [42.85245556, -73.9288675], + [37.89426694, -121.2386203], + [61.84454111, -165.5737492], + [36.45569444, -84.58575], + [45.51859778, -102.4671042], + [43.30888889, -96.571], + [44.43080278, -97.56118861], + [45.79998111, -99.6420625], + [44.00386056, -96.59310139], + [45.25755861, -99.79783944], + [45.79680833, -100.7842503], + [43.85165639, -100.7120811], + [43.37915361, -97.97118278], + [43.90637833, -100.0370669], + [40.75148167, -95.41347222], + [38.17438889, -85.736], + [33.622875, -111.9105333], + [32.57230556, -116.98025], + [55.31502778, -160.5176944], + [47.70685778, -104.1925544], + [47.44898194, -122.3093131], + [32.82623111, -116.9724497], + [27.45640278, -81.3424], + [40.82052917, -76.86377611], + [32.34394667, -86.98780333], + [32.21532333, -98.17766722], + [38.92355361, -85.90736556], + [38.92969444, -90.42996111], + [34.84862889, -111.7884614], + [28.77764, -81.23748944], + [43.39058278, -99.84256194], + [47.68281806, -117.3225583], + [43.39386111, -70.70800028], + [37.61900194, -122.3748433], + [36.68235361, -76.60187333], + [42.04581972, -90.10760056], + [41.92076333, -71.49138139], + [37.24432611, -93.38685806], + [39.84028194, -83.84015056], + [29.95925, -81.33975], + [29.62225306, -95.65652889], + [44.85713278, -93.03285389], + [34.60054, -91.57457417], + [37.09058333, -113.5930556], + [59.46006194, -135.3156636], + [38.26384333, -78.89643806], + [66.88916556, -157.1505119], + [66.24956861, -166.0895589], + [43.20839361, -95.83343306], + [47.23355556, -123.1475556], + [44.76919556, -106.9802794], + [32.4466275, -93.82559833], + [62.69511944, -159.5690614], + [18.45675, -66.09883333], + [36.89888889, -89.56175], + [57.04713806, -135.3615983], + [39.1147125, -87.44832917], + [41.78144167, -122.4681094], + [37.36186194, -121.9290089], + [34.51855556, -109.37875], + [31.35775, -100.4963056], + [18.43941667, -66.00183333], + [45.69227778, -85.56630556], + [47.615058, -117.655803], + [42.37908333, -94.97958333], + [61.965295, -151.1913661], + [36.45819, -105.6724289], + [42.59719444, -95.24066667], + [40.78838778, -111.9777731], + [44.90952778, -123.0025], + [36.19060778, -94.49088306], + [44.38531, -74.20618472], + [38.7914825, -97.65060333], + [38.64287222, -88.96418528], + [61.70931139, -157.1557008], + [33.15983333, -95.62113889], + [41.14335389, -85.15277694], + [37.05419722, -84.61494139], + [38.69542167, -121.5907669], + [45.12047778, -113.8820103], + [34.01582194, -118.4512961], + [40.62599083, -74.67024333], + [33.99569444, -80.3615], + [34.89924833, -120.4575825], + [33.67565861, -117.8682225], + [35.17036, -88.21587], + [32.69338667, -100.9504525], + [35.35730333, -96.94282833], + [57.16733333, -170.2204444], + [36.66279222, -121.6063603], + [41.10133333, -102.9852778], + [35.23735278, -79.39116944], + [59.44243917, -151.7040503], + [34.26527194, -110.0054075], + [34.91572222, -81.9565], + [45.77250444, -122.8623611], + [44.48022222, -103.7768889], + [27.76511111, -82.62697222], + [32.98316472, -93.41081028], + [39.84395194, -89.67761861], + [14.996111, 145.621384], + [33.98879611, -98.49189333], + [43.16552778, -95.20280556], + [29.50836111, -95.05133333], + [41.74284139, -89.67629028], + [37.511855, -122.2495236], + [36.05593278, -85.5307475], + [35.21194639, -91.737165], + [27.39533333, -82.55411111], + [33.46285, -105.5347508], + [61.789875, -156.5881861], + [29.3370075, -98.47114056], + [31.1515925, -81.39134667], + [45.73138139, -91.92066194], + [45.54532417, -94.05833667], + [44.54513556, -89.53028444], + [33.43381667, -88.84863806], + [39.77194444, -94.90970556], + [40.6152625, -103.2646556], + [38.74768694, -90.35998972], + [44.9344725, -93.05999861], + [38.50897694, -122.8128803], + [18.33730556, -64.97336111], + [17.70188889, -64.79855556], + [27.18169444, -80.22108333], + [35.78756833, -96.65862861], + [44.84366222, -87.42154111], + [43.50484139, -114.2965903], + [38.66187028, -90.65123], + [33.92925694, -78.07499167], + [46.6897175, -92.094655], + [42.40260333, -96.38436694], + [63.68639444, -170.4926361], + [32.63654694, -108.1563853], + [40.37684111, -120.5730033], + [35.76526389, -80.95673611], + [66.00900528, -149.0959153], + [60.12693833, -149.4188122], + [41.50409361, -74.10483833], + [36.16025194, -97.08577028], + [40.86525806, -97.10931306], + [32.46736806, -100.4665508], + [38.23163889, -80.87080556], + [62.52055556, -164.8477778], + [60.47613889, -151.0324444], + [39.76104833, -101.7958414], + [35.56009889, -86.44249333], + [43.11118694, -76.10631056], + [31.55851111, -83.89573389], + [34.34722167, -119.061215], + [48.29965139, -116.5597681], + [35.20295, -88.49836139], + [29.77, -94.66361194], + [36.09276972, -111.3826419], + [45.46913889, -89.80569444], + [27.20683333, -98.12117083], + [31.10672694, -98.19600194], + [30.87935556, -96.97109694], + [31.14601111, -90.168145], + [29.66925, -95.06419444], + [57.78083333, -152.3913889], + [33.86122222, -98.4904425], + [32.21261111, -101.5216389], + [27.77854306, -97.69052389], + [31.30696111, -95.40383056], + [32.887625, -96.6836075], + [33.17231861, -100.1976044], + [26.17763889, -97.97305556], + [28.03925, -97.54244444], + [29.08358806, -97.26693417], + [30.87182917, -96.62222639], + [30.57194444, -97.44316667], + [30.07780556, -94.69855556], + [27.55086111, -98.03091833], + [30.24369444, -98.90952778], + [29.34192083, -98.85090056], + [29.80411, -94.43102306], + [28.65405111, -96.6813125], + [37.25937778, -104.340675], + [65.17439528, -152.1093886], + [41.87460139, -71.01687583], + [39.53418583, -89.32781222], + [37.74163111, -92.14073611], + [32.48316667, -81.73727778], + [35.18277806, -103.6031853], + [33.2206275, -87.61140139], + [33.23694444, -107.27175], + [62.99270417, -156.0681903], + [37.68910778, -121.4418172], + [36.28489194, -78.98422694], + [46.47709083, -122.80686], + [41.56487194, -83.48226139], + [40.85010139, -74.06083611], + [38.01769694, -86.69093], + [42.56576833, -84.42321861], + [37.95375861, -107.90848], + [35.93245472, -88.84894028], + [37.82513889, -75.99777778], + [35.38015694, -86.24602333], + [47.57493556, -115.2843164], + [43.65828917, -108.2131542], + [39.916995, -76.87302611], + [47.26793111, -122.5780997], + [28.51479944, -80.7992275], + [62.3205, -150.0936944], + [57.77965833, -135.2184439], + [33.17794778, -96.5905275], + [36.23087083, -90.03466806], + [30.39652778, -84.35033333], + [36.15630556, -119.3261667], + [61.09676222, -160.9684167], + [31.42879528, -83.48787167], + [25.64788889, -80.43277778], + [14.99685028, -145.6180383], + [34.13208528, -115.9458319], + [25.86180556, -80.897], + [41.67442972, -93.02172917], + [33.8033775, -118.3396], + [44.018, -92.8315], + [59.05284222, -160.3969339], + [31.86041667, -86.01213889], + [41.58680556, -83.80783333], + [39.0686575, -95.62248361], + [42.0645475, -104.1526986], + [27.97547222, -82.53325], + [27.91557833, -82.44926083], + [38.06020222, -117.0871536], + [31.1525, -97.40777778], + [60.20433333, -154.3188728], + [41.76352778, -96.17794444], + [35.92891667, -95.00452778], + [38.47427778, -100.8849444], + [36.47521417, -82.40742056], + [39.32004222, -120.1395628], + [32.71004667, -96.26742306], + [33.62789944, -116.1601194], + [40.08351333, -93.59063472], + [40.56186833, -81.07748611], + [35.13497222, -118.43925], + [18.12444444, -145.7686111], + [35.58247222, -79.10136111], + [45.54936889, -122.4012519], + [41.93990639, -83.43468306], + [40.27669111, -74.81346833], + [36.19837222, -95.88824167], + [34.26810833, -88.769895], + [32.11608333, -110.9410278], + [37.13244083, -92.08396167], + [44.74144472, -85.582235], + [48.06550028, -96.18336083], + [30.90155194, -83.88133556], + [40.68390306, -92.90103333], + [38.89388167, -119.9953347], + [32.35160639, -91.02768917], + [40.6122725, -112.3507719], + [42.48180389, -114.4877356], + [47.049225, -91.74514167], + [33.45370806, -93.99102], + [34.45283333, -110.1148056], + [40.03064972, -86.2514375], + [32.35413889, -95.40238611], + [35.81248722, -83.99285583], + [39.90081778, -83.13719361], + [41.87877778, -92.28456944], + [36.72978, -85.65191556], + [43.20925, -112.3495861], + [42.59157139, -114.7967178], + [46.31936972, -113.3050642], + [36.56803, -114.4433133], + [42.10690806, -111.9125389], + [39.73884333, -111.8716011], + [43.54834722, -109.6902611], + [36.02054056, -114.3352461], + [38.96136167, -110.2273619], + [42.92102222, -112.8811053], + [40.61954, -111.9928858], + [37.937215, -109.3465053], + [38.23071, -112.6753497], + [37.84523333, -112.3918731], + [43.74193056, -111.0978608], + [44.91167028, -108.4455092], + [40.19190167, -110.3809886], + [44.4937825, -116.0162422], + [43.13125278, -115.7295944], + [40.14162139, -111.6613125], + [44.7498875, -116.4468092], + [37.44221444, -110.5695836], + [45.24713889, -122.7700556], + [45.50597028, -91.98108694], + [33.46539667, -88.38031639], + [38.06877667, -91.42885694], + [43.14511944, -75.38385889], + [41.02533778, -80.41337194], + [36.38025, -88.98547778], + [33.7484375, -116.2748133], + [34.44919444, -79.89036111], + [43.04102778, -88.23705556], + [42.42216, -87.86790694], + [47.93714444, -124.5612497], + [39.94262417, -91.19445611], + [42.66389361, -82.96542583], + [36.22284028, -81.0983375], + [39.12595722, -123.200855], + [38.30248472, -95.7249575], + [40.43521194, -75.38192861], + [44.31957306, -94.50230778], + [37.60375278, -101.3733889], + [39.9352025, -86.04495333], + [39.21096222, -82.23142583], + [63.88835917, -160.7989517], + [36.87813889, -91.90269444], + [43.42658333, -88.70322222], + [40.84927778, -77.84869444], + [35.20397028, -85.89858889], + [34.38431528, -89.53530972], + [20.26525583, -155.8599875], + [41.61033333, -84.12552778], + [30.74688667, -95.58716667], + [61.75441667, -150.0516639], + [41.53243972, -71.28154389], + [38.23343056, -91.16433333], + [29.21135028, -99.74358306], + [39.87585167, -85.32646806], + [39.93272694, -83.46200361], + [34.98783333, -81.05716667], + [61.53363583, -165.5837322], + [39.94289056, -74.84571944], + [36.34571528, -94.219345], + [38.37675167, -121.962455], + [28.85255556, -96.91848722], + [34.593225, -117.3794667], + [32.19255556, -82.37194444], + [61.13395028, -146.24836], + [67.02269444, -146.4137753], + [40.44090167, -109.5099203], + [38.94577556, -92.68277139], + [40.20441667, -84.53191667], + [36.21166667, -115.19575], + [31.05784417, -104.7838056], + [38.12743222, -91.7695225], + [44.55812861, -90.51224694], + [36.31866667, -119.3928889], + [36.68711028, -82.03333583], + [38.99130556, -89.16622222], + [30.7825, -83.27672222], + [42.76528917, -96.93425472], + [27.07161111, -82.44033333], + [40.86472222, -84.60944444], + [34.20980972, -118.4899733], + [34.12313889, -84.84869444], + [30.48325, -86.5254], + [41.45396667, -87.00707139], + [30.21867306, -81.87666444], + [18.13551806, -65.49182583], + [27.65555556, -80.41794444], + [43.34362889, -72.5173125], + [40.024675, -82.46182194], + [42.21862611, -92.02592806], + [42.85767194, -100.547355], + [35.41669472, -80.15079556], + [45.6204525, -122.6564883], + [45.30566472, -96.42442278], + [41.35186806, -89.15308417], + [47.00369806, -124.143785], + [39.84092833, -77.27415139], + [44.89234639, -91.86777944], + [39.00035833, -80.27392778], + [38.97638889, -76.32963889], + [36.96015, -78.18499861], + [48.53732194, -123.0096236], + [35.22224722, -78.03779444], + [38.01679028, -75.82882056], + [35.6538825, -79.8950425], + [38.66705556, -78.50058333], + [38.58704667, -77.71138389], + [36.710045, -78.84802028], + [35.10117083, -75.96595278], + [37.50320139, -77.12552694], + [37.52122778, -76.7646825], + [38.99419444, -79.14438889], + [45.62777778, -122.4041667], + [47.92348361, -119.0805789], + [48.01814917, -122.4384789], + [47.3582025, -118.6733264], + [39.900075, -80.13311667], + [63.51591972, -162.2827394], + [66.36155056, -147.4012186], + [41.29717222, -75.85120556], + [67.50451667, -148.4832222], + [36.37920333, -97.79111222], + [33.98227778, -83.66808333], + [34.25932528, -118.4134331], + [34.74095944, -118.2189489], + [37.16861556, -97.03752194], + [66.60002778, -159.9861944], + [39.51635389, -122.2175106], + [40.89661111, -117.8058889], + [64.68919444, -163.4125556], + [60.69118917, -161.9695161], + [56.48432583, -132.3698242], + [43.96571306, -107.9508308], + [67.40457333, -150.1227417], + [58.70343611, -157.0082511], + [41.34961694, -71.80337778], + [67.56208333, -162.9752778], + [36.93573, -121.7896178], + [44.53325, -69.67552778], + [39.00850694, -74.90827389], + [36.4367025, -99.5209975], + [44.68839917, -111.1176375], + [25.84871167, -81.39007944], + [27.19199444, -81.83730472], + [27.89380556, -81.62038889], + [26.70089833, -80.66227972], + [26.74423278, -81.43257556], + [28.01398389, -82.34527917], + [28.62234556, -80.835695], + [28.922765, -81.65174111], + [27.81280389, -80.49560833], + [29.06177778, -82.37658333], + [28.80859639, -82.31648167], + [25.77833333, -80.17027778], + [25.94898194, -80.42338694], + [29.46738889, -81.20633333], + [25.49872139, -80.55422528], + [27.96196472, -80.55977556], + [29.35422, -82.47288194], + [18.13801667, -65.8007175], + [18.33856722, -64.94070111], + [17.74719528, -64.70486444], + [18.30800972, -65.66182806], + [18.33689833, -64.79958306], + [36.28186944, -94.30681111], + [46.99016361, -94.20400222], + [42.87999833, -97.90117972], + [43.45747694, -96.80199528], + [45.65371028, -84.51927306], + [46.76823667, -100.8943433], + [46.06638556, -100.6348492], + [44.244825, -84.17980472], + [48.39443778, -97.78147889], + [42.50311694, -83.62371667], + [44.04162556, -89.30448694], + [43.57913917, -90.90096333], + [45.51662972, -88.93344694], + [45.98607111, -95.99199861], + [46.00931139, -83.74393417], + [44.24995694, -95.60445389], + [42.93769972, -85.06066722], + [47.93640083, -102.1421142], + [43.45418694, -82.84938028], + [45.00000833, -84.13333667], + [59.50336056, -139.6602261], + [9.5167, 138.1], + [42.2379275, -83.53040889], + [46.56816972, -120.5440594], + [42.91669444, -97.38594444], + [41.26073556, -80.67909667], + [32.65658333, -114.6059722], + [14.18435056, -169.6700236], + [60.87202194, -162.5248094], + [60.90453167, -161.42091], + [63.1460375, -156.529865], + [61.39445139, -149.8455556], + [62.29368944, -146.5794219], + [56.00753611, -161.1603672], + [64.30120361, -149.1201436], + [66.27399583, -145.8240381], + [34.00333333, -110.4441667], + [36.28002361, -80.78606861], + [40.70644889, -76.37314667], + [28.22806472, -82.15591639], + [35.08322694, -108.7917769], + [39.94445833,-81.89210528] +]; diff --git a/scripts/generate/logs/samples/astronauts.js b/scripts/generate/logs/samples/astronauts.js new file mode 100644 index 000000000..ce5ca08bc --- /dev/null +++ b/scripts/generate/logs/samples/astronauts.js @@ -0,0 +1,559 @@ +module.exports = [ + 'Joseph M. Acaba', + 'Loren Acton', + 'Mike Adams', + 'James Adamson', + 'Viktor M. Afanasyev', + 'Thomas Akers', + 'Vladimir Aksyonov', + 'Gemini 12', + 'Aleksandar Panayotov Aleksandrov', + 'Aleksandr Pavlovich Aleksandrov', + 'Andrew M. Allen', + 'Joseph P. Allen', + 'Scott Altman', + 'Apollo 8', + 'Clayton Anderson', + 'Michael P. Anderson', + 'Claudie Haigneré', + 'Dominic A. Antonelli', + 'Jerome Apt', + 'Lee Archambault', + 'Gemini 8', + 'Richard R. Arnold', + 'Anatoly Artsebarsky', + 'Yuri Artyukhin', + 'Jeffrey Ashby', + 'Oleg Atkov', + 'Toktar Aubakirov', + 'Sergei Avdeyev', + 'James P. Bagian', + 'Ellen S. Baker', + 'Michael Baker', + 'Aleksandr Balandin', + 'Michael R. Barratt', + 'Daniel Barry', + 'John-David F. Bartoe', + 'Charlie Bassett', + 'Yuri Baturin', + 'Patrick Baudry', + 'Apollo 12', + 'Robert L. Behnken', + 'Ivan Bella', + 'Pavel Belyayev', + 'Georgi Beregovoi', + 'Anatoli Berezovoy', + 'John Blaha', + 'Michael J. Bloomfield', + 'Guion Bluford', + 'Karol Bobko', + 'Eric A. Boe', + 'Charles Bolden', + 'Roberta Bondar', + 'Valentin Bondarenko', + 'Andrei Borisenko', + 'Gemini 7', + 'Stephen G. Bowen', + 'Kenneth Bowersox', + 'Charles E. Brady, Jr.', + 'Vance Brand', + 'Daniel Brandenstein', + 'Randolph Bresnik', + 'Roy Bridges', + 'Curtis Brown', + 'David M. Brown', + 'Mark Brown', + 'James Buchli', + 'Jay C. Buckey', + 'Nikolai Budarin', + 'John S. Bull', + 'Daniel Burbank', + 'Daniel Bursch', + 'Valery Bykovsky', + 'Robert D. Cabana', + 'Yvonne Cagle', + 'Fernando Caldeiro', + 'Charles Camarda', + 'Kenneth D. Cameron', + 'Duane G. Carey', + 'Scott Carpenter', + 'Gerald P. Carr', + 'Sonny Carter', + 'John Casper', + 'Christopher Cassidy', + 'Robert J. Cenker', + 'Gemini 9A', + 'Roger B. Chaffee', + 'Gregory Chamitoff', + 'Franklin Chang-Diaz', + 'Philip K. Chapman', + 'Kalpana Chawla', + 'Maurizio Cheli', + 'Chen Quan', + 'Leroy Chiao', + 'Kevin P. Chilton', + 'Jean-Loup Chrétien', + 'Laurel B. Clark', + 'Mary L. Cleave', + 'Jean-François Clervoy', + 'Michael R. Clifford', + 'Michael Coats', + 'Kenneth Cockrell', + 'Catherine Coleman', + 'Eileen Collins', + '', + 'Gordon Cooper', + 'Richard O. Covey', + 'Timothy Creamer', + 'John O. Creighton', + 'Robert Crippen', + 'Samantha Cristoforetti', + 'Roger K. Crouch', + 'Frank L. Culbertson, Jr.', + 'Walter Cunningham', + 'Robert Curbeam', + 'Nancy J. Currie', + 'Nancy Jan Davis', + 'Lawrence J. DeLucas', + 'Frank De Winne', + 'Vladimir N. Dezhurov', + 'Georgi Dobrovolski', + 'Takao Doi', + 'B. Alvin Drew', + 'Brian Duffy', + 'Apollo 16', + 'Bonnie J. Dunbar', + 'Pedro Duque', + 'Samuel T. Durrance', + 'James Dutton', + 'Lev Dyomin', + 'Tracy Caldwell Dyson', + 'Vladimir Dzhanibekov', + 'Joe Edwards', + 'Donn F. Eisele', + 'Anthony W. England', + 'Joe H. Engle', + 'Apollo 17', + 'Reinhold Ewald', + 'Léopold Eyharts', + 'John Fabian', + 'Muhammed Faris', + 'Bertalan Farkas', + 'Jean-Jacques Favier', + 'Fèi Jùnlóng', + 'Konstantin Feoktistov', + 'Christopher Ferguson', + 'Martin J. Fettman', + 'Andrew J. Feustel', + 'Anatoly Filipchenko', + 'Michael Fincke', + 'John L. Finley', + 'Anna Lee Fisher', + 'William Frederick Fisher', + 'Klaus-Dietrich Flade', + 'Michael Foale', + 'Kevin A. Ford', + 'Michael Foreman', + 'Patrick Forrester', + 'Michael Fossum', + 'Ted Freeman', + 'Stephen Frick', + 'Dirk Frimout', + 'Christer Fuglesang', + 'Charles Fullerton', + 'Reinhard Furrer', + 'Satoshi Furukawa', + 'F. Drew Gaffney', + 'Yuri Gagarin', + 'Ronald Garan', + 'Dale Gardner', + 'Guy Gardner', + 'Marc Garneau', + 'Owen Garriott', + 'Charles Gemar', + 'Michael Gernhardt', + 'Alexander Gerst', + 'Edward Gibson', + 'Robert L. Gibson', + 'Yuri Gidzenko', + 'Ed Givens', + 'Yuri Glazkov', + 'John Glenn', + 'Linda Godwin', + 'Michael T. Good', + 'Viktor Gorbatko', + 'Gemini 11', + 'Dominic Gorie', + 'Ronald Grabe', + 'Duane Graveline', + 'Georgi Grechko', + 'Frederick Gregory', + 'William Gregory', + 'David Griggs', + 'Virgil I. "Gus" Grissom', + 'John Grunsfeld', + 'Aleksei Gubarev', + 'Umberto Guidoni', + 'Zhugderdemidiyn Gurragcha', + 'Sidney Gutierrez', + 'Chris Hadfield', + 'Jean-Pierre Haigneré', + 'Apollo 13', + 'James Halsell', + 'Kenneth Ham', + 'Lloyd Hammond', + 'Jeremy Hansen', + 'Gregory Harbaugh', + 'Bernard A. Harris, Jr.', + 'Terry Hart', + 'Henry Hartsfield', + 'Frederick Hauck', + 'Steven Hawley', + 'Susan Helms', + 'Karl Henize', + 'Thomas Hennen', + 'Terence Henricks', + 'Miroslaw Hermaszewski', + 'José Hernández', + 'John Herrington', + 'Richard Hieb', + 'Joan Higginbotham', + 'David Hilmers', + 'Kathryn Hire', + 'Charles Hobaugh', + 'Jeffrey Hoffman', + 'Donald Holmquest', + 'Michael S. Hopkins', + 'Scott Horowitz', + 'Akihiko Hoshide', + 'Millie Hughes-Fulford', + 'Douglas G. Hurley', + 'Rick Husband', + 'Apollo 15', + 'Aleksandr Ivanchenkov', + 'Anatoli Ivanishin', + 'Georgi Ivanov', + 'Marsha Ivins', + 'Sigmund Jähn', + 'Mae Jemison', + 'Tamara E. Jernigan', + 'Brent W. Jett, Jr.', + 'Jing Haipeng', + 'Gregory C. Johnson', + 'Gregory H. Johnson', + 'Thomas D. Jones', + 'Leonid Kadenyuk', + 'Alexander Kaleri', + 'Janet L. Kavandi', + 'James M. Kelly', + 'Mark Kelly', + 'Scott Kelly', + 'Joseph Kerwin', + 'Yevgeny Khrunov', + 'Robert S. Kimbrough', + 'Leonid Kizim', + 'Petr Klimuk', + 'Pyotr Kolodin', + 'Vladimir Komarov', + 'Yelena Kondakova', + 'Dmitri Kondratyev', + 'Oleg Kononenko', + 'Timothy L. Kopra', + 'Mikhail Korniyenko', + 'Valery Korzun', + 'Oleg Kotov', + 'Vladimir Kovalyonok', + 'Konstantin Kozeyev', + 'Kevin Kregel', + 'Sergei Krikalev', + 'Valeri Kubasov', + 'André Kuipers', + 'Aleksandr Laveykin', + 'Robert Lawrence', + 'Wendy Lawrence', + 'Vasili Lazarev', + 'Aleksandr Lazutkin', + 'Valentin Lebedev', + 'Mark C. Lee', + 'David Leestma', + 'William B. Lenoir', + 'Aleksei Leonov', + 'Frederick W. Leslie', + 'Anatoli Levchenko', + 'Byron Lichtenberg', + 'Don Lind', + 'Steven Lindsey', + 'Jerry Linenger', + 'Richard Linnehan', + 'Gregory Linteris', + 'Liu Boming', + 'Liu Wang', + 'Liu Yang', + 'Yáng Lìwěi', + 'Anthony Llewellyn', + 'Paul Lockhart', + 'Yuri Lonchakov', + 'Michael Lopez-Alegria', + 'Christopher Loria', + 'John Lounge', + 'Jack Lousma', + 'Stanley G. Love', + 'G. David Low', + 'Edward Lu', + 'Shannon Lucid', + 'Vladimir Lyakhov', + 'Steven MacLean', + 'Sandra Magnus', + 'Oleg Makarov', + 'Yuri Malenchenko', + 'Franco Malerba', + 'Yuri Malyshev', + 'Gennadi Manakov', + 'Musa Manarov', + 'Ravish Malhotra', + 'Thomas Marshburn', + 'Michael Massimino', + 'Richard Mastracchio', + 'K. Megan McArthur', + 'William S. McArthur', + 'Jon McBride', + 'Bruce McCandless II', + 'William C. McCool', + 'Michael McCulley', + 'James McDivitt', + 'Donald McMonagle', + 'Ronald McNair', + 'Carl Meade', + 'Bruce Melnick', + 'Pamela Melroy', + 'Leland D. Melvin', + 'Ulf Merbold', + 'Ernst Messerschmid', + 'Dorothy M. Metcalf-Lindenburger', + 'Curt Michel', + 'Aleksandr Misurkin', + 'Apollo 14', + 'Andreas Mogensen', + 'Abdul Ahad Mohmand', + 'Mamoru Mohri', + 'Barbara Morgan', + 'Lee Morin', + 'Boris Morukov', + 'Chiaki Mukai', + 'Richard Mullane', + 'Talgat Musabayev', + 'Story Musgrave', + 'Steven R. Nagel', + 'George Nelson', + 'Grigori Nelyubov', + 'Rodolfo Neri Vela', + 'Paolo A. Nespoli', + 'James H. Newman', + 'Claude Nicollier', + 'Niè Hǎishèng', + 'Andriyan Nikolayev', + 'Soichi Noguchi', + 'Carlos I. Noriega', + 'Oleg Novitskiy', + 'Lisa Nowak', + 'Karen Nyberg', + 'Bryan O\'Connor', + 'Ellen Ochoa', + 'Wubbo Ockels', + 'William Oefelein', + 'Brian O\'Leary', + 'John D. Olivas', + 'Takuya Onishi', + 'Ellison Onizuka', + 'Yuri Onufrienko', + 'Stephen Oswald', + 'Robert Overmyer', + 'Gennady Padalka', + 'William Pailes', + 'Scott Parazynski', + 'Ronald A. Parise', + 'Robert Parker', + 'Luca Parmitano', + 'Nicholas Patrick', + 'Viktor Patsayev', + 'James Pawelczyk', + 'Julie Payette', + 'Gary Payton', + 'Timothy Peake', + 'Philippe Perrin', + 'Thomas Pesquet', + 'Donald Peterson', + 'Donald Pettit', + 'Pham Tuan', + 'John Phillips', + 'William Pogue', + 'Alan G. Poindexter', + 'Mark Polansky', + 'Alexander Poleshchuk', + 'Valeri Polyakov', + 'Marcos Pontes', + 'Leonid Popov', + 'Pavel Popovich', + 'Charles Precourt', + 'Dumitru Prunariu', + 'Ilan Ramon', + 'William Readdy', + 'Kenneth Reightler', + 'James F. Reilly', + 'Garrett Reisman', + 'Thomas Reiter', + 'Vladimír Remek', + 'Judith Resnik', + 'Sergei Revin', + 'Paul W. Richards', + 'Richard N. Richards', + 'Sally Ride', + 'Patricia Robertson', + 'Stephen Robinson', + 'Russell L. Rogers', + 'Roman Romanenko', + 'Yuri Romanenko', + 'Kent Rominger', + 'Jerry L. Ross', + 'Valery Rozhdestvensky', + 'Nikolay Rukavishnikov', + 'Mario Runco, Jr.', + 'Sergei Ryazanski', + 'Valery Ryumin', + 'Albert Sacco', + 'David Saint-Jacques', + 'Aleksandr Samokutyayev', + 'Gennadi Sarafanov', + 'Robert Satcher', + 'Sultan bin Salman bin Abdulaziz Al Saud', + 'Viktor Savinykh', + 'Svetlana Savitskaya', + 'Wally Schirra', + 'Hans Schlegel', + 'Rusty Schweickart', + 'Dick Scobee', + 'Winston Scott', + 'Paul Scully-Power', + 'Richard Searfoss', + 'Rhea Seddon', + 'Elliot See', + 'Ronald Sega', + 'Piers Sellers', + 'Aleksandr Serebrov', + 'Vitali Sevastyanov', + 'Yuri Shargin', + 'Salizhan Sharipov', + 'Rakesh Sharma', + 'Vladimir Shatalov', + 'Brewster Shaw', + 'Mercury-Redstone 3', + 'William Shepherd', + 'Nancy Currie', + 'Anton Shkaplerov', + 'Georgi Shonin', + 'Loren Shriver', + 'Sheikh Muszaphar Shukor', + 'Oleg Skripochka', + 'Aleksandr Skvortsov', + 'Donald "Deke" Slayton', + 'Michael J. Smith', + 'Steven Smith', + 'Anatoly Solovyev', + 'Vladimir Solovyov', + 'Voskhod 1', + 'Sherwood Spring', + 'Robert Springer', + 'Gemini 6A', + 'Heidemarie Stefanyshyn-Piper', + 'Robert Stewart', + 'Susan Still Kilrain', + 'Nicole Marie Passonno Stott', + 'Krasimir Stoyanov', + 'Gennady Strekalov', + 'Frederick Sturckow', + 'Kathryn Sullivan', + 'Maksim Surayev', + 'Steven Swanson', + 'Arnaldo Tamayo Méndez', + 'Daniel Tani', + 'Joseph Tanner', + 'Evgeny Tarelkin', + 'MOL', + 'Valentina Tereshkova', + 'Norman Thagard', + 'Gerhard Thiele', + 'Robert Thirsk', + 'Andrew Thomas', + 'Donald Thomas', + 'Stephen Thorne', + 'Kathryn Thornton', + 'William E. Thornton', + 'Pierre Thuot', + 'Gherman Titov', + 'Vladimir Titov', + 'Michel Tognini', + 'Valery Tokarev', + 'Sergei Treshchov', + 'Eugene Trinh', + 'Richard Truly', + 'Bjarni Tryggvason', + 'Vasili Tsibliyev', + 'Mikhail Tyurin', + 'Yury Usachov', + 'Lodewijk van den Berg', + 'James "Ox" van Hoften', + 'Vladimir Vasyutin', + 'Charles Veach', + 'Franz Viehböck', + 'Alexander Viktorenko', + 'Pavel Vinogradov', + 'Terry Virts', + 'Roberto Vittori', + 'Igor Volk', + 'Alexander Volkov', + 'Sergey Volkov', + 'Vladislav Volkov', + 'Boris Volynov', + 'James Voss', + 'Janice Voss', + 'Koichi Wakata', + 'Rex Walheim', + 'Charles D. Walker', + 'David M. Walker', + 'Joseph A. Walker', + 'Shannon Walker', + 'Ulrich Walter', + 'Carl Walz', + 'Taylor Wang', + 'Wang Yaping', + 'Mary Weber', + 'Paul Weitz', + 'James Wetherbee', + 'Douglas Wheelock', + 'Edward White', + 'Peggy Whitson', + 'Terrence Wilcutt', + 'Clifton Williams', + 'Dafydd Williams', + 'Donald Williams', + 'Jeffrey Williams', + 'Sunita "Suni" Williams', + 'Barry Wilmore', + 'Stephanie Wilson', + 'Peter Wisoff', + 'David Wolf', + 'Neil Woodward', + 'Naoko Yamazaki', + 'Boris Yegorov', + 'Aleksei Yeliseyev', + 'Yi So-yeon', + 'Gemini 3', + 'Kimiya Yui', + 'Fyodor Yurchikhin', + 'Sergei Zalyotin', + 'George D. Zamka', + 'Zhai Zhigang', + 'Zhang Xiaoguang', + 'Vitaliy Zholobov', + 'Vyacheslav Zudov' +]; diff --git a/scripts/generate/logs/samples/countries.js b/scripts/generate/logs/samples/countries.js new file mode 100644 index 000000000..d158da110 --- /dev/null +++ b/scripts/generate/logs/samples/countries.js @@ -0,0 +1,250 @@ +module.exports = { + 'CN': 1330044000, + 'IN': 1173108018, + 'US': 610232863, + 'ID': 242968342, + 'BR': 201103330, + 'PK': 184404791, + 'BD': 156118464, + 'NG': 154000000, + 'RU': 140702000, + 'JP': 127288000, + 'MX': 112468855, + 'PH': 99900177, + 'VN': 89571130, + 'ET': 88013491, + 'DE': 81802257, + 'EG': 80471869, + 'TR': 77804122, + 'IR': 76923300, + 'CD': 70916439, + 'TH': 67089500, + 'FR': 64768389, + 'GB': 62348447, + 'IT': 60340328, + 'MM': 53414374, + 'ZA': 49000000, + 'KR': 48422644, + 'ES': 46505963, + 'UA': 45415596, + 'CO': 44205293, + 'TZ': 41892895, + 'AR': 41343201, + 'KE': 40046566, + 'PL': 38500000, + 'SD': 35000000, + 'DZ': 34586184, + 'CA': 33679000, + 'UG': 33398682, + 'MA': 31627428, + 'PE': 29907003, + 'IQ': 29671605, + 'AF': 29121286, + 'NP': 28951852, + 'MY': 28274729, + 'UZ': 27865738, + 'VE': 27223228, + 'SA': 25731776, + 'GH': 24339838, + 'YE': 23495361, + 'KP': 22912177, + 'TW': 22894384, + 'SY': 22198110, + 'MZ': 22061451, + 'RO': 21959278, + 'AU': 21515754, + 'LK': 21513990, + 'MG': 21281844, + 'CI': 21058798, + 'CM': 19294149, + 'CL': 16746491, + 'NL': 16645000, + 'BF': 16241811, + 'NE': 15878271, + 'MW': 15447500, + 'KZ': 15340000, + 'EC': 14790608, + 'KH': 14453680, + 'ML': 13796354, + 'GT': 13550440, + 'ZM': 13460305, + 'AO': 13068161, + 'SN': 12323252, + 'ZW': 11651858, + 'CU': 11423000, + 'RW': 11055976, + 'GR': 11000000, + 'CS': 10829175, + 'PT': 10676000, + 'TN': 10589025, + 'TD': 10543464, + 'CZ': 10476000, + 'BE': 10403000, + 'GN': 10324025, + 'SO': 10112453, + 'BO': 9947418, + 'HU': 9930000, + 'BI': 9863117, + 'DO': 9823821, + 'BY': 9685000, + 'HT': 9648924, + 'BJ': 9056010, + 'SE': 9045000, + 'AZ': 8303512, + 'SS': 8260490, + 'AT': 8205000, + 'HN': 7989415, + 'CH': 7581000, + 'TJ': 7487489, + 'IL': 7353985, + 'RS': 7344847, + 'BG': 7148785, + 'HK': 6898686, + 'TG': 6587239, + 'LY': 6461454, + 'JO': 6407085, + 'PY': 6375830, + 'LA': 6368162, + 'PG': 6064515, + 'SV': 6052064, + 'NI': 5995928, + 'ER': 5792984, + 'KG': 5508626, + 'DK': 5484000, + 'SK': 5455000, + 'SL': 5245695, + 'FI': 5244000, + 'NO': 5009150, + 'AE': 4975593, + 'TM': 4940916, + 'CF': 4844927, + 'SG': 4701069, + 'GE': 4630000, + 'IE': 4622917, + 'BA': 4590000, + 'CR': 4516220, + 'HR': 4491000, + 'MD': 4324000, + 'NZ': 4252277, + 'LB': 4125247, + 'PR': 3916632, + 'PS': 3800000, + 'LR': 3685076, + 'LT': 3565000, + 'UY': 3477000, + 'PA': 3410676, + 'MR': 3205060, + 'MN': 3086918, + 'CG': 3039126, + 'AL': 2986952, + 'AM': 2968000, + 'OM': 2967717, + 'JM': 2847232, + 'KW': 2789132, + 'LV': 2217969, + 'NA': 2128471, + 'MK': 2061000, + 'BW': 2029307, + 'SI': 2007000, + 'LS': 1919552, + 'XK': 1800000, + 'GM': 1593256, + 'GW': 1565126, + 'GA': 1545255, + 'SZ': 1354051, + 'MU': 1294104, + 'EE': 1291170, + 'TT': 1228691, + 'TL': 1154625, + 'CY': 1102677, + 'GQ': 1014999, + 'FJ': 875983, + 'QA': 840926, + 'RE': 776948, + 'KM': 773407, + 'GY': 748486, + 'DJ': 740528, + 'BH': 738004, + 'BT': 699847, + 'ME': 666730, + 'SB': 559198, + 'CV': 508659, + 'LU': 497538, + 'SR': 492829, + 'MO': 449198, + 'GP': 443000, + 'MQ': 432900, + 'MT': 403000, + 'MV': 395650, + 'BN': 395027, + 'BZ': 314522, + 'IS': 308910, + 'BS': 301790, + 'BB': 285653, + 'EH': 273008, + 'PF': 270485, + 'VU': 221552, + 'NC': 216494, + 'GF': 195506, + 'WS': 192001, + 'ST': 175808, + 'LC': 160922, + 'GU': 159358, + 'YT': 159042, + 'CW': 141766, + 'AN': 136197, + 'TO': 122580, + 'VI': 108708, + 'GD': 107818, + 'FM': 107708, + 'VC': 104217, + 'KI': 92533, + 'JE': 90812, + 'SC': 88340, + 'AG': 86754, + 'AD': 84000, + 'IM': 75049, + 'DM': 72813, + 'AW': 71566, + 'MH': 65859, + 'BM': 65365, + 'GG': 65228, + 'AS': 57881, + 'GL': 56375, + 'MP': 53883, + 'KN': 49898, + 'FO': 48228, + 'KY': 44270, + 'SX': 37429, + 'MF': 35925, + 'LI': 35000, + 'MC': 32965, + 'SM': 31477, + 'GI': 27884, + 'AX': 26711, + 'VG': 21730, + 'CK': 21388, + 'TC': 20556, + 'PW': 19907, + 'BQ': 18012, + 'WF': 16025, + 'AI': 13254, + 'TV': 10472, + 'NR': 10065, + 'MS': 9341, + 'BL': 8450, + 'SH': 7460, + 'PM': 7012, + 'IO': 4000, + 'FK': 2638, + 'SJ': 2550, + 'NU': 2166, + 'NF': 1828, + 'CX': 1500, + 'TK': 1466, + 'VA': 921, + 'CC': 628, + 'TF': 140, + 'PN': 46, + 'GS': 30 +}; diff --git a/scripts/generate/logs/samples/index.js b/scripts/generate/logs/samples/index.js new file mode 100644 index 000000000..be6fda1bd --- /dev/null +++ b/scripts/generate/logs/samples/index.js @@ -0,0 +1,93 @@ +var _ = require('../../../../src/lib/utils'), + WeightedList = require('./weighted_list'), + RandomList = require('./random_list'), + IpGenerator = require('./ip_generator'), + Stochator = require('./stochator'), + moment = require('moment'), + dayMs = 86400000; + +exports.make = function (startingMoment, endingMoment) { + + var sets = {}; + + sets.randomMsInDayRange = new Stochator({ + min: startingMoment.toDate().getTime(), + max: endingMoment.toDate().getTime() + }, 'get'); + + sets.lessRandomRespSize = new Stochator({ + mean: 4500, + stddev: 4500 * 0.56, + min: 1500, + max: 10000 + }, 'get'); + + sets.lessRandomMsInDay = new Stochator({ + min: 0, + max: dayMs, + mean: dayMs / 2, + stdev: dayMs * 0.15, + }, 'get'); + + sets.astronauts = new RandomList(require('./astronauts').map(function (name) { + return name.replace(/\W+/g, '-').toLowerCase(); + })); + + sets.airports = new RandomList(require('./airports')); + + sets.ips = new IpGenerator(100, 1000); + + sets.countries = new WeightedList(require('./countries')); + + sets.extensions = new WeightedList({ + 'html': 40, + 'php': 30, + 'png': 15, + 'gif': 5, + 'css': 10 + }); + + sets.responseCodes = new WeightedList({ + 200: 92, + 404: 5, + 503: 3 + }); + + sets.tags = new WeightedList({ + 'error': 6, + 'warning': 10, + 'success': 84 + }); + + sets.tags2 = new WeightedList({ + 'security': 20, + 'info': 75, + 'login': 5 + }); + + sets.timezones = new WeightedList({ + '-07:00': 1 + }); + + sets.referrers = new WeightedList({ + 'www.slate.com': 50, + 'twitter.com': 35, + 'facebook.com': 20, + 'nytimes.com': 10 + }); + + sets.userAgents = new WeightedList({ + 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)': 30, + 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24': 35, + 'Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1': 40 + }); + + sets.types = new WeightedList({ + 'nginx': 1, + 'apache': 4 + }); + + return _.map(sets, function (set, name) { + return _.bindKey(set, 'get'); + }); +}; diff --git a/scripts/generate/logs/samples/ip_generator.js b/scripts/generate/logs/samples/ip_generator.js new file mode 100644 index 000000000..d57a1eeb0 --- /dev/null +++ b/scripts/generate/logs/samples/ip_generator.js @@ -0,0 +1,36 @@ +module.exports = IpGenerator; + +var _ = require('../../../../src/lib/utils'); + +function IpGenerator(maxCount, maxSessions) { + this.maxSessions = maxSessions; + this.maxCount = maxCount; + + this.sessions = []; +} + +IpGenerator.prototype.get = function () { + var session, index; + if (this.sessions.length < this.maxSessions) { + session = [this.makeRandom(), 0]; + index = this.sessions.length; + this.sessions.push(session); + } else { + index = _.random(0, this.sessions.length - 1); + session = this.sessions[index]; + } + + if (session[1] > this.maxCount) { + this.sessions.splice(index, 1); + return this.getIp(); + } else { + return session[0]; + } +}; + +IpGenerator.prototype.makeRandom = function () { + return _.random(0, 255) + '.' + + _.random(0, 255) + '.' + + _.random(0, 255) + '.' + + _.random(0, 255); +}; diff --git a/scripts/generate/logs/samples/random_list.js b/scripts/generate/logs/samples/random_list.js new file mode 100644 index 000000000..0f298c9dc --- /dev/null +++ b/scripts/generate/logs/samples/random_list.js @@ -0,0 +1,13 @@ +/** + * @class RandomList + */ + +module.exports = RandomList; + +var _ = require('../../../../src/lib/utils'); + +function RandomList(list) { + this.get = function () { + return list[Math.round(Math.random() * list.length)]; + }; +} diff --git a/scripts/generate/logs/samples/stochator.js b/scripts/generate/logs/samples/stochator.js new file mode 100644 index 000000000..3c6a031d3 --- /dev/null +++ b/scripts/generate/logs/samples/stochator.js @@ -0,0 +1,464 @@ +(function() { + var Set, Stochator, callFunctions, floatGenerator, integerGenerator, inverseNormalCumulativeDistribution, isType, randomBoundedFloat, randomBoundedInteger, randomCharacter, randomColor, randomNormallyDistributedFloat, randomSetMember, randomSetMemberWithoutReplacement, randomWeightedSetMember, setGenerator, shuffleSet, + __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, + __slice = Array.prototype.slice; + + Set = (function() { + + function Set(values) { + this.values = values; + this.length = this.values.length; + } + + Set.prototype.toString = function() { + return "[object Set]"; + }; + + Set.prototype.copy = function() { + return this.values.slice(0, this.length); + }; + + Set.prototype.enumerate = function(depth) { + var d, digits, e, enumeration, enumerations, enumerationsLength, i; + if (depth == null) depth = this.length; + enumerationsLength = Math.pow(this.length, depth); + enumerations = []; + for (enumeration = 0; 0 <= enumerationsLength ? enumeration < enumerationsLength : enumeration > enumerationsLength; 0 <= enumerationsLength ? enumeration++ : enumeration--) { + e = enumeration; + digits = []; + for (i = 0; 0 <= depth ? i < depth : i > depth; 0 <= depth ? i++ : i--) { + d = e % this.length; + e -= d; + e /= this.length; + digits.push(this.values[d]); + } + enumerations.push(new Set(digits)); + } + return new Set(enumerations); + }; + + Set.prototype.intersection = function(set) { + var value; + return new Set((function() { + var _i, _len, _ref, _results; + _ref = set.values; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + value = _ref[_i]; + if (__indexOf.call(this.values, value) >= 0) _results.push(value); + } + return _results; + }).call(this)); + }; + + Set.prototype.union = function(set) { + return new Set(this.values.concat(this.difference(set).values)); + }; + + Set.prototype.difference = function(set) { + var value; + return new Set((function() { + var _i, _len, _ref, _results; + _ref = set.values; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + value = _ref[_i]; + if (!(__indexOf.call(this.values, value) >= 0)) _results.push(value); + } + return _results; + }).call(this)); + }; + + Set.prototype.symmetricDifference = function(set) { + return this.union(set).difference(this.intersection(set)); + }; + + Set.prototype.reduce = function(iterator) { + return this.values.reduce(iterator); + }; + + Set.prototype.reverse = function() { + return new Set(this.copy().reverse()); + }; + + Set.prototype.sort = function(compare) { + return this.copy().sort(compare); + }; + + Set.prototype.sum = function() { + var _ref; + return (_ref = this._sum) != null ? _ref : this._sum = this.reduce(function(a, b) { + return a + b; + }); + }; + + Set.prototype.mean = function() { + var _ref; + return (_ref = this._mean) != null ? _ref : this._mean = this.sum() / this.length; + }; + + Set.prototype.stdev = function() { + var value, _ref; + return (_ref = this._stdev) != null ? _ref : this._stdev = Math.sqrt(new Set((function() { + var _i, _len, _ref2, _results; + _ref2 = this.values; + _results = []; + for (_i = 0, _len = _ref2.length; _i < _len; _i++) { + value = _ref2[_i]; + _results.push(Math.pow(value - this.mean(), 2)); + } + return _results; + }).call(this)).mean()); + }; + + Set.prototype.get = function(index, dflt) { + if (this.values[index] != null) { + return this.values[index]; + } else { + return dflt; + } + }; + + Set.prototype.each = function(iterator) { + var index, value, _len, _ref, _results; + _ref = this.values; + _results = []; + for (index = 0, _len = _ref.length; index < _len; index++) { + value = _ref[index]; + _results.push(iterator(value, index)); + } + return _results; + }; + + Set.prototype.map = function(iterator) { + var index, value; + return new Set((function() { + var _len, _ref, _results; + _ref = this.values; + _results = []; + for (index = 0, _len = _ref.length; index < _len; index++) { + value = _ref[index]; + _results.push(iterator(value, index)); + } + return _results; + }).call(this)); + }; + + Set.prototype.pop = function(index) { + var value; + if (index == null) index = this.length - 1; + value = this.values[index]; + this.values.splice(index, 1); + return value; + }; + + return Set; + + })(); + + isType = function(type) { + return function(arg) { + return Object.prototype.toString.call(arg) === ("[object " + type + "]"); + }; + }; + + callFunctions = function(fns) { + var fn, _i, _len, _results; + _results = []; + for (_i = 0, _len = fns.length; _i < _len; _i++) { + fn = fns[_i]; + _results.push(fn()); + } + return _results; + }; + + randomBoundedFloat = function(min, max) { + var spread; + if (min == null) min = 0; + if (max == null) max = 1; + spread = max - min; + return Math.random() * spread + min; + }; + + randomBoundedInteger = function(min, max) { + var spread; + if (min == null) min = 0; + if (max == null) max = 1; + spread = 1 + max - min; + return Math.floor(Math.random() * spread) + min; + }; + + randomColor = function() { + var byte, mutator; + byte = { + kind: "integer", + min: 0, + max: 255 + }; + mutator = function(bytes) { + var blue, green, red; + red = bytes[0], green = bytes[1], blue = bytes[2]; + return { + red: red, + green: green, + blue: blue + }; + }; + return new Stochator(byte, byte, byte, mutator).next; + }; + + randomNormallyDistributedFloat = function(mean, stdev, min, max) { + var float, seed; + seed = randomBoundedFloat(); + float = inverseNormalCumulativeDistribution(seed) * stdev + mean; + if ((min != null) && (max != null)) { + return Math.min(max, Math.max(min, float)); + } else { + return float; + } + }; + + randomCharacter = function(lowercase) { + var max, min, mutator, _ref; + _ref = lowercase ? [97, 122] : [65, 90], min = _ref[0], max = _ref[1]; + mutator = function(charCode) { + return String.fromCharCode(charCode); + }; + return new Stochator({ + kind: "integer", + min: min, + max: max + }, mutator).next; + }; + + randomSetMember = function(set) { + var max; + max = set.length - 1; + return set.get(randomBoundedInteger(0, max)); + }; + + randomSetMemberWithoutReplacement = function(set) { + if (!set.get(0)) return; + set.length -= 1; + return set.pop(randomBoundedInteger(0, set.length)); + }; + + randomWeightedSetMember = function(set, weights) { + var float, member, weightSum, _ref; + _ref = [void 0, 0, randomBoundedFloat()], member = _ref[0], weightSum = _ref[1], float = _ref[2]; + set.each(function(value, index) { + var weight; + if (member) return; + weight = weights.get(index); + if (float <= weightSum + weight && float >= weightSum) member = value; + return weightSum += weight; + }); + return member; + }; + + inverseNormalCumulativeDistribution = function(probability) { + var base, coefficient, denomCoeffcients, denomMaxExponent, denominator, high, low, mapMaxExp, numCoefficients, numMaxExponent, numerator, _ref, _ref2; + high = probability > 0.97575; + low = probability < 0.02425; + if (low || high) { + numCoefficients = new Set([-7.784894002430293e-3, -3.223964580411365e-1, -2.400758277161838, -2.549732539343734, 4.374664141464968]); + denomCoeffcients = new Set([7.784695709041462e-3, 3.224671290700398e-1, 2.445134137142996, 3.754408661907416]); + _ref = [5, 4], numMaxExponent = _ref[0], denomMaxExponent = _ref[1]; + coefficient = low ? 1 : -1; + base = Math.sqrt(-2 * Math.log(low ? probability : 1 - probability)); + } else { + numCoefficients = new Set([-3.969683028665376e1, 2.209460984245205e2, -2.759285104469687e2, 1.383577518672690e2, -3.066479806614716e1, 2.506628277459239]); + denomCoeffcients = new Set([-5.447609879822406e1, 1.615858368580409e2, -1.556989798598866e2, 6.680131188771972e1, -1.328068155288572e1]); + _ref2 = [5, 5], numMaxExponent = _ref2[0], denomMaxExponent = _ref2[1]; + coefficient = probability - 0.5; + base = Math.pow(coefficient, 2); + } + mapMaxExp = function(maxExp) { + return function(value, index) { + return value * Math.pow(base, maxExp - index); + }; + }; + numerator = numCoefficients.map(mapMaxExp(numMaxExponent)).sum(); + denominator = denomCoeffcients.map(mapMaxExp(denomMaxExponent)).sum() + 1; + return coefficient * numerator / denominator; + }; + + shuffleSet = function(set) { + var index, randomIndex, tmp, values, _ref; + values = set.copy(); + for (index = _ref = values.length - 1; _ref <= 0 ? index < 0 : index > 0; _ref <= 0 ? index++ : index--) { + randomIndex = randomBoundedInteger(0, index); + tmp = values[index]; + values[index] = values[randomIndex]; + values[randomIndex] = tmp; + } + return values; + }; + + floatGenerator = function(min, max, mean, stdev) { + if (mean && stdev) { + return function() { + return randomNormallyDistributedFloat(mean, stdev, min, max); + }; + } else { + return function() { + return randomBoundedFloat(min, max); + }; + } + }; + + integerGenerator = function(min, max) { + if (min == null) min = 0; + if (max == null) max = 1; + return function() { + return randomBoundedInteger(min, max); + }; + }; + + setGenerator = function(values, replacement, shuffle, weights) { + var set, weightsSet; + if (replacement == null) replacement = true; + if (shuffle == null) shuffle = false; + if (weights == null) weights = null; + if (!values || !values.length) { + throw Error("Must provide a 'values' array for a set generator."); + } + set = new Set(values); + if (shuffle) { + return function() { + return shuffleSet(set); + }; + } else if (replacement) { + if (weights) { + weightsSet = new Set(weights); + return function() { + return randomWeightedSetMember(set, weightsSet); + }; + } else { + return function() { + return randomSetMember(set); + }; + } + } else { + return function() { + return randomSetMemberWithoutReplacement(set); + }; + } + }; + + Stochator = (function() { + var VERSION; + + VERSION = "0.3.1"; + + function Stochator() { + var configs; + configs = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + this.setGenerator(configs); + } + + Stochator.prototype.createGenerator = function(config) { + var generator, max, mean, min, replacement, shuffle, stdev, values, weights; + if (config.kind == null) config.kind = "float"; + generator = (function() { + switch (config.kind) { + case "float": + min = config.min, max = config.max, mean = config.mean, stdev = config.stdev; + return floatGenerator(min, max, mean, stdev); + case "integer": + return integerGenerator(config.min, config.max); + case "set": + values = config.values, replacement = config.replacement, shuffle = config.shuffle, weights = config.weights; + return setGenerator(values, replacement, shuffle, weights); + case "color": + case "rgb": + return randomColor(config.kind); + case "a-z": + case "A-Z": + return randomCharacter(config.kind === "a-z"); + } + })(); + if (!generator) { + throw Error("" + config.kind + " not a recognized kind."); + } else { + return generator; + } + }; + + Stochator.prototype.createGenerators = function(configs, mutator) { + var callGenerators, caller, config, generators, + _this = this; + if (configs[0] == null) configs[0] = {}; + generators = (function() { + var _i, _len, _results; + _results = []; + for (_i = 0, _len = configs.length; _i < _len; _i++) { + config = configs[_i]; + _results.push(this.createGenerator(config)); + } + return _results; + }).call(this); + if (!mutator) { + callGenerators = generators.length === 1 ? function() { + return callFunctions(generators)[0]; + } : function() { + return callFunctions(generators); + }; + } else { + caller = generators.length === 1 ? function() { + return callFunctions(generators)[0]; + } : function() { + return callFunctions(generators); + }; + callGenerators = function() { + return _this.value = mutator.call(_this, caller(), _this.value); + }; + } + return function(times) { + var time, _results; + if (times) { + _results = []; + for (time = 1; 1 <= times ? time <= times : time >= times; 1 <= times ? time++ : time--) { + _results.push(callGenerators()); + } + return _results; + } else { + return callGenerators(); + } + }; + }; + + Stochator.prototype.setGenerator = function(configs) { + var config, generatorConfigs, mutator, name, _i, _len, _ref, _ref2; + generatorConfigs = []; + for (_i = 0, _len = configs.length; _i < _len; _i++) { + config = configs[_i]; + if (isType("Object")(config)) { + generatorConfigs.push(config); + } else { + break; + } + } + _ref = configs.slice(generatorConfigs.length), name = _ref[0], mutator = _ref[1]; + name || (name = "next"); + if (isType("Function")(name)) { + _ref2 = ["next", name], name = _ref2[0], mutator = _ref2[1]; + } + return this[name] = this.createGenerators(generatorConfigs, mutator); + }; + + Stochator.prototype.toString = function() { + return "[object Stochator]"; + }; + + return Stochator; + + })(); + + if (typeof module !== "undefined" && module !== null ? module.exports : void 0) { + module.exports = Stochator; + } else { + this.Stochator = Stochator; + } + +}).call(this); diff --git a/scripts/generate/logs/samples/weighted_list.js b/scripts/generate/logs/samples/weighted_list.js new file mode 100644 index 000000000..ca8cd29fd --- /dev/null +++ b/scripts/generate/logs/samples/weighted_list.js @@ -0,0 +1,121 @@ +/** + * @class WeightedList + * @constructor + */ + +module.exports = WeightedList; + +var _ = require('../../../../src/lib/utils'); + +function WeightedList(list) { + WeightedList.callSuper(this, arguments); + _.forEach(list, _.bindKey(this, 'push')); +} +_.inherits(WeightedList, Array); + +/** + * Add a value to the weighted list. + * @method add + * @param {Any} value + * @param {Number} [weight] Optional. Defaults to 1. + * @return {Number} The index of the item that was added. + */ +WeightedList.prototype.push = function (weight, value) { + if (!weight && weight !== 0) { + weight = 1; + } + + Array.prototype.push.call(this, { + value: value, + weight: weight + }); + + delete this._sum; + delete this._totals; + + return this.length - 1; +}; + +WeightedList.prototype.get = function () { + return this[this._randomIndex()].value; +}; + +/** + * Returns an index by weighted random distribution. + * @method _randomIndex + * @protected + * @return {Number} + */ +WeightedList.prototype._randomIndex = function () { + var maximumIndex, + me = this, + middleIndex, + minimumIndex = 0, + random, + sum = me._sum, + total, + totals = me._totals; + + if (!sum || !totals) { + me._update(); + + sum = me._sum; + totals = me._totals; + + if (!sum || !totals || !totals.length) { + return null; + } + } + + maximumIndex = totals.length - 1; + random = Math.random() * sum; + + while (maximumIndex >= minimumIndex) { + middleIndex = (maximumIndex + minimumIndex) / 2; + + if (middleIndex < 0) { + middleIndex = 0; + } else { + middleIndex = Math.floor(middleIndex); + } + + total = totals[middleIndex]; + + if (random === total) { + middleIndex += 1; + break; + } else if (random < total) { + if (middleIndex && random > totals[middleIndex - 1]) { + break; + } + + maximumIndex = middleIndex - 1; + } else if (random > total) { + minimumIndex = middleIndex + 1; + } + } + + return middleIndex; +}; + +/** + * Updates chached data for achieving weighted random distribution. + * @method _update + * @chainable + * @protected + */ +WeightedList.prototype._update = function () { + var me = this, + sum = 0, + totals = []; + + _.each(me, function (item) { + sum += item.weight; + totals.push(sum); + }); + + me._sum = sum; + me._totals = totals; + + return me; +}; diff --git a/scripts/generate_js_api/notes.js b/scripts/generate_js_api/notes.js deleted file mode 100644 index 3e26a4e22..000000000 --- a/scripts/generate_js_api/notes.js +++ /dev/null @@ -1,2 +0,0 @@ -exports['cluster.node_info'] = - '//TODO: this enpoint ***needs*** work, many of the possible urls are not supported'; \ No newline at end of file diff --git a/scripts/scratch.js b/scripts/scratch.js deleted file mode 100644 index 533cc8f1d..000000000 --- a/scripts/scratch.js +++ /dev/null @@ -1,10 +0,0 @@ -var elasticsearch = require('../src/elasticsearch') - , EventEmitter = require('events').EventEmitter; - -var client = new elasticsearch.Client({ - logger: 'trace' -}); - -console.log(EventEmitter.listenerCount(client.log, 'trace')); - -client.cluster.node_stats(); \ No newline at end of file diff --git a/scripts/server.js b/scripts/server.js new file mode 100644 index 000000000..7d87bf89c --- /dev/null +++ b/scripts/server.js @@ -0,0 +1,29 @@ +var http = require('http'), + async = require('async'); + +var server = http.createServer(function (req, resp) { + var closed, count = 0; + + resp.on('close', function () { + closed = true; + console.log('response was closed'); + }); + + process.removeAllListeners(); + + var interval = setInterval(function () { + if (count > 99 || resp.closed || closed) { + clearInterval(interval); + console.log('done writing', resp.socket.bytesWritten, 'bytes'); + resp.end(); + } else { + process.stdout.write('->'); + resp.write('line of data, more to come... slowly!'); + count++; + } + }, 100); +}); + +server.listen(7500, function () { + console.log('server listening at', server.address()); +}); diff --git a/src/api/bulk.js b/src/api/bulk.js index 0dffeea76..f1611d7ca 100644 --- a/src/api/bulk.js +++ b/src/api/bulk.js @@ -1,11 +1,11 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var consistencyOptions = ['one', 'quorum', 'all']; var replicationOptions = ['sync', 'async']; - - /** * Perform an elasticsearch [bulk](http://elasticsearch.org/guide/reference/api/bulk/) request * @@ -17,57 +17,57 @@ var replicationOptions = ['sync', 'async']; * @param {String} [params.replication=sync] - Explicitely set the replication type * @param {string} params.type - Default document type for items which don't provide one */ -function doBulk(params, callback) { +function doBulk(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: paramHelper.bulkBody(params.body, this.client.serializer) || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'post' || params.method === 'put') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'POST' || params.method === 'PUT') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of post, put'); + throw new TypeError('Invalid method: should be one of POST, PUT'); } } else { - request.method = 'post'; + request.method = 'POST'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } } - + if (typeof params.type !== 'undefined') { if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_bulk'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_bulk'; delete params.type; } - else if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_bulk'; + else if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_bulk'; } else { - request.url = '/_bulk'; + request.path = '/_bulk'; } - + // build the query string if (typeof params.consistency !== 'undefined') { @@ -80,7 +80,7 @@ function doBulk(params, callback) { ); } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -90,7 +90,7 @@ function doBulk(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params.replication !== 'undefined') { if (_.contains(replicationOptions, params.replication)) { query.replication = params.replication; @@ -101,7 +101,7 @@ function doBulk(params, callback) { ); } } - + if (typeof params.type !== 'undefined') { if (typeof params.type !== 'object' && params.type) { query.type = '' + params.type; @@ -109,14 +109,10 @@ function doBulk(params, callback) { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doBulk; diff --git a/src/api/clear_scroll.js b/src/api/clear_scroll.js index f91a5d8bd..4a35b8931 100644 --- a/src/api/clear_scroll.js +++ b/src/api/clear_scroll.js @@ -1,7 +1,7 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); - - +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [clear_scroll](http://www.elasticsearch.org/guide/reference/api/search/scroll/) request @@ -10,55 +10,51 @@ var _ = require('../lib/toolbelt') * @method clear_scroll * @param {Object} params - An object with parameters used to carry out this action */ -function doClearScroll(params, callback) { +function doClearScroll(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'delete'; - // find the url's params + request.method = 'DELETE'; + + // find the paths's params if (typeof params.scroll_id !== 'undefined') { switch (typeof params.scroll_id) { case 'string': - url.scroll_id = params.scroll_id; + parts.scroll_id = params.scroll_id; break; case 'object': if (_.isArray(params.scroll_id)) { - url.scroll_id = params.scroll_id.join(','); + parts.scroll_id = params.scroll_id.join(','); } else { throw new TypeError('Invalid scroll_id: ' + params.scroll_id + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.scroll_id = !!params.scroll_id; + parts.scroll_id = !!params.scroll_id; } } - - // build the url - if (url.hasOwnProperty('scroll_id')) { - request.url = '/_search/scroll/' + encodeURIComponent(url.scroll_id) + ''; + + // build the path + if (parts.hasOwnProperty('scroll_id')) { + request.path = '/_search/scroll/' + encodeURIComponent(parts.scroll_id) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string - request.url = request.url + _.makeQueryString(query); + request.path = request.path + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + this.client.request(request, cb); } module.exports = doClearScroll; diff --git a/src/api/cluster/get_settings.js b/src/api/cluster/get_settings.js index dcd81ce51..794131a9e 100644 --- a/src/api/cluster/get_settings.js +++ b/src/api/cluster/get_settings.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [cluster.get_settings](http://elasticsearch.org/guide/reference/api/admin-cluster-update-settings/) request @@ -10,34 +10,30 @@ var _ = require('../../lib/toolbelt') * @method cluster.get_settings * @param {Object} params - An object with parameters used to carry out this action */ -function doClusterGetSettings(params, callback) { +function doClusterGetSettings(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params - // build the url - request.url = '/_cluster/settings'; - + // build the path + request.path = '/_cluster/settings'; + // build the query string - request.url = request.url + _.makeQueryString(query); + request.path = request.path + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + this.client.request(request, cb); } module.exports = doClusterGetSettings; diff --git a/src/api/cluster/health.js b/src/api/cluster/health.js index 86ce0e63e..8007eed7f 100644 --- a/src/api/cluster/health.js +++ b/src/api/cluster/health.js @@ -1,11 +1,11 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var levelOptions = ['cluster', 'indices', 'shards']; var waitForStatusOptions = ['green', 'yellow', 'red']; - - /** * Perform an elasticsearch [cluster.health](http://elasticsearch.org/guide/reference/api/admin-cluster-health/) request * @@ -21,36 +21,36 @@ var waitForStatusOptions = ['green', 'yellow', 'red']; * @param {number} params.wait_for_relocating_shards - Wait until the specified number of relocating shards is finished * @param {String} params.wait_for_status - Wait until cluster is in a specific state */ -function doClusterHealth(params, callback) { +function doClusterHealth(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.index !== 'undefined') { if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/_cluster/health/' + encodeURIComponent(url.index) + ''; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/_cluster/health/' + encodeURIComponent(parts.index) + ''; } else { - request.url = '/_cluster/health'; + request.path = '/_cluster/health'; } - + // build the query string if (typeof params.level !== 'undefined') { @@ -63,7 +63,7 @@ function doClusterHealth(params, callback) { ); } } - + if (typeof params.local !== 'undefined') { if (params.local.toLowerCase && (params.local = params.local.toLowerCase()) && (params.local === 'no' || params.local === 'off') @@ -73,7 +73,7 @@ function doClusterHealth(params, callback) { query.local = !!params.local; } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -83,7 +83,7 @@ function doClusterHealth(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - + if (typeof params.timeout !== 'undefined') { if (params.timeout instanceof Date) { query.timeout = params.timeout.getTime(); @@ -93,7 +93,7 @@ function doClusterHealth(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.wait_for_active_shards !== 'undefined') { if (_.isNumeric(params.wait_for_active_shards)) { query.wait_for_active_shards = params.wait_for_active_shards * 1; @@ -101,7 +101,7 @@ function doClusterHealth(params, callback) { throw new TypeError('Invalid wait_for_active_shards: ' + params.wait_for_active_shards + ' should be a number.'); } } - + if (typeof params.wait_for_nodes !== 'undefined') { if (typeof params.wait_for_nodes !== 'object' && params.wait_for_nodes) { query.wait_for_nodes = '' + params.wait_for_nodes; @@ -109,7 +109,7 @@ function doClusterHealth(params, callback) { throw new TypeError('Invalid wait_for_nodes: ' + params.wait_for_nodes + ' should be a string.'); } } - + if (typeof params.wait_for_relocating_shards !== 'undefined') { if (_.isNumeric(params.wait_for_relocating_shards)) { query.wait_for_relocating_shards = params.wait_for_relocating_shards * 1; @@ -117,7 +117,7 @@ function doClusterHealth(params, callback) { throw new TypeError('Invalid wait_for_relocating_shards: ' + params.wait_for_relocating_shards + ' should be a number.'); } } - + if (typeof params.wait_for_status !== 'undefined') { if (_.contains(waitForStatusOptions, params.wait_for_status)) { query.wait_for_status = params.wait_for_status; @@ -128,14 +128,10 @@ function doClusterHealth(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doClusterHealth; diff --git a/src/api/cluster/node_hot_threads.js b/src/api/cluster/node_hot_threads.js index 62357753e..26f2b037b 100644 --- a/src/api/cluster/node_hot_threads.js +++ b/src/api/cluster/node_hot_threads.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var typeOptions = ['cpu', 'wait', 'block']; - - /** * Perform an elasticsearch [cluster.node_hot_threads](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-hot-threads/) request * @@ -16,45 +16,45 @@ var typeOptions = ['cpu', 'wait', 'block']; * @param {number} params.threads - Specify the number of threads to provide information for (default: 3) * @param {String} params.type - The type to sample (default: cpu) */ -function doClusterNodeHotThreads(params, callback) { +function doClusterNodeHotThreads(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.node_id !== 'undefined') { switch (typeof params.node_id) { case 'string': - url.node_id = params.node_id; + parts.node_id = params.node_id; break; case 'object': if (_.isArray(params.node_id)) { - url.node_id = params.node_id.join(','); + parts.node_id = params.node_id.join(','); } else { throw new TypeError('Invalid node_id: ' + params.node_id + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.node_id = !!params.node_id; + parts.node_id = !!params.node_id; } } - - // build the url - if (url.hasOwnProperty('node_id')) { - request.url = '/_nodes/' + encodeURIComponent(url.node_id) + '/hotthreads'; + + // build the path + if (parts.hasOwnProperty('node_id')) { + request.path = '/_nodes/' + encodeURIComponent(parts.node_id) + '/hotthreads'; } else { - request.url = '/_nodes/hotthreads'; + request.path = '/_nodes/hotthreads'; } - + // build the query string if (typeof params.interval !== 'undefined') { @@ -66,7 +66,7 @@ function doClusterNodeHotThreads(params, callback) { throw new TypeError('Invalid interval: ' + params.interval + ' should be be some sort of time.'); } } - + if (typeof params.snapshots !== 'undefined') { if (_.isNumeric(params.snapshots)) { query.snapshots = params.snapshots * 1; @@ -74,7 +74,7 @@ function doClusterNodeHotThreads(params, callback) { throw new TypeError('Invalid snapshots: ' + params.snapshots + ' should be a number.'); } } - + if (typeof params.threads !== 'undefined') { if (_.isNumeric(params.threads)) { query.threads = params.threads * 1; @@ -82,7 +82,7 @@ function doClusterNodeHotThreads(params, callback) { throw new TypeError('Invalid threads: ' + params.threads + ' should be a number.'); } } - + if (typeof params.type !== 'undefined') { if (_.contains(typeOptions, params.type)) { query.type = params.type; @@ -93,14 +93,10 @@ function doClusterNodeHotThreads(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doClusterNodeHotThreads; diff --git a/src/api/cluster/node_info.js b/src/api/cluster/node_info.js index bdf51f7bb..51c1be03b 100644 --- a/src/api/cluster/node_info.js +++ b/src/api/cluster/node_info.js @@ -1,8 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - -//TODO: this enpoint ***needs*** work, many of the possible urls are not supported - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [cluster.node_info](http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-info/) request @@ -23,45 +22,45 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Explicit operation timeout * @param {boolean} params.transport - Return information about transport */ -function doClusterNodeInfo(params, callback) { +function doClusterNodeInfo(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.node_id !== 'undefined') { switch (typeof params.node_id) { case 'string': - url.node_id = params.node_id; + parts.node_id = params.node_id; break; case 'object': if (_.isArray(params.node_id)) { - url.node_id = params.node_id.join(','); + parts.node_id = params.node_id.join(','); } else { throw new TypeError('Invalid node_id: ' + params.node_id + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.node_id = !!params.node_id; + parts.node_id = !!params.node_id; } } - - // build the url - if (url.hasOwnProperty('node_id')) { - request.url = '/_nodes/' + encodeURIComponent(url.node_id) + ''; + + // build the path + if (parts.hasOwnProperty('node_id')) { + request.path = '/_nodes/' + encodeURIComponent(parts.node_id) + ''; } else { - request.url = '/_nodes'; + request.path = '/_nodes'; } - + // build the query string if (typeof params.all !== 'undefined') { @@ -73,7 +72,7 @@ function doClusterNodeInfo(params, callback) { query.all = !!params.all; } } - + if (typeof params.clear !== 'undefined') { if (params.clear.toLowerCase && (params.clear = params.clear.toLowerCase()) && (params.clear === 'no' || params.clear === 'off') @@ -83,7 +82,7 @@ function doClusterNodeInfo(params, callback) { query.clear = !!params.clear; } } - + if (typeof params.http !== 'undefined') { if (params.http.toLowerCase && (params.http = params.http.toLowerCase()) && (params.http === 'no' || params.http === 'off') @@ -93,7 +92,7 @@ function doClusterNodeInfo(params, callback) { query.http = !!params.http; } } - + if (typeof params.jvm !== 'undefined') { if (params.jvm.toLowerCase && (params.jvm = params.jvm.toLowerCase()) && (params.jvm === 'no' || params.jvm === 'off') @@ -103,7 +102,7 @@ function doClusterNodeInfo(params, callback) { query.jvm = !!params.jvm; } } - + if (typeof params.network !== 'undefined') { if (params.network.toLowerCase && (params.network = params.network.toLowerCase()) && (params.network === 'no' || params.network === 'off') @@ -113,7 +112,7 @@ function doClusterNodeInfo(params, callback) { query.network = !!params.network; } } - + if (typeof params.os !== 'undefined') { if (params.os.toLowerCase && (params.os = params.os.toLowerCase()) && (params.os === 'no' || params.os === 'off') @@ -123,7 +122,7 @@ function doClusterNodeInfo(params, callback) { query.os = !!params.os; } } - + if (typeof params.plugin !== 'undefined') { if (params.plugin.toLowerCase && (params.plugin = params.plugin.toLowerCase()) && (params.plugin === 'no' || params.plugin === 'off') @@ -133,7 +132,7 @@ function doClusterNodeInfo(params, callback) { query.plugin = !!params.plugin; } } - + if (typeof params.process !== 'undefined') { if (params.process.toLowerCase && (params.process = params.process.toLowerCase()) && (params.process === 'no' || params.process === 'off') @@ -143,7 +142,7 @@ function doClusterNodeInfo(params, callback) { query.process = !!params.process; } } - + if (typeof params.settings !== 'undefined') { if (params.settings.toLowerCase && (params.settings = params.settings.toLowerCase()) && (params.settings === 'no' || params.settings === 'off') @@ -153,7 +152,7 @@ function doClusterNodeInfo(params, callback) { query.settings = !!params.settings; } } - + if (typeof params.thread_pool !== 'undefined') { if (params.thread_pool.toLowerCase && (params.thread_pool = params.thread_pool.toLowerCase()) && (params.thread_pool === 'no' || params.thread_pool === 'off') @@ -163,7 +162,7 @@ function doClusterNodeInfo(params, callback) { query.thread_pool = !!params.thread_pool; } } - + if (typeof params.timeout !== 'undefined') { if (params.timeout instanceof Date) { query.timeout = params.timeout.getTime(); @@ -173,7 +172,7 @@ function doClusterNodeInfo(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.transport !== 'undefined') { if (params.transport.toLowerCase && (params.transport = params.transport.toLowerCase()) && (params.transport === 'no' || params.transport === 'off') @@ -183,14 +182,10 @@ function doClusterNodeInfo(params, callback) { query.transport = !!params.transport; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doClusterNodeInfo; diff --git a/src/api/cluster/node_shutdown.js b/src/api/cluster/node_shutdown.js index 79801aa14..6d1442c82 100644 --- a/src/api/cluster/node_shutdown.js +++ b/src/api/cluster/node_shutdown.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [cluster.node_shutdown](http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/) request @@ -12,45 +12,45 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.delay - Set the delay for the operation (default: 1s) * @param {boolean} params.exit - Exit the JVM as well (default: true) */ -function doClusterNodeShutdown(params, callback) { +function doClusterNodeShutdown(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'post'; - // find the url's params + request.method = 'POST'; + + // find the paths's params if (typeof params.node_id !== 'undefined') { switch (typeof params.node_id) { case 'string': - url.node_id = params.node_id; + parts.node_id = params.node_id; break; case 'object': if (_.isArray(params.node_id)) { - url.node_id = params.node_id.join(','); + parts.node_id = params.node_id.join(','); } else { throw new TypeError('Invalid node_id: ' + params.node_id + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.node_id = !!params.node_id; + parts.node_id = !!params.node_id; } } - - // build the url - if (url.hasOwnProperty('node_id')) { - request.url = '/_cluster/nodes/' + encodeURIComponent(url.node_id) + '/_shutdown'; + + // build the path + if (parts.hasOwnProperty('node_id')) { + request.path = '/_cluster/nodes/' + encodeURIComponent(parts.node_id) + '/_shutdown'; } else { - request.url = '/_shutdown'; + request.path = '/_shutdown'; } - + // build the query string if (typeof params.delay !== 'undefined') { @@ -62,7 +62,7 @@ function doClusterNodeShutdown(params, callback) { throw new TypeError('Invalid delay: ' + params.delay + ' should be be some sort of time.'); } } - + if (typeof params.exit !== 'undefined') { if (params.exit.toLowerCase && (params.exit = params.exit.toLowerCase()) && (params.exit === 'no' || params.exit === 'off') @@ -72,14 +72,10 @@ function doClusterNodeShutdown(params, callback) { query.exit = !!params.exit; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doClusterNodeShutdown; diff --git a/src/api/cluster/node_stats.js b/src/api/cluster/node_stats.js index 94535e23c..7babde91c 100644 --- a/src/api/cluster/node_stats.js +++ b/src/api/cluster/node_stats.js @@ -1,11 +1,11 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var metricFamilyOptions = ['all', 'fs', 'http', 'indices', 'jvm', 'network', 'os', 'process', 'thread_pool', 'transport']; var metricOptions = ['completion', 'docs', 'fielddata', 'filter_cache', 'flush', 'get', 'id_cache', 'indexing', 'merges', 'refresh', 'search', 'store', 'warmer']; - - /** * Perform an elasticsearch [cluster.node_stats](http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/) request * @@ -25,39 +25,39 @@ var metricOptions = ['completion', 'docs', 'fielddata', 'filter_cache', 'flush', * @param {boolean} params.thread_pool - Return information about the thread pool * @param {boolean} params.transport - Return information about transport */ -function doClusterNodeStats(params, callback) { +function doClusterNodeStats(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.fields !== 'undefined') { switch (typeof params.fields) { case 'string': - url.fields = params.fields; + parts.fields = params.fields; break; case 'object': if (_.isArray(params.fields)) { - url.fields = params.fields.join(','); + parts.fields = params.fields.join(','); } else { throw new TypeError('Invalid fields: ' + params.fields + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.fields = !!params.fields; + parts.fields = !!params.fields; } } - + if (typeof params.metric_family !== 'undefined') { if (_.contains(metricFamilyOptions, params.metric_family)) { - url.metric_family = params.metric_family; + parts.metric_family = params.metric_family; } else { throw new TypeError( 'Invalid metric_family: ' + params.metric_family + @@ -65,10 +65,10 @@ function doClusterNodeStats(params, callback) { ); } } - + if (typeof params.metric !== 'undefined') { if (_.contains(metricOptions, params.metric)) { - url.metric = params.metric; + parts.metric = params.metric; } else { throw new TypeError( 'Invalid metric: ' + params.metric + @@ -76,33 +76,33 @@ function doClusterNodeStats(params, callback) { ); } } - + if (typeof params.node_id !== 'undefined') { switch (typeof params.node_id) { case 'string': - url.node_id = params.node_id; + parts.node_id = params.node_id; break; case 'object': if (_.isArray(params.node_id)) { - url.node_id = params.node_id.join(','); + parts.node_id = params.node_id.join(','); } else { throw new TypeError('Invalid node_id: ' + params.node_id + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.node_id = !!params.node_id; + parts.node_id = !!params.node_id; } } - - // build the url - if (url.hasOwnProperty('node_id')) { - request.url = '/_nodes/' + encodeURIComponent(url.node_id) + '/stats'; + + // build the path + if (parts.hasOwnProperty('node_id')) { + request.path = '/_nodes/' + encodeURIComponent(parts.node_id) + '/stats'; } else { - request.url = '/_nodes/stats'; + request.path = '/_nodes/stats'; } - + // build the query string if (typeof params.all !== 'undefined') { @@ -114,7 +114,7 @@ function doClusterNodeStats(params, callback) { query.all = !!params.all; } } - + if (typeof params.clear !== 'undefined') { if (params.clear.toLowerCase && (params.clear = params.clear.toLowerCase()) && (params.clear === 'no' || params.clear === 'off') @@ -124,7 +124,7 @@ function doClusterNodeStats(params, callback) { query.clear = !!params.clear; } } - + if (typeof params.fields !== 'undefined') { switch (typeof params.fields) { case 'string': @@ -141,7 +141,7 @@ function doClusterNodeStats(params, callback) { query.fields = !!params.fields; } } - + if (typeof params.fs !== 'undefined') { if (params.fs.toLowerCase && (params.fs = params.fs.toLowerCase()) && (params.fs === 'no' || params.fs === 'off') @@ -151,7 +151,7 @@ function doClusterNodeStats(params, callback) { query.fs = !!params.fs; } } - + if (typeof params.http !== 'undefined') { if (params.http.toLowerCase && (params.http = params.http.toLowerCase()) && (params.http === 'no' || params.http === 'off') @@ -161,7 +161,7 @@ function doClusterNodeStats(params, callback) { query.http = !!params.http; } } - + if (typeof params.indices !== 'undefined') { if (params.indices.toLowerCase && (params.indices = params.indices.toLowerCase()) && (params.indices === 'no' || params.indices === 'off') @@ -171,7 +171,7 @@ function doClusterNodeStats(params, callback) { query.indices = !!params.indices; } } - + if (typeof params.jvm !== 'undefined') { if (params.jvm.toLowerCase && (params.jvm = params.jvm.toLowerCase()) && (params.jvm === 'no' || params.jvm === 'off') @@ -181,7 +181,7 @@ function doClusterNodeStats(params, callback) { query.jvm = !!params.jvm; } } - + if (typeof params.network !== 'undefined') { if (params.network.toLowerCase && (params.network = params.network.toLowerCase()) && (params.network === 'no' || params.network === 'off') @@ -191,7 +191,7 @@ function doClusterNodeStats(params, callback) { query.network = !!params.network; } } - + if (typeof params.os !== 'undefined') { if (params.os.toLowerCase && (params.os = params.os.toLowerCase()) && (params.os === 'no' || params.os === 'off') @@ -201,7 +201,7 @@ function doClusterNodeStats(params, callback) { query.os = !!params.os; } } - + if (typeof params.process !== 'undefined') { if (params.process.toLowerCase && (params.process = params.process.toLowerCase()) && (params.process === 'no' || params.process === 'off') @@ -211,7 +211,7 @@ function doClusterNodeStats(params, callback) { query.process = !!params.process; } } - + if (typeof params.thread_pool !== 'undefined') { if (params.thread_pool.toLowerCase && (params.thread_pool = params.thread_pool.toLowerCase()) && (params.thread_pool === 'no' || params.thread_pool === 'off') @@ -221,7 +221,7 @@ function doClusterNodeStats(params, callback) { query.thread_pool = !!params.thread_pool; } } - + if (typeof params.transport !== 'undefined') { if (params.transport.toLowerCase && (params.transport = params.transport.toLowerCase()) && (params.transport === 'no' || params.transport === 'off') @@ -231,14 +231,10 @@ function doClusterNodeStats(params, callback) { query.transport = !!params.transport; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doClusterNodeStats; diff --git a/src/api/cluster/put_settings.js b/src/api/cluster/put_settings.js index 3712bb801..a1dafecb5 100644 --- a/src/api/cluster/put_settings.js +++ b/src/api/cluster/put_settings.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [cluster.put_settings](http://elasticsearch.org/guide/reference/api/admin-cluster-update-settings/) request @@ -10,35 +10,31 @@ var _ = require('../../lib/toolbelt') * @method cluster.put_settings * @param {Object} params - An object with parameters used to carry out this action */ -function doClusterPutSettings(params, callback) { +function doClusterPutSettings(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'put'; - // find the url's params + request.method = 'PUT'; + + // find the paths's params - // build the url - request.url = '/_cluster/settings'; - + // build the path + request.path = '/_cluster/settings'; + // build the query string - request.url = request.url + _.makeQueryString(query); + request.path = request.path + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + this.client.request(request, cb); } module.exports = doClusterPutSettings; diff --git a/src/api/cluster/reroute.js b/src/api/cluster/reroute.js index 84a44da1a..e5c880c49 100644 --- a/src/api/cluster/reroute.js +++ b/src/api/cluster/reroute.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [cluster.reroute](http://elasticsearch.org/guide/reference/api/admin-cluster-reroute/) request @@ -12,25 +12,25 @@ var _ = require('../../lib/toolbelt') * @param {boolean} params.dry_run - Simulate the operation only and return the resulting state * @param {boolean} params.filter_metadata - Don't return cluster state metadata (default: false) */ -function doClusterReroute(params, callback) { +function doClusterReroute(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'post'; - // find the url's params + request.method = 'POST'; + + // find the paths's params - // build the url - request.url = '/_cluster/reroute'; - + // build the path + request.path = '/_cluster/reroute'; + // build the query string if (typeof params.dry_run !== 'undefined') { @@ -42,7 +42,7 @@ function doClusterReroute(params, callback) { query.dry_run = !!params.dry_run; } } - + if (typeof params.filter_metadata !== 'undefined') { if (params.filter_metadata.toLowerCase && (params.filter_metadata = params.filter_metadata.toLowerCase()) && (params.filter_metadata === 'no' || params.filter_metadata === 'off') @@ -52,14 +52,10 @@ function doClusterReroute(params, callback) { query.filter_metadata = !!params.filter_metadata; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doClusterReroute; diff --git a/src/api/cluster/state.js b/src/api/cluster/state.js index 01602b62b..d86e663f9 100644 --- a/src/api/cluster/state.js +++ b/src/api/cluster/state.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [cluster.state](http://elasticsearch.org/guide/reference/api/admin-cluster-state/) request @@ -18,24 +18,24 @@ var _ = require('../../lib/toolbelt') * @param {boolean} params.local - Return local information, do not retrieve the state from master node (default: false) * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doClusterState(params, callback) { +function doClusterState(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params - // build the url - request.url = '/_cluster/state'; - + // build the path + request.path = '/_cluster/state'; + // build the query string if (typeof params.filter_blocks !== 'undefined') { @@ -47,7 +47,7 @@ function doClusterState(params, callback) { query.filter_blocks = !!params.filter_blocks; } } - + if (typeof params.filter_index_templates !== 'undefined') { if (params.filter_index_templates.toLowerCase && (params.filter_index_templates = params.filter_index_templates.toLowerCase()) && (params.filter_index_templates === 'no' || params.filter_index_templates === 'off') @@ -57,7 +57,7 @@ function doClusterState(params, callback) { query.filter_index_templates = !!params.filter_index_templates; } } - + if (typeof params.filter_indices !== 'undefined') { switch (typeof params.filter_indices) { case 'string': @@ -74,7 +74,7 @@ function doClusterState(params, callback) { query.filter_indices = !!params.filter_indices; } } - + if (typeof params.filter_metadata !== 'undefined') { if (params.filter_metadata.toLowerCase && (params.filter_metadata = params.filter_metadata.toLowerCase()) && (params.filter_metadata === 'no' || params.filter_metadata === 'off') @@ -84,7 +84,7 @@ function doClusterState(params, callback) { query.filter_metadata = !!params.filter_metadata; } } - + if (typeof params.filter_nodes !== 'undefined') { if (params.filter_nodes.toLowerCase && (params.filter_nodes = params.filter_nodes.toLowerCase()) && (params.filter_nodes === 'no' || params.filter_nodes === 'off') @@ -94,7 +94,7 @@ function doClusterState(params, callback) { query.filter_nodes = !!params.filter_nodes; } } - + if (typeof params.filter_routing_table !== 'undefined') { if (params.filter_routing_table.toLowerCase && (params.filter_routing_table = params.filter_routing_table.toLowerCase()) && (params.filter_routing_table === 'no' || params.filter_routing_table === 'off') @@ -104,7 +104,7 @@ function doClusterState(params, callback) { query.filter_routing_table = !!params.filter_routing_table; } } - + if (typeof params.local !== 'undefined') { if (params.local.toLowerCase && (params.local = params.local.toLowerCase()) && (params.local === 'no' || params.local === 'off') @@ -114,7 +114,7 @@ function doClusterState(params, callback) { query.local = !!params.local; } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -124,14 +124,10 @@ function doClusterState(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doClusterState; diff --git a/src/api/count.js b/src/api/count.js index 56546bb78..c80e0e725 100644 --- a/src/api/count.js +++ b/src/api/count.js @@ -1,10 +1,10 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [count](http://elasticsearch.org/guide/reference/api/count/) request * @@ -17,74 +17,74 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {string} params.routing - Specific routing value * @param {string} params.source - The URL-encoded query definition (instead of using the request body) */ -function doCount(params, callback) { +function doCount(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'post' || params.method === 'get') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'POST' || params.method === 'GET') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of post, get'); + throw new TypeError('Invalid method: should be one of POST, GET'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - + if (typeof params.type !== 'undefined') { switch (typeof params.type) { case 'string': - url.type = params.type; + parts.type = params.type; break; case 'object': if (_.isArray(params.type)) { - url.type = params.type.join(','); + parts.type = params.type.join(','); } else { throw new TypeError('Invalid type: ' + params.type + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.type = !!params.type; + parts.type = !!params.type; } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_count'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_count'; } - else if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_count'; + else if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_count'; } else { - request.url = '/_count'; + request.path = '/_count'; } - + // build the query string if (typeof params.ignore_indices !== 'undefined') { @@ -97,7 +97,7 @@ function doCount(params, callback) { ); } } - + if (typeof params.min_score !== 'undefined') { if (_.isNumeric(params.min_score)) { query.min_score = params.min_score * 1; @@ -105,7 +105,7 @@ function doCount(params, callback) { throw new TypeError('Invalid min_score: ' + params.min_score + ' should be a number.'); } } - + if (typeof params.preference !== 'undefined') { if (typeof params.preference !== 'object' && params.preference) { query.preference = '' + params.preference; @@ -113,7 +113,7 @@ function doCount(params, callback) { throw new TypeError('Invalid preference: ' + params.preference + ' should be a string.'); } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -121,7 +121,7 @@ function doCount(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - + if (typeof params.source !== 'undefined') { if (typeof params.source !== 'object' && params.source) { query.source = '' + params.source; @@ -129,14 +129,10 @@ function doCount(params, callback) { throw new TypeError('Invalid source: ' + params.source + ' should be a string.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doCount; diff --git a/src/api/create.js b/src/api/create.js index 32d106ecc..3f3535e67 100644 --- a/src/api/create.js +++ b/src/api/create.js @@ -1,12 +1,12 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var consistencyOptions = ['one', 'quorum', 'all']; var replicationOptions = ['sync', 'async']; var versionTypeOptions = ['internal', 'external']; - - /** * Perform an elasticsearch [create](http://elasticsearch.org/guide/reference/api/index_/) request * @@ -26,61 +26,61 @@ var versionTypeOptions = ['internal', 'external']; * @param {number} params.version - Explicit version number for concurrency control * @param {String} params.version_type - Specific version type */ -function doCreate(params, callback) { +function doCreate(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'post' || params.method === 'put') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'POST' || params.method === 'PUT') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of post, put'); + throw new TypeError('Invalid method: should be one of POST, PUT'); } } else { - request.method = 'post'; + request.method = 'POST'; } - // find the url's params + // find the paths's params if (typeof params.id !== 'undefined') { if (typeof params.id !== 'object' && params.id) { - url.id = '' + params.id; + parts.id = '' + params.id; } else { throw new TypeError('Invalid id: ' + params.id + ' should be a string.'); } } - + if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type') && url.hasOwnProperty('id')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/' + encodeURIComponent(url.id) + '/_create'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type') && parts.hasOwnProperty('id')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/' + encodeURIComponent(parts.id) + '/_create'; delete params.id; } - else if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + ''; + else if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object]'); } - + // build the query string if (typeof params.consistency !== 'undefined') { @@ -93,7 +93,7 @@ function doCreate(params, callback) { ); } } - + if (typeof params.id !== 'undefined') { if (typeof params.id !== 'object' && params.id) { query.id = '' + params.id; @@ -101,7 +101,7 @@ function doCreate(params, callback) { throw new TypeError('Invalid id: ' + params.id + ' should be a string.'); } } - + if (typeof params.parent !== 'undefined') { if (typeof params.parent !== 'object' && params.parent) { query.parent = '' + params.parent; @@ -109,7 +109,7 @@ function doCreate(params, callback) { throw new TypeError('Invalid parent: ' + params.parent + ' should be a string.'); } } - + if (typeof params.percolate !== 'undefined') { if (typeof params.percolate !== 'object' && params.percolate) { query.percolate = '' + params.percolate; @@ -117,7 +117,7 @@ function doCreate(params, callback) { throw new TypeError('Invalid percolate: ' + params.percolate + ' should be a string.'); } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -127,7 +127,7 @@ function doCreate(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params.replication !== 'undefined') { if (_.contains(replicationOptions, params.replication)) { query.replication = params.replication; @@ -138,7 +138,7 @@ function doCreate(params, callback) { ); } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -146,7 +146,7 @@ function doCreate(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - + if (typeof params.timeout !== 'undefined') { if (params.timeout instanceof Date) { query.timeout = params.timeout.getTime(); @@ -156,7 +156,7 @@ function doCreate(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.timestamp !== 'undefined') { if (params.timestamp instanceof Date) { query.timestamp = params.timestamp.getTime(); @@ -166,7 +166,7 @@ function doCreate(params, callback) { throw new TypeError('Invalid timestamp: ' + params.timestamp + ' should be be some sort of time.'); } } - + if (typeof params.ttl !== 'undefined') { if (_.isNumeric(params.ttl) || _.isInterval(params.ttl)) { query.ttl = params.ttl; @@ -174,7 +174,7 @@ function doCreate(params, callback) { throw new TypeError('Invalid ttl: ' + params.ttl + ' should be a number or in interval notation (an integer followed by one of Mwdhmsy).'); } } - + if (typeof params.version !== 'undefined') { if (_.isNumeric(params.version)) { query.version = params.version * 1; @@ -182,7 +182,7 @@ function doCreate(params, callback) { throw new TypeError('Invalid version: ' + params.version + ' should be a number.'); } } - + if (typeof params.version_type !== 'undefined') { if (_.contains(versionTypeOptions, params.version_type)) { query.version_type = params.version_type; @@ -193,14 +193,10 @@ function doCreate(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doCreate; diff --git a/src/api/delete.js b/src/api/delete.js index ec3066516..54643d2cd 100644 --- a/src/api/delete.js +++ b/src/api/delete.js @@ -1,12 +1,12 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var consistencyOptions = ['one', 'quorum', 'all']; var replicationOptions = ['sync', 'async']; var versionTypeOptions = ['internal', 'external']; - - /** * Perform an elasticsearch [delete](http://elasticsearch.org/guide/reference/api/delete/) request * @@ -22,46 +22,46 @@ var versionTypeOptions = ['internal', 'external']; * @param {number} params.version - Explicit version number for concurrency control * @param {String} params.version_type - Specific version type */ -function doDelete(params, callback) { +function doDelete(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'delete'; - // find the url's params + request.method = 'DELETE'; + + // find the paths's params if (typeof params.id !== 'object' && params.id) { - url.id = '' + params.id; + parts.id = '' + params.id; } else { throw new TypeError('Invalid id: ' + params.id + ' should be a string.'); } - + if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type') && url.hasOwnProperty('id')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/' + encodeURIComponent(url.id) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type') && parts.hasOwnProperty('id')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/' + encodeURIComponent(parts.id) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object], [object Object]'); } - + // build the query string if (typeof params.consistency !== 'undefined') { @@ -74,7 +74,7 @@ function doDelete(params, callback) { ); } } - + if (typeof params.parent !== 'undefined') { if (typeof params.parent !== 'object' && params.parent) { query.parent = '' + params.parent; @@ -82,7 +82,7 @@ function doDelete(params, callback) { throw new TypeError('Invalid parent: ' + params.parent + ' should be a string.'); } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -92,7 +92,7 @@ function doDelete(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params.replication !== 'undefined') { if (_.contains(replicationOptions, params.replication)) { query.replication = params.replication; @@ -103,7 +103,7 @@ function doDelete(params, callback) { ); } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -111,7 +111,7 @@ function doDelete(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - + if (typeof params.timeout !== 'undefined') { if (params.timeout instanceof Date) { query.timeout = params.timeout.getTime(); @@ -121,7 +121,7 @@ function doDelete(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.version !== 'undefined') { if (_.isNumeric(params.version)) { query.version = params.version * 1; @@ -129,7 +129,7 @@ function doDelete(params, callback) { throw new TypeError('Invalid version: ' + params.version + ' should be a number.'); } } - + if (typeof params.version_type !== 'undefined') { if (_.contains(versionTypeOptions, params.version_type)) { query.version_type = params.version_type; @@ -140,14 +140,10 @@ function doDelete(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doDelete; diff --git a/src/api/delete_by_query.js b/src/api/delete_by_query.js index a8599c72c..0ceb06b99 100644 --- a/src/api/delete_by_query.js +++ b/src/api/delete_by_query.js @@ -1,13 +1,13 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var consistencyOptions = ['one', 'quorum', 'all']; var defaultOperatorOptions = ['AND', 'OR']; var ignoreIndicesOptions = ['none', 'missing']; var replicationOptions = ['sync', 'async']; - - /** * Perform an elasticsearch [delete_by_query](http://www.elasticsearch.org/guide/reference/api/delete-by-query/) request * @@ -25,64 +25,64 @@ var replicationOptions = ['sync', 'async']; * @param {string} params.source - The URL-encoded query definition (instead of using the request body) * @param {Date|Number} params.timeout - Explicit operation timeout */ -function doDeleteByQuery(params, callback) { +function doDeleteByQuery(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'delete'; - // find the url's params + request.method = 'DELETE'; + + // find the paths's params switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } - + if (typeof params.type !== 'undefined') { switch (typeof params.type) { case 'string': - url.type = params.type; + parts.type = params.type; break; case 'object': if (_.isArray(params.type)) { - url.type = params.type.join(','); + parts.type = params.type.join(','); } else { throw new TypeError('Invalid type: ' + params.type + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.type = !!params.type; + parts.type = !!params.type; } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_query'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_query'; } - else if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_query'; + else if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_query'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string if (typeof params.analyzer !== 'undefined') { @@ -92,7 +92,7 @@ function doDeleteByQuery(params, callback) { throw new TypeError('Invalid analyzer: ' + params.analyzer + ' should be a string.'); } } - + if (typeof params.consistency !== 'undefined') { if (_.contains(consistencyOptions, params.consistency)) { query.consistency = params.consistency; @@ -103,7 +103,7 @@ function doDeleteByQuery(params, callback) { ); } } - + if (typeof params.default_operator !== 'undefined') { if (_.contains(defaultOperatorOptions, params.default_operator)) { query.default_operator = params.default_operator; @@ -114,7 +114,7 @@ function doDeleteByQuery(params, callback) { ); } } - + if (typeof params.df !== 'undefined') { if (typeof params.df !== 'object' && params.df) { query.df = '' + params.df; @@ -122,7 +122,7 @@ function doDeleteByQuery(params, callback) { throw new TypeError('Invalid df: ' + params.df + ' should be a string.'); } } - + if (typeof params.ignore_indices !== 'undefined') { if (_.contains(ignoreIndicesOptions, params.ignore_indices)) { query.ignore_indices = params.ignore_indices; @@ -133,7 +133,7 @@ function doDeleteByQuery(params, callback) { ); } } - + if (typeof params.replication !== 'undefined') { if (_.contains(replicationOptions, params.replication)) { query.replication = params.replication; @@ -144,7 +144,7 @@ function doDeleteByQuery(params, callback) { ); } } - + if (typeof params.q !== 'undefined') { if (typeof params.q !== 'object' && params.q) { query.q = '' + params.q; @@ -152,7 +152,7 @@ function doDeleteByQuery(params, callback) { throw new TypeError('Invalid q: ' + params.q + ' should be a string.'); } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -160,7 +160,7 @@ function doDeleteByQuery(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - + if (typeof params.source !== 'undefined') { if (typeof params.source !== 'object' && params.source) { query.source = '' + params.source; @@ -168,7 +168,7 @@ function doDeleteByQuery(params, callback) { throw new TypeError('Invalid source: ' + params.source + ' should be a string.'); } } - + if (typeof params.timeout !== 'undefined') { if (params.timeout instanceof Date) { query.timeout = params.timeout.getTime(); @@ -178,14 +178,10 @@ function doDeleteByQuery(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doDeleteByQuery; diff --git a/src/api/exists.js b/src/api/exists.js index ac40e6336..12948f903 100644 --- a/src/api/exists.js +++ b/src/api/exists.js @@ -1,7 +1,7 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); - - +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [exists](http://elasticsearch.org/guide/reference/api/get/) request @@ -15,48 +15,48 @@ var _ = require('../lib/toolbelt') * @param {boolean} params.refresh - Refresh the shard containing the document before performing the operation * @param {string} params.routing - Specific routing value */ -function doExists(params, callback) { +function doExists(params, cb) { params = params || {}; var request = { ignore: _.union([404], params.ignore) } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'head'; - // find the url's params + request.method = 'HEAD'; + + // find the paths's params if (typeof params.id !== 'object' && params.id) { - url.id = '' + params.id; + parts.id = '' + params.id; } else { throw new TypeError('Invalid id: ' + params.id + ' should be a string.'); } - + if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.type !== 'undefined') { if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('id')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type || '_all') + '/' + encodeURIComponent(url.id) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('id')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type || '_all') + '/' + encodeURIComponent(parts.id) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object], [object Object]'); } - + // build the query string if (typeof params.parent !== 'undefined') { @@ -66,7 +66,7 @@ function doExists(params, callback) { throw new TypeError('Invalid parent: ' + params.parent + ' should be a string.'); } } - + if (typeof params.preference !== 'undefined') { if (typeof params.preference !== 'object' && params.preference) { query.preference = '' + params.preference; @@ -74,7 +74,7 @@ function doExists(params, callback) { throw new TypeError('Invalid preference: ' + params.preference + ' should be a string.'); } } - + if (typeof params.realtime !== 'undefined') { if (params.realtime.toLowerCase && (params.realtime = params.realtime.toLowerCase()) && (params.realtime === 'no' || params.realtime === 'off') @@ -84,7 +84,7 @@ function doExists(params, callback) { query.realtime = !!params.realtime; } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -94,7 +94,7 @@ function doExists(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -102,14 +102,16 @@ function doExists(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, function (err, response) { + if (err instanceof errors.NotFound) { + cb(err, false); + } else { + cb(err, true); + } + }); } module.exports = doExists; diff --git a/src/api/explain.js b/src/api/explain.js index 7735a9548..1e02eb0ab 100644 --- a/src/api/explain.js +++ b/src/api/explain.js @@ -1,10 +1,10 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var defaultOperatorOptions = ['AND', 'OR']; - - /** * Perform an elasticsearch [explain](http://elasticsearch.org/guide/reference/api/explain/) request * @@ -27,55 +27,55 @@ var defaultOperatorOptions = ['AND', 'OR']; * @param {String|ArrayOfStrings|Boolean} params._source_exclude - A list of fields to exclude from the returned _source field * @param {String|ArrayOfStrings|Boolean} params._source_include - A list of fields to extract and return from the _source field */ -function doExplain(params, callback) { +function doExplain(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'get' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'GET' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of get, post'); + throw new TypeError('Invalid method: should be one of GET, POST'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.id !== 'object' && params.id) { - url.id = '' + params.id; + parts.id = '' + params.id; } else { throw new TypeError('Invalid id: ' + params.id + ' should be a string.'); } - + if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type') && url.hasOwnProperty('id')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/' + encodeURIComponent(url.id) + '/_explain'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type') && parts.hasOwnProperty('id')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/' + encodeURIComponent(parts.id) + '/_explain'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object], [object Object]'); } - + // build the query string if (typeof params.analyze_wildcard !== 'undefined') { @@ -87,7 +87,7 @@ function doExplain(params, callback) { query.analyze_wildcard = !!params.analyze_wildcard; } } - + if (typeof params.analyzer !== 'undefined') { if (typeof params.analyzer !== 'object' && params.analyzer) { query.analyzer = '' + params.analyzer; @@ -95,7 +95,7 @@ function doExplain(params, callback) { throw new TypeError('Invalid analyzer: ' + params.analyzer + ' should be a string.'); } } - + if (typeof params.default_operator !== 'undefined') { if (_.contains(defaultOperatorOptions, params.default_operator)) { query.default_operator = params.default_operator; @@ -106,7 +106,7 @@ function doExplain(params, callback) { ); } } - + if (typeof params.df !== 'undefined') { if (typeof params.df !== 'object' && params.df) { query.df = '' + params.df; @@ -114,7 +114,7 @@ function doExplain(params, callback) { throw new TypeError('Invalid df: ' + params.df + ' should be a string.'); } } - + if (typeof params.fields !== 'undefined') { switch (typeof params.fields) { case 'string': @@ -131,7 +131,7 @@ function doExplain(params, callback) { query.fields = !!params.fields; } } - + if (typeof params.lenient !== 'undefined') { if (params.lenient.toLowerCase && (params.lenient = params.lenient.toLowerCase()) && (params.lenient === 'no' || params.lenient === 'off') @@ -141,7 +141,7 @@ function doExplain(params, callback) { query.lenient = !!params.lenient; } } - + if (typeof params.lowercase_expanded_terms !== 'undefined') { if (params.lowercase_expanded_terms.toLowerCase && (params.lowercase_expanded_terms = params.lowercase_expanded_terms.toLowerCase()) && (params.lowercase_expanded_terms === 'no' || params.lowercase_expanded_terms === 'off') @@ -151,7 +151,7 @@ function doExplain(params, callback) { query.lowercase_expanded_terms = !!params.lowercase_expanded_terms; } } - + if (typeof params.parent !== 'undefined') { if (typeof params.parent !== 'object' && params.parent) { query.parent = '' + params.parent; @@ -159,7 +159,7 @@ function doExplain(params, callback) { throw new TypeError('Invalid parent: ' + params.parent + ' should be a string.'); } } - + if (typeof params.preference !== 'undefined') { if (typeof params.preference !== 'object' && params.preference) { query.preference = '' + params.preference; @@ -167,7 +167,7 @@ function doExplain(params, callback) { throw new TypeError('Invalid preference: ' + params.preference + ' should be a string.'); } } - + if (typeof params.q !== 'undefined') { if (typeof params.q !== 'object' && params.q) { query.q = '' + params.q; @@ -175,7 +175,7 @@ function doExplain(params, callback) { throw new TypeError('Invalid q: ' + params.q + ' should be a string.'); } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -183,7 +183,7 @@ function doExplain(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - + if (typeof params.source !== 'undefined') { if (typeof params.source !== 'object' && params.source) { query.source = '' + params.source; @@ -191,7 +191,7 @@ function doExplain(params, callback) { throw new TypeError('Invalid source: ' + params.source + ' should be a string.'); } } - + if (typeof params._source !== 'undefined') { switch (typeof params._source) { case 'string': @@ -208,7 +208,7 @@ function doExplain(params, callback) { query._source = !!params._source; } } - + if (typeof params._source_exclude !== 'undefined') { switch (typeof params._source_exclude) { case 'string': @@ -225,7 +225,7 @@ function doExplain(params, callback) { query._source_exclude = !!params._source_exclude; } } - + if (typeof params._source_include !== 'undefined') { switch (typeof params._source_include) { case 'string': @@ -242,14 +242,10 @@ function doExplain(params, callback) { query._source_include = !!params._source_include; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doExplain; diff --git a/src/api/get.js b/src/api/get.js index 3104a7015..773ddf60b 100644 --- a/src/api/get.js +++ b/src/api/get.js @@ -1,7 +1,7 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); - - +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [get](http://elasticsearch.org/guide/reference/api/get/) request @@ -19,48 +19,48 @@ var _ = require('../lib/toolbelt') * @param {String|ArrayOfStrings|Boolean} params._source_exclude - A list of fields to exclude from the returned _source field * @param {String|ArrayOfStrings|Boolean} params._source_include - A list of fields to extract and return from the _source field */ -function doGet(params, callback) { +function doGet(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.id !== 'object' && params.id) { - url.id = '' + params.id; + parts.id = '' + params.id; } else { throw new TypeError('Invalid id: ' + params.id + ' should be a string.'); } - + if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.type !== 'undefined') { if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('id')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type || '_all') + '/' + encodeURIComponent(url.id) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('id')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type || '_all') + '/' + encodeURIComponent(parts.id) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object], [object Object]'); } - + // build the query string if (typeof params.fields !== 'undefined') { @@ -79,7 +79,7 @@ function doGet(params, callback) { query.fields = !!params.fields; } } - + if (typeof params.parent !== 'undefined') { if (typeof params.parent !== 'object' && params.parent) { query.parent = '' + params.parent; @@ -87,7 +87,7 @@ function doGet(params, callback) { throw new TypeError('Invalid parent: ' + params.parent + ' should be a string.'); } } - + if (typeof params.preference !== 'undefined') { if (typeof params.preference !== 'object' && params.preference) { query.preference = '' + params.preference; @@ -95,7 +95,7 @@ function doGet(params, callback) { throw new TypeError('Invalid preference: ' + params.preference + ' should be a string.'); } } - + if (typeof params.realtime !== 'undefined') { if (params.realtime.toLowerCase && (params.realtime = params.realtime.toLowerCase()) && (params.realtime === 'no' || params.realtime === 'off') @@ -105,7 +105,7 @@ function doGet(params, callback) { query.realtime = !!params.realtime; } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -115,7 +115,7 @@ function doGet(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -123,7 +123,7 @@ function doGet(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - + if (typeof params._source !== 'undefined') { switch (typeof params._source) { case 'string': @@ -140,7 +140,7 @@ function doGet(params, callback) { query._source = !!params._source; } } - + if (typeof params._source_exclude !== 'undefined') { switch (typeof params._source_exclude) { case 'string': @@ -157,7 +157,7 @@ function doGet(params, callback) { query._source_exclude = !!params._source_exclude; } } - + if (typeof params._source_include !== 'undefined') { switch (typeof params._source_include) { case 'string': @@ -174,14 +174,10 @@ function doGet(params, callback) { query._source_include = !!params._source_include; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doGet; diff --git a/src/api/get_source.js b/src/api/get_source.js index c6edb646d..ad5e444fe 100644 --- a/src/api/get_source.js +++ b/src/api/get_source.js @@ -1,7 +1,7 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); - - +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [get_source](http://elasticsearch.org/guide/reference/api/get/) request @@ -17,48 +17,48 @@ var _ = require('../lib/toolbelt') * @param {boolean} params.refresh - Refresh the shard containing the document before performing the operation * @param {string} params.routing - Specific routing value */ -function doGetSource(params, callback) { +function doGetSource(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.id !== 'object' && params.id) { - url.id = '' + params.id; + parts.id = '' + params.id; } else { throw new TypeError('Invalid id: ' + params.id + ' should be a string.'); } - + if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.type !== 'undefined') { if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('id')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type || '_all') + '/' + encodeURIComponent(url.id) + '/_source'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('id')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type || '_all') + '/' + encodeURIComponent(parts.id) + '/_source'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object], [object Object]'); } - + // build the query string if (typeof params._source_exclude !== 'undefined') { @@ -77,7 +77,7 @@ function doGetSource(params, callback) { query._source_exclude = !!params._source_exclude; } } - + if (typeof params._source_include !== 'undefined') { switch (typeof params._source_include) { case 'string': @@ -94,7 +94,7 @@ function doGetSource(params, callback) { query._source_include = !!params._source_include; } } - + if (typeof params.parent !== 'undefined') { if (typeof params.parent !== 'object' && params.parent) { query.parent = '' + params.parent; @@ -102,7 +102,7 @@ function doGetSource(params, callback) { throw new TypeError('Invalid parent: ' + params.parent + ' should be a string.'); } } - + if (typeof params.preference !== 'undefined') { if (typeof params.preference !== 'object' && params.preference) { query.preference = '' + params.preference; @@ -110,7 +110,7 @@ function doGetSource(params, callback) { throw new TypeError('Invalid preference: ' + params.preference + ' should be a string.'); } } - + if (typeof params.realtime !== 'undefined') { if (params.realtime.toLowerCase && (params.realtime = params.realtime.toLowerCase()) && (params.realtime === 'no' || params.realtime === 'off') @@ -120,7 +120,7 @@ function doGetSource(params, callback) { query.realtime = !!params.realtime; } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -130,7 +130,7 @@ function doGetSource(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -138,14 +138,10 @@ function doGetSource(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doGetSource; diff --git a/src/api/index.js b/src/api/index.js index b4aa294f4..99bd23148 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,13 +1,13 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var consistencyOptions = ['one', 'quorum', 'all']; var opTypeOptions = ['index', 'create']; var replicationOptions = ['sync', 'async']; var versionTypeOptions = ['internal', 'external']; - - /** * Perform an elasticsearch [index](http://elasticsearch.org/guide/reference/api/index_/) request * @@ -27,60 +27,60 @@ var versionTypeOptions = ['internal', 'external']; * @param {number} params.version - Explicit version number for concurrency control * @param {String} params.version_type - Specific version type */ -function doIndex(params, callback) { +function doIndex(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'post' || params.method === 'put') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'POST' || params.method === 'PUT') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of post, put'); + throw new TypeError('Invalid method: should be one of POST, PUT'); } } else { - request.method = 'post'; + request.method = 'POST'; } - // find the url's params + // find the paths's params if (typeof params.id !== 'undefined') { if (typeof params.id !== 'object' && params.id) { - url.id = '' + params.id; + parts.id = '' + params.id; } else { throw new TypeError('Invalid id: ' + params.id + ' should be a string.'); } } - + if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type') && url.hasOwnProperty('id')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/' + encodeURIComponent(url.id) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type') && parts.hasOwnProperty('id')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/' + encodeURIComponent(parts.id) + ''; } - else if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + ''; + else if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object]'); } - + // build the query string if (typeof params.consistency !== 'undefined') { @@ -93,7 +93,7 @@ function doIndex(params, callback) { ); } } - + if (typeof params.op_type !== 'undefined') { if (_.contains(opTypeOptions, params.op_type)) { query.op_type = params.op_type; @@ -104,7 +104,7 @@ function doIndex(params, callback) { ); } } - + if (typeof params.parent !== 'undefined') { if (typeof params.parent !== 'object' && params.parent) { query.parent = '' + params.parent; @@ -112,7 +112,7 @@ function doIndex(params, callback) { throw new TypeError('Invalid parent: ' + params.parent + ' should be a string.'); } } - + if (typeof params.percolate !== 'undefined') { if (typeof params.percolate !== 'object' && params.percolate) { query.percolate = '' + params.percolate; @@ -120,7 +120,7 @@ function doIndex(params, callback) { throw new TypeError('Invalid percolate: ' + params.percolate + ' should be a string.'); } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -130,7 +130,7 @@ function doIndex(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params.replication !== 'undefined') { if (_.contains(replicationOptions, params.replication)) { query.replication = params.replication; @@ -141,7 +141,7 @@ function doIndex(params, callback) { ); } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -149,7 +149,7 @@ function doIndex(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - + if (typeof params.timeout !== 'undefined') { if (params.timeout instanceof Date) { query.timeout = params.timeout.getTime(); @@ -159,7 +159,7 @@ function doIndex(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.timestamp !== 'undefined') { if (params.timestamp instanceof Date) { query.timestamp = params.timestamp.getTime(); @@ -169,7 +169,7 @@ function doIndex(params, callback) { throw new TypeError('Invalid timestamp: ' + params.timestamp + ' should be be some sort of time.'); } } - + if (typeof params.ttl !== 'undefined') { if (_.isNumeric(params.ttl) || _.isInterval(params.ttl)) { query.ttl = params.ttl; @@ -177,7 +177,7 @@ function doIndex(params, callback) { throw new TypeError('Invalid ttl: ' + params.ttl + ' should be a number or in interval notation (an integer followed by one of Mwdhmsy).'); } } - + if (typeof params.version !== 'undefined') { if (_.isNumeric(params.version)) { query.version = params.version * 1; @@ -185,7 +185,7 @@ function doIndex(params, callback) { throw new TypeError('Invalid version: ' + params.version + ' should be a number.'); } } - + if (typeof params.version_type !== 'undefined') { if (_.contains(versionTypeOptions, params.version_type)) { query.version_type = params.version_type; @@ -196,14 +196,10 @@ function doIndex(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndex; diff --git a/src/api/indices/analyze.js b/src/api/indices/analyze.js index 354e9759e..a87bd991b 100644 --- a/src/api/indices/analyze.js +++ b/src/api/indices/analyze.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var formatOptions = ['detailed', 'text']; - - /** * Perform an elasticsearch [indices.analyze](http://www.elasticsearch.org/guide/reference/api/admin-indices-analyze/) request * @@ -20,46 +20,46 @@ var formatOptions = ['detailed', 'text']; * @param {string} params.tokenizer - The name of the tokenizer to use for the analysis * @param {String} [params.format=detailed] - Format of the output */ -function doIndicesAnalyze(params, callback) { +function doIndicesAnalyze(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'get' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'GET' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of get, post'); + throw new TypeError('Invalid method: should be one of GET, POST'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_analyze'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_analyze'; delete params.index; } else { - request.url = '/_analyze'; + request.path = '/_analyze'; } - + // build the query string if (typeof params.analyzer !== 'undefined') { @@ -69,7 +69,7 @@ function doIndicesAnalyze(params, callback) { throw new TypeError('Invalid analyzer: ' + params.analyzer + ' should be a string.'); } } - + if (typeof params.field !== 'undefined') { if (typeof params.field !== 'object' && params.field) { query.field = '' + params.field; @@ -77,7 +77,7 @@ function doIndicesAnalyze(params, callback) { throw new TypeError('Invalid field: ' + params.field + ' should be a string.'); } } - + if (typeof params.filters !== 'undefined') { switch (typeof params.filters) { case 'string': @@ -94,7 +94,7 @@ function doIndicesAnalyze(params, callback) { query.filters = !!params.filters; } } - + if (typeof params.index !== 'undefined') { if (typeof params.index !== 'object' && params.index) { query.index = '' + params.index; @@ -102,7 +102,7 @@ function doIndicesAnalyze(params, callback) { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } } - + if (typeof params.prefer_local !== 'undefined') { if (params.prefer_local.toLowerCase && (params.prefer_local = params.prefer_local.toLowerCase()) && (params.prefer_local === 'no' || params.prefer_local === 'off') @@ -112,7 +112,7 @@ function doIndicesAnalyze(params, callback) { query.prefer_local = !!params.prefer_local; } } - + if (typeof params.text !== 'undefined') { if (typeof params.text !== 'object' && params.text) { query.text = '' + params.text; @@ -120,7 +120,7 @@ function doIndicesAnalyze(params, callback) { throw new TypeError('Invalid text: ' + params.text + ' should be a string.'); } } - + if (typeof params.tokenizer !== 'undefined') { if (typeof params.tokenizer !== 'object' && params.tokenizer) { query.tokenizer = '' + params.tokenizer; @@ -128,7 +128,7 @@ function doIndicesAnalyze(params, callback) { throw new TypeError('Invalid tokenizer: ' + params.tokenizer + ' should be a string.'); } } - + if (typeof params.format !== 'undefined') { if (_.contains(formatOptions, params.format)) { query.format = params.format; @@ -139,14 +139,10 @@ function doIndicesAnalyze(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesAnalyze; diff --git a/src/api/indices/clear_cache.js b/src/api/indices/clear_cache.js index 693863bf1..1e52b1a19 100644 --- a/src/api/indices/clear_cache.js +++ b/src/api/indices/clear_cache.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.clear_cache](http://www.elasticsearch.org/guide/reference/api/admin-indices-clearcache/) request * @@ -23,54 +23,54 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {String|ArrayOfStrings|Boolean} params.index - A comma-separated list of index name to limit the operation * @param {boolean} params.recycler - Clear the recycler cache */ -function doIndicesClearCache(params, callback) { +function doIndicesClearCache(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'post' || params.method === 'get') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'POST' || params.method === 'GET') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of post, get'); + throw new TypeError('Invalid method: should be one of POST, GET'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_cache/clear'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_cache/clear'; delete params.index; } else { - request.url = '/_cache/clear'; + request.path = '/_cache/clear'; } - + // build the query string if (typeof params.field_data !== 'undefined') { @@ -82,7 +82,7 @@ function doIndicesClearCache(params, callback) { query.field_data = !!params.field_data; } } - + if (typeof params.fielddata !== 'undefined') { if (params.fielddata.toLowerCase && (params.fielddata = params.fielddata.toLowerCase()) && (params.fielddata === 'no' || params.fielddata === 'off') @@ -92,7 +92,7 @@ function doIndicesClearCache(params, callback) { query.fielddata = !!params.fielddata; } } - + if (typeof params.fields !== 'undefined') { switch (typeof params.fields) { case 'string': @@ -109,7 +109,7 @@ function doIndicesClearCache(params, callback) { query.fields = !!params.fields; } } - + if (typeof params.filter !== 'undefined') { if (params.filter.toLowerCase && (params.filter = params.filter.toLowerCase()) && (params.filter === 'no' || params.filter === 'off') @@ -119,7 +119,7 @@ function doIndicesClearCache(params, callback) { query.filter = !!params.filter; } } - + if (typeof params.filter_cache !== 'undefined') { if (params.filter_cache.toLowerCase && (params.filter_cache = params.filter_cache.toLowerCase()) && (params.filter_cache === 'no' || params.filter_cache === 'off') @@ -129,7 +129,7 @@ function doIndicesClearCache(params, callback) { query.filter_cache = !!params.filter_cache; } } - + if (typeof params.filter_keys !== 'undefined') { if (params.filter_keys.toLowerCase && (params.filter_keys = params.filter_keys.toLowerCase()) && (params.filter_keys === 'no' || params.filter_keys === 'off') @@ -139,7 +139,7 @@ function doIndicesClearCache(params, callback) { query.filter_keys = !!params.filter_keys; } } - + if (typeof params.id !== 'undefined') { if (params.id.toLowerCase && (params.id = params.id.toLowerCase()) && (params.id === 'no' || params.id === 'off') @@ -149,7 +149,7 @@ function doIndicesClearCache(params, callback) { query.id = !!params.id; } } - + if (typeof params.id_cache !== 'undefined') { if (params.id_cache.toLowerCase && (params.id_cache = params.id_cache.toLowerCase()) && (params.id_cache === 'no' || params.id_cache === 'off') @@ -159,7 +159,7 @@ function doIndicesClearCache(params, callback) { query.id_cache = !!params.id_cache; } } - + if (typeof params.ignore_indices !== 'undefined') { if (_.contains(ignoreIndicesOptions, params.ignore_indices)) { query.ignore_indices = params.ignore_indices; @@ -170,7 +170,7 @@ function doIndicesClearCache(params, callback) { ); } } - + if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': @@ -187,7 +187,7 @@ function doIndicesClearCache(params, callback) { query.index = !!params.index; } } - + if (typeof params.recycler !== 'undefined') { if (params.recycler.toLowerCase && (params.recycler = params.recycler.toLowerCase()) && (params.recycler === 'no' || params.recycler === 'off') @@ -197,14 +197,10 @@ function doIndicesClearCache(params, callback) { query.recycler = !!params.recycler; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesClearCache; diff --git a/src/api/indices/close.js b/src/api/indices/close.js index 55aac7bbc..a29589d2a 100644 --- a/src/api/indices/close.js +++ b/src/api/indices/close.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.close](http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close/) request @@ -12,34 +12,34 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Explicit operation timeout * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesClose(params, callback) { +function doIndicesClose(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'post'; - // find the url's params + request.method = 'POST'; + + // find the paths's params if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_close'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_close'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string if (typeof params.timeout !== 'undefined') { @@ -51,7 +51,7 @@ function doIndicesClose(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -61,14 +61,10 @@ function doIndicesClose(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesClose; diff --git a/src/api/indices/create.js b/src/api/indices/create.js index b09535a4e..c8d2bbc85 100644 --- a/src/api/indices/create.js +++ b/src/api/indices/create.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.create](http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index/) request @@ -12,43 +12,43 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Explicit operation timeout * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesCreate(params, callback) { +function doIndicesCreate(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'put' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'PUT' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of put, post'); + throw new TypeError('Invalid method: should be one of PUT, POST'); } } else { - request.method = 'put'; + request.method = 'PUT'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + ''; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string if (typeof params.timeout !== 'undefined') { @@ -60,7 +60,7 @@ function doIndicesCreate(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -70,14 +70,10 @@ function doIndicesCreate(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesCreate; diff --git a/src/api/indices/delete.js b/src/api/indices/delete.js index d5187bee8..179b7d8ef 100644 --- a/src/api/indices/delete.js +++ b/src/api/indices/delete.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.delete](http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-index/) request @@ -12,45 +12,45 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Explicit operation timeout * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesDelete(params, callback) { +function doIndicesDelete(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'delete'; - // find the url's params + request.method = 'DELETE'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + ''; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + ''; } else { - request.url = '/'; + request.path = '/'; } - + // build the query string if (typeof params.timeout !== 'undefined') { @@ -62,7 +62,7 @@ function doIndicesDelete(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -72,14 +72,10 @@ function doIndicesDelete(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesDelete; diff --git a/src/api/indices/delete_alias.js b/src/api/indices/delete_alias.js index cb68398fa..ed753d9cc 100644 --- a/src/api/indices/delete_alias.js +++ b/src/api/indices/delete_alias.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.delete_alias](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request @@ -12,40 +12,40 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Explicit timestamp for the document * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesDeleteAlias(params, callback) { +function doIndicesDeleteAlias(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'delete'; - // find the url's params + request.method = 'DELETE'; + + // find the paths's params if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.name !== 'object' && params.name) { - url.name = '' + params.name; + parts.name = '' + params.name; } else { throw new TypeError('Invalid name: ' + params.name + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('name')) { - request.url = '/' + encodeURIComponent(url.index) + '/_alias/' + encodeURIComponent(url.name) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('name')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_alias/' + encodeURIComponent(parts.name) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object]'); } - + // build the query string if (typeof params.timeout !== 'undefined') { @@ -57,7 +57,7 @@ function doIndicesDeleteAlias(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -67,14 +67,10 @@ function doIndicesDeleteAlias(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesDeleteAlias; diff --git a/src/api/indices/delete_mapping.js b/src/api/indices/delete_mapping.js index ec7f8e0a4..edeeef84a 100644 --- a/src/api/indices/delete_mapping.js +++ b/src/api/indices/delete_mapping.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.delete_mapping](http://www.elasticsearch.org/guide/reference/api/admin-indices-delete-mapping/) request @@ -11,49 +11,49 @@ var _ = require('../../lib/toolbelt') * @param {Object} params - An object with parameters used to carry out this action * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesDeleteMapping(params, callback) { +function doIndicesDeleteMapping(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'delete'; - // find the url's params + request.method = 'DELETE'; + + // find the paths's params switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } - + if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object]'); } - + // build the query string if (typeof params.master_timeout !== 'undefined') { @@ -65,14 +65,10 @@ function doIndicesDeleteMapping(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesDeleteMapping; diff --git a/src/api/indices/delete_template.js b/src/api/indices/delete_template.js index d65a9858c..6af3ef8c5 100644 --- a/src/api/indices/delete_template.js +++ b/src/api/indices/delete_template.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.delete_template](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/) request @@ -12,34 +12,34 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Explicit operation timeout * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesDeleteTemplate(params, callback) { +function doIndicesDeleteTemplate(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'delete'; - // find the url's params + request.method = 'DELETE'; + + // find the paths's params if (typeof params.name !== 'object' && params.name) { - url.name = '' + params.name; + parts.name = '' + params.name; } else { throw new TypeError('Invalid name: ' + params.name + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('name')) { - request.url = '/_template/' + encodeURIComponent(url.name) + ''; + + // build the path + if (parts.hasOwnProperty('name')) { + request.path = '/_template/' + encodeURIComponent(parts.name) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string if (typeof params.timeout !== 'undefined') { @@ -51,7 +51,7 @@ function doIndicesDeleteTemplate(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -61,14 +61,10 @@ function doIndicesDeleteTemplate(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesDeleteTemplate; diff --git a/src/api/indices/delete_warmer.js b/src/api/indices/delete_warmer.js index c1647f191..25ec5ff1d 100644 --- a/src/api/indices/delete_warmer.js +++ b/src/api/indices/delete_warmer.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.delete_warmer](http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/) request @@ -11,74 +11,74 @@ var _ = require('../../lib/toolbelt') * @param {Object} params - An object with parameters used to carry out this action * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesDeleteWarmer(params, callback) { +function doIndicesDeleteWarmer(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'delete'; - // find the url's params + request.method = 'DELETE'; + + // find the paths's params switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } - + if (typeof params.name !== 'undefined') { if (typeof params.name !== 'object' && params.name) { - url.name = '' + params.name; + parts.name = '' + params.name; } else { throw new TypeError('Invalid name: ' + params.name + ' should be a string.'); } } - + if (typeof params.type !== 'undefined') { switch (typeof params.type) { case 'string': - url.type = params.type; + parts.type = params.type; break; case 'object': if (_.isArray(params.type)) { - url.type = params.type.join(','); + parts.type = params.type.join(','); } else { throw new TypeError('Invalid type: ' + params.type + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.type = !!params.type; + parts.type = !!params.type; } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type') && url.hasOwnProperty('name')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_warmer/' + encodeURIComponent(url.name) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type') && parts.hasOwnProperty('name')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_warmer/' + encodeURIComponent(parts.name) + ''; } - else if (url.hasOwnProperty('index') && url.hasOwnProperty('name')) { - request.url = '/' + encodeURIComponent(url.index) + '/_warmer/' + encodeURIComponent(url.name) + ''; + else if (parts.hasOwnProperty('index') && parts.hasOwnProperty('name')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_warmer/' + encodeURIComponent(parts.name) + ''; } - else if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_warmer'; + else if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_warmer'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string if (typeof params.master_timeout !== 'undefined') { @@ -90,14 +90,10 @@ function doIndicesDeleteWarmer(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesDeleteWarmer; diff --git a/src/api/indices/exists.js b/src/api/indices/exists.js index d863c6202..3c2e91ac9 100644 --- a/src/api/indices/exists.js +++ b/src/api/indices/exists.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.exists](http://www.elasticsearch.org/guide/reference/api/admin-indices-indices-exists/) request @@ -10,53 +10,55 @@ var _ = require('../../lib/toolbelt') * @method indices.exists * @param {Object} params - An object with parameters used to carry out this action */ -function doIndicesExists(params, callback) { +function doIndicesExists(params, cb) { params = params || {}; var request = { ignore: _.union([404], params.ignore) } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'head'; - // find the url's params + request.method = 'HEAD'; + + // find the paths's params switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + ''; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string - request.url = request.url + _.makeQueryString(query); + request.path = request.path + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + this.client.request(request, function (err, response) { + if (err instanceof errors.NotFound) { + cb(err, false); + } else { + cb(err, true); + } + }); } module.exports = doIndicesExists; diff --git a/src/api/indices/exists_alias.js b/src/api/indices/exists_alias.js index c4c823d01..a3ea5dd30 100644 --- a/src/api/indices/exists_alias.js +++ b/src/api/indices/exists_alias.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.exists_alias](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request * @@ -13,63 +13,63 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {Object} params - An object with parameters used to carry out this action * @param {String} [params.ignore_indices=none] - When performed on multiple indices, allows to ignore `missing` ones */ -function doIndicesExistsAlias(params, callback) { +function doIndicesExistsAlias(params, cb) { params = params || {}; var request = { ignore: _.union([404], params.ignore) } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'head'; - // find the url's params + request.method = 'HEAD'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - + switch (typeof params.name) { case 'string': - url.name = params.name; + parts.name = params.name; break; case 'object': if (_.isArray(params.name)) { - url.name = params.name.join(','); + parts.name = params.name.join(','); } else { throw new TypeError('Invalid name: ' + params.name + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.name = !!params.name; + parts.name = !!params.name; } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('name')) { - request.url = '/' + encodeURIComponent(url.index) + '/_alias/' + encodeURIComponent(url.name) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('name')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_alias/' + encodeURIComponent(parts.name) + ''; } - else if (url.hasOwnProperty('name')) { - request.url = '/_alias/' + encodeURIComponent(url.name) + ''; + else if (parts.hasOwnProperty('name')) { + request.path = '/_alias/' + encodeURIComponent(parts.name) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string if (typeof params.ignore_indices !== 'undefined') { @@ -82,14 +82,16 @@ function doIndicesExistsAlias(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, function (err, response) { + if (err instanceof errors.NotFound) { + cb(err, false); + } else { + cb(err, true); + } + }); } module.exports = doIndicesExistsAlias; diff --git a/src/api/indices/exists_type.js b/src/api/indices/exists_type.js index 39d7c3677..24a2bb858 100644 --- a/src/api/indices/exists_type.js +++ b/src/api/indices/exists_type.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.exists_type](http://www.elasticsearch.org/guide/reference/api/admin-indices-types-exists/) request * @@ -13,58 +13,58 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {Object} params - An object with parameters used to carry out this action * @param {String} [params.ignore_indices=none] - When performed on multiple indices, allows to ignore `missing` ones */ -function doIndicesExistsType(params, callback) { +function doIndicesExistsType(params, cb) { params = params || {}; var request = { ignore: _.union([404], params.ignore) } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'head'; - // find the url's params + request.method = 'HEAD'; + + // find the paths's params switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } - + switch (typeof params.type) { case 'string': - url.type = params.type; + parts.type = params.type; break; case 'object': if (_.isArray(params.type)) { - url.type = params.type.join(','); + parts.type = params.type.join(','); } else { throw new TypeError('Invalid type: ' + params.type + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.type = !!params.type; + parts.type = !!params.type; } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object]'); } - + // build the query string if (typeof params.ignore_indices !== 'undefined') { @@ -77,14 +77,16 @@ function doIndicesExistsType(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, function (err, response) { + if (err instanceof errors.NotFound) { + cb(err, false); + } else { + cb(err, true); + } + }); } module.exports = doIndicesExistsType; diff --git a/src/api/indices/flush.js b/src/api/indices/flush.js index a572f18d4..a1ffd0170 100644 --- a/src/api/indices/flush.js +++ b/src/api/indices/flush.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.flush](http://www.elasticsearch.org/guide/reference/api/admin-indices-flush/) request * @@ -16,53 +16,53 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {String} [params.ignore_indices=none] - When performed on multiple indices, allows to ignore `missing` ones * @param {boolean} params.refresh - Refresh the index after performing the operation */ -function doIndicesFlush(params, callback) { +function doIndicesFlush(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'post' || params.method === 'get') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'POST' || params.method === 'GET') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of post, get'); + throw new TypeError('Invalid method: should be one of POST, GET'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_flush'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_flush'; } else { - request.url = '/_flush'; + request.path = '/_flush'; } - + // build the query string if (typeof params.force !== 'undefined') { @@ -74,7 +74,7 @@ function doIndicesFlush(params, callback) { query.force = !!params.force; } } - + if (typeof params.full !== 'undefined') { if (params.full.toLowerCase && (params.full = params.full.toLowerCase()) && (params.full === 'no' || params.full === 'off') @@ -84,7 +84,7 @@ function doIndicesFlush(params, callback) { query.full = !!params.full; } } - + if (typeof params.ignore_indices !== 'undefined') { if (_.contains(ignoreIndicesOptions, params.ignore_indices)) { query.ignore_indices = params.ignore_indices; @@ -95,7 +95,7 @@ function doIndicesFlush(params, callback) { ); } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -105,14 +105,10 @@ function doIndicesFlush(params, callback) { query.refresh = !!params.refresh; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesFlush; diff --git a/src/api/indices/get_alias.js b/src/api/indices/get_alias.js index 2d186eeb9..e9d02395c 100644 --- a/src/api/indices/get_alias.js +++ b/src/api/indices/get_alias.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.get_alias](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request * @@ -13,63 +13,63 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {Object} params - An object with parameters used to carry out this action * @param {String} [params.ignore_indices=none] - When performed on multiple indices, allows to ignore `missing` ones */ -function doIndicesGetAlias(params, callback) { +function doIndicesGetAlias(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - + switch (typeof params.name) { case 'string': - url.name = params.name; + parts.name = params.name; break; case 'object': if (_.isArray(params.name)) { - url.name = params.name.join(','); + parts.name = params.name.join(','); } else { throw new TypeError('Invalid name: ' + params.name + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.name = !!params.name; + parts.name = !!params.name; } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('name')) { - request.url = '/' + encodeURIComponent(url.index) + '/_alias/' + encodeURIComponent(url.name) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('name')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_alias/' + encodeURIComponent(parts.name) + ''; } - else if (url.hasOwnProperty('name')) { - request.url = '/_alias/' + encodeURIComponent(url.name) + ''; + else if (parts.hasOwnProperty('name')) { + request.path = '/_alias/' + encodeURIComponent(parts.name) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string if (typeof params.ignore_indices !== 'undefined') { @@ -82,14 +82,10 @@ function doIndicesGetAlias(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesGetAlias; diff --git a/src/api/indices/get_aliases.js b/src/api/indices/get_aliases.js index 2fd0cb1d0..4b230c09e 100644 --- a/src/api/indices/get_aliases.js +++ b/src/api/indices/get_aliases.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.get_aliases](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request @@ -11,45 +11,45 @@ var _ = require('../../lib/toolbelt') * @param {Object} params - An object with parameters used to carry out this action * @param {Date|Number} params.timeout - Explicit operation timeout */ -function doIndicesGetAliases(params, callback) { +function doIndicesGetAliases(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_aliases'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_aliases'; } else { - request.url = '/_aliases'; + request.path = '/_aliases'; } - + // build the query string if (typeof params.timeout !== 'undefined') { @@ -61,14 +61,10 @@ function doIndicesGetAliases(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesGetAliases; diff --git a/src/api/indices/get_mapping.js b/src/api/indices/get_mapping.js index e03ea5bba..d70ac0c6e 100644 --- a/src/api/indices/get_mapping.js +++ b/src/api/indices/get_mapping.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.get_mapping](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-mapping/) request @@ -10,75 +10,71 @@ var _ = require('../../lib/toolbelt') * @method indices.get_mapping * @param {Object} params - An object with parameters used to carry out this action */ -function doIndicesGetMapping(params, callback) { +function doIndicesGetMapping(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - + if (typeof params.type !== 'undefined') { switch (typeof params.type) { case 'string': - url.type = params.type; + parts.type = params.type; break; case 'object': if (_.isArray(params.type)) { - url.type = params.type.join(','); + parts.type = params.type.join(','); } else { throw new TypeError('Invalid type: ' + params.type + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.type = !!params.type; + parts.type = !!params.type; } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_mapping'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_mapping'; } - else if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_mapping'; + else if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_mapping'; } else { - request.url = '/_mapping'; + request.path = '/_mapping'; } - + // build the query string - request.url = request.url + _.makeQueryString(query); + request.path = request.path + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + this.client.request(request, cb); } module.exports = doIndicesGetMapping; diff --git a/src/api/indices/get_settings.js b/src/api/indices/get_settings.js index 2407aabdd..f0712d9d9 100644 --- a/src/api/indices/get_settings.js +++ b/src/api/indices/get_settings.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.get_settings](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/) request @@ -10,55 +10,51 @@ var _ = require('../../lib/toolbelt') * @method indices.get_settings * @param {Object} params - An object with parameters used to carry out this action */ -function doIndicesGetSettings(params, callback) { +function doIndicesGetSettings(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_settings'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_settings'; } else { - request.url = '/_settings'; + request.path = '/_settings'; } - + // build the query string - request.url = request.url + _.makeQueryString(query); + request.path = request.path + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + this.client.request(request, cb); } module.exports = doIndicesGetSettings; diff --git a/src/api/indices/get_template.js b/src/api/indices/get_template.js index 1eb0900b9..84cbd9f87 100644 --- a/src/api/indices/get_template.js +++ b/src/api/indices/get_template.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.get_template](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/) request @@ -10,44 +10,40 @@ var _ = require('../../lib/toolbelt') * @method indices.get_template * @param {Object} params - An object with parameters used to carry out this action */ -function doIndicesGetTemplate(params, callback) { +function doIndicesGetTemplate(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.name !== 'object' && params.name) { - url.name = '' + params.name; + parts.name = '' + params.name; } else { throw new TypeError('Invalid name: ' + params.name + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('name')) { - request.url = '/_template/' + encodeURIComponent(url.name) + ''; + + // build the path + if (parts.hasOwnProperty('name')) { + request.path = '/_template/' + encodeURIComponent(parts.name) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string - request.url = request.url + _.makeQueryString(query); + request.path = request.path + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + this.client.request(request, cb); } module.exports = doIndicesGetTemplate; diff --git a/src/api/indices/get_warmer.js b/src/api/indices/get_warmer.js index 1df6aad47..78a27e384 100644 --- a/src/api/indices/get_warmer.js +++ b/src/api/indices/get_warmer.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.get_warmer](http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/) request @@ -10,84 +10,80 @@ var _ = require('../../lib/toolbelt') * @method indices.get_warmer * @param {Object} params - An object with parameters used to carry out this action */ -function doIndicesGetWarmer(params, callback) { +function doIndicesGetWarmer(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } - + if (typeof params.name !== 'undefined') { if (typeof params.name !== 'object' && params.name) { - url.name = '' + params.name; + parts.name = '' + params.name; } else { throw new TypeError('Invalid name: ' + params.name + ' should be a string.'); } } - + if (typeof params.type !== 'undefined') { switch (typeof params.type) { case 'string': - url.type = params.type; + parts.type = params.type; break; case 'object': if (_.isArray(params.type)) { - url.type = params.type.join(','); + parts.type = params.type.join(','); } else { throw new TypeError('Invalid type: ' + params.type + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.type = !!params.type; + parts.type = !!params.type; } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type') && url.hasOwnProperty('name')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_warmer/' + encodeURIComponent(url.name) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type') && parts.hasOwnProperty('name')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_warmer/' + encodeURIComponent(parts.name) + ''; } - else if (url.hasOwnProperty('index') && url.hasOwnProperty('name')) { - request.url = '/' + encodeURIComponent(url.index) + '/_warmer/' + encodeURIComponent(url.name) + ''; + else if (parts.hasOwnProperty('index') && parts.hasOwnProperty('name')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_warmer/' + encodeURIComponent(parts.name) + ''; } - else if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_warmer'; + else if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_warmer'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string - request.url = request.url + _.makeQueryString(query); + request.path = request.path + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + this.client.request(request, cb); } module.exports = doIndicesGetWarmer; diff --git a/src/api/indices/open.js b/src/api/indices/open.js index 9f0eeddf1..395448488 100644 --- a/src/api/indices/open.js +++ b/src/api/indices/open.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.open](http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close/) request @@ -12,34 +12,34 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Explicit operation timeout * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesOpen(params, callback) { +function doIndicesOpen(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'post'; - // find the url's params + request.method = 'POST'; + + // find the paths's params if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_open'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_open'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string if (typeof params.timeout !== 'undefined') { @@ -51,7 +51,7 @@ function doIndicesOpen(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -61,14 +61,10 @@ function doIndicesOpen(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesOpen; diff --git a/src/api/indices/optimize.js b/src/api/indices/optimize.js index da44c1688..4e0662857 100644 --- a/src/api/indices/optimize.js +++ b/src/api/indices/optimize.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.optimize](http://www.elasticsearch.org/guide/reference/api/admin-indices-optimize/) request * @@ -19,53 +19,53 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {boolean} params.refresh - Specify whether the index should be refreshed after performing the operation (default: true) * @param {boolean} params.wait_for_merge - Specify whether the request should block until the merge process is finished (default: true) */ -function doIndicesOptimize(params, callback) { +function doIndicesOptimize(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'post' || params.method === 'get') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'POST' || params.method === 'GET') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of post, get'); + throw new TypeError('Invalid method: should be one of POST, GET'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_optimize'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_optimize'; } else { - request.url = '/_optimize'; + request.path = '/_optimize'; } - + // build the query string if (typeof params.flush !== 'undefined') { @@ -77,7 +77,7 @@ function doIndicesOptimize(params, callback) { query.flush = !!params.flush; } } - + if (typeof params.ignore_indices !== 'undefined') { if (_.contains(ignoreIndicesOptions, params.ignore_indices)) { query.ignore_indices = params.ignore_indices; @@ -88,7 +88,7 @@ function doIndicesOptimize(params, callback) { ); } } - + if (typeof params.max_num_segments !== 'undefined') { if (_.isNumeric(params.max_num_segments)) { query.max_num_segments = params.max_num_segments * 1; @@ -96,7 +96,7 @@ function doIndicesOptimize(params, callback) { throw new TypeError('Invalid max_num_segments: ' + params.max_num_segments + ' should be a number.'); } } - + if (typeof params.only_expunge_deletes !== 'undefined') { if (params.only_expunge_deletes.toLowerCase && (params.only_expunge_deletes = params.only_expunge_deletes.toLowerCase()) && (params.only_expunge_deletes === 'no' || params.only_expunge_deletes === 'off') @@ -106,11 +106,11 @@ function doIndicesOptimize(params, callback) { query.only_expunge_deletes = !!params.only_expunge_deletes; } } - + if (typeof params.operation_threading !== 'undefined') { query.operation_threading = params.operation_threading; } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -120,7 +120,7 @@ function doIndicesOptimize(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params.wait_for_merge !== 'undefined') { if (params.wait_for_merge.toLowerCase && (params.wait_for_merge = params.wait_for_merge.toLowerCase()) && (params.wait_for_merge === 'no' || params.wait_for_merge === 'off') @@ -130,14 +130,10 @@ function doIndicesOptimize(params, callback) { query.wait_for_merge = !!params.wait_for_merge; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesOptimize; diff --git a/src/api/indices/put_alias.js b/src/api/indices/put_alias.js index 77d68acce..14b7aee14 100644 --- a/src/api/indices/put_alias.js +++ b/src/api/indices/put_alias.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.put_alias](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request @@ -12,47 +12,47 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Explicit timestamp for the document * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesPutAlias(params, callback) { +function doIndicesPutAlias(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'put'; - // find the url's params + request.method = 'PUT'; + + // find the paths's params if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.name !== 'object' && params.name) { - url.name = '' + params.name; + parts.name = '' + params.name; } else { throw new TypeError('Invalid name: ' + params.name + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('name')) { - request.url = '/' + encodeURIComponent(url.index) + '/_alias/' + encodeURIComponent(url.name) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('name')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_alias/' + encodeURIComponent(parts.name) + ''; } - else if (url.hasOwnProperty('name')) { - request.url = '/_alias/' + encodeURIComponent(url.name) + ''; + else if (parts.hasOwnProperty('name')) { + request.path = '/_alias/' + encodeURIComponent(parts.name) + ''; } - else if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_alias'; + else if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_alias'; } else { - request.url = '/_alias'; + request.path = '/_alias'; } - + // build the query string if (typeof params.timeout !== 'undefined') { @@ -64,7 +64,7 @@ function doIndicesPutAlias(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -74,14 +74,10 @@ function doIndicesPutAlias(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesPutAlias; diff --git a/src/api/indices/put_mapping.js b/src/api/indices/put_mapping.js index 7cf7f4224..a63820f15 100644 --- a/src/api/indices/put_mapping.js +++ b/src/api/indices/put_mapping.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.put_mapping](http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping/) request @@ -13,58 +13,58 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Explicit operation timeout * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesPutMapping(params, callback) { +function doIndicesPutMapping(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'put' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'PUT' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of put, post'); + throw new TypeError('Invalid method: should be one of PUT, POST'); } } else { - request.method = 'put'; + request.method = 'PUT'; } - // find the url's params + // find the paths's params switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } - + if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_mapping'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_mapping'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object]'); } - + // build the query string if (typeof params.ignore_conflicts !== 'undefined') { @@ -76,7 +76,7 @@ function doIndicesPutMapping(params, callback) { query.ignore_conflicts = !!params.ignore_conflicts; } } - + if (typeof params.timeout !== 'undefined') { if (params.timeout instanceof Date) { query.timeout = params.timeout.getTime(); @@ -86,7 +86,7 @@ function doIndicesPutMapping(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -96,14 +96,10 @@ function doIndicesPutMapping(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesPutMapping; diff --git a/src/api/indices/put_settings.js b/src/api/indices/put_settings.js index 7cb4a1bd5..340b2395d 100644 --- a/src/api/indices/put_settings.js +++ b/src/api/indices/put_settings.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.put_settings](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings/) request @@ -11,46 +11,46 @@ var _ = require('../../lib/toolbelt') * @param {Object} params - An object with parameters used to carry out this action * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesPutSettings(params, callback) { +function doIndicesPutSettings(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'put'; - // find the url's params + request.method = 'PUT'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_settings'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_settings'; } else { - request.url = '/_settings'; + request.path = '/_settings'; } - + // build the query string if (typeof params.master_timeout !== 'undefined') { @@ -62,14 +62,10 @@ function doIndicesPutSettings(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesPutSettings; diff --git a/src/api/indices/put_template.js b/src/api/indices/put_template.js index db3f4b95c..adcdf24e9 100644 --- a/src/api/indices/put_template.js +++ b/src/api/indices/put_template.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.put_template](http://www.elasticsearch.org/guide/reference/api/admin-indices-templates/) request @@ -13,43 +13,43 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Explicit operation timeout * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesPutTemplate(params, callback) { +function doIndicesPutTemplate(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'put' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'PUT' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of put, post'); + throw new TypeError('Invalid method: should be one of PUT, POST'); } } else { - request.method = 'put'; + request.method = 'PUT'; } - // find the url's params + // find the paths's params if (typeof params.name !== 'object' && params.name) { - url.name = '' + params.name; + parts.name = '' + params.name; } else { throw new TypeError('Invalid name: ' + params.name + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('name')) { - request.url = '/_template/' + encodeURIComponent(url.name) + ''; + + // build the path + if (parts.hasOwnProperty('name')) { + request.path = '/_template/' + encodeURIComponent(parts.name) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object]'); } - + // build the query string if (typeof params.order !== 'undefined') { @@ -59,7 +59,7 @@ function doIndicesPutTemplate(params, callback) { throw new TypeError('Invalid order: ' + params.order + ' should be a number.'); } } - + if (typeof params.timeout !== 'undefined') { if (params.timeout instanceof Date) { query.timeout = params.timeout.getTime(); @@ -69,7 +69,7 @@ function doIndicesPutTemplate(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -79,14 +79,10 @@ function doIndicesPutTemplate(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesPutTemplate; diff --git a/src/api/indices/put_warmer.js b/src/api/indices/put_warmer.js index 983d7e754..f8d847333 100644 --- a/src/api/indices/put_warmer.js +++ b/src/api/indices/put_warmer.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.put_warmer](http://www.elasticsearch.org/guide/reference/api/admin-indices-warmers/) request @@ -11,70 +11,70 @@ var _ = require('../../lib/toolbelt') * @param {Object} params - An object with parameters used to carry out this action * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesPutWarmer(params, callback) { +function doIndicesPutWarmer(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'put'; - // find the url's params + request.method = 'PUT'; + + // find the paths's params switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } - + if (typeof params.name !== 'object' && params.name) { - url.name = '' + params.name; + parts.name = '' + params.name; } else { throw new TypeError('Invalid name: ' + params.name + ' should be a string.'); } - + if (typeof params.type !== 'undefined') { switch (typeof params.type) { case 'string': - url.type = params.type; + parts.type = params.type; break; case 'object': if (_.isArray(params.type)) { - url.type = params.type.join(','); + parts.type = params.type.join(','); } else { throw new TypeError('Invalid type: ' + params.type + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.type = !!params.type; + parts.type = !!params.type; } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type') && url.hasOwnProperty('name')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_warmer/' + encodeURIComponent(url.name) + ''; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type') && parts.hasOwnProperty('name')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_warmer/' + encodeURIComponent(parts.name) + ''; } - else if (url.hasOwnProperty('index') && url.hasOwnProperty('name')) { - request.url = '/' + encodeURIComponent(url.index) + '/_warmer/' + encodeURIComponent(url.name) + ''; + else if (parts.hasOwnProperty('index') && parts.hasOwnProperty('name')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_warmer/' + encodeURIComponent(parts.name) + ''; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object]'); } - + // build the query string if (typeof params.master_timeout !== 'undefined') { @@ -86,14 +86,10 @@ function doIndicesPutWarmer(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesPutWarmer; diff --git a/src/api/indices/refresh.js b/src/api/indices/refresh.js index b99dd2a44..ce438d778 100644 --- a/src/api/indices/refresh.js +++ b/src/api/indices/refresh.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.refresh](http://www.elasticsearch.org/guide/reference/api/admin-indices-refresh/) request * @@ -14,53 +14,53 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {String} [params.ignore_indices=none] - When performed on multiple indices, allows to ignore `missing` ones * @param {*} params.operation_threading - TODO: ? */ -function doIndicesRefresh(params, callback) { +function doIndicesRefresh(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'post' || params.method === 'get') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'POST' || params.method === 'GET') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of post, get'); + throw new TypeError('Invalid method: should be one of POST, GET'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_refresh'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_refresh'; } else { - request.url = '/_refresh'; + request.path = '/_refresh'; } - + // build the query string if (typeof params.ignore_indices !== 'undefined') { @@ -73,18 +73,14 @@ function doIndicesRefresh(params, callback) { ); } } - + if (typeof params.operation_threading !== 'undefined') { query.operation_threading = params.operation_threading; } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesRefresh; diff --git a/src/api/indices/segments.js b/src/api/indices/segments.js index c80aafccd..e32039ae0 100644 --- a/src/api/indices/segments.js +++ b/src/api/indices/segments.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.segments](http://elasticsearch.org/guide/reference/api/admin-indices-segments/) request * @@ -14,45 +14,45 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {String} [params.ignore_indices=none] - When performed on multiple indices, allows to ignore `missing` ones * @param {*} params.operation_threading - TODO: ? */ -function doIndicesSegments(params, callback) { +function doIndicesSegments(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_segments'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_segments'; } else { - request.url = '/_segments'; + request.path = '/_segments'; } - + // build the query string if (typeof params.ignore_indices !== 'undefined') { @@ -65,18 +65,14 @@ function doIndicesSegments(params, callback) { ); } } - + if (typeof params.operation_threading !== 'undefined') { query.operation_threading = params.operation_threading; } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesSegments; diff --git a/src/api/indices/snapshot_index.js b/src/api/indices/snapshot_index.js index 02a384908..5c7da0dbd 100644 --- a/src/api/indices/snapshot_index.js +++ b/src/api/indices/snapshot_index.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.snapshot_index](http://www.elasticsearch.org/guide/reference/api/admin-indices-gateway-snapshot/) request * @@ -13,45 +13,45 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {Object} params - An object with parameters used to carry out this action * @param {String} [params.ignore_indices=none] - When performed on multiple indices, allows to ignore `missing` ones */ -function doIndicesSnapshotIndex(params, callback) { +function doIndicesSnapshotIndex(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'post'; - // find the url's params + request.method = 'POST'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_gateway/snapshot'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_gateway/snapshot'; } else { - request.url = '/_gateway/snapshot'; + request.path = '/_gateway/snapshot'; } - + // build the query string if (typeof params.ignore_indices !== 'undefined') { @@ -64,14 +64,10 @@ function doIndicesSnapshotIndex(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesSnapshotIndex; diff --git a/src/api/indices/stats.js b/src/api/indices/stats.js index d9bd8e18a..b800df599 100644 --- a/src/api/indices/stats.js +++ b/src/api/indices/stats.js @@ -1,11 +1,11 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; var metricFamilyOptions = ['completion', 'docs', 'fielddata', 'filter_cache', 'flush', 'get', 'groups', 'id_cache', 'ignore_indices', 'indexing', 'merge', 'refresh', 'search', 'store', 'warmer']; - - /** * Perform an elasticsearch [indices.stats](http://elasticsearch.org/guide/reference/api/admin-indices-stats/) request * @@ -33,73 +33,73 @@ var metricFamilyOptions = ['completion', 'docs', 'fielddata', 'filter_cache', 'f * @param {boolean} params.store - Return information about the size of the index * @param {boolean} params.warmer - Return information about warmers */ -function doIndicesStats(params, callback) { +function doIndicesStats(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.fields !== 'undefined') { switch (typeof params.fields) { case 'string': - url.fields = params.fields; + parts.fields = params.fields; break; case 'object': if (_.isArray(params.fields)) { - url.fields = params.fields.join(','); + parts.fields = params.fields.join(','); } else { throw new TypeError('Invalid fields: ' + params.fields + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.fields = !!params.fields; + parts.fields = !!params.fields; } } - + if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - + if (typeof params.indexing_types !== 'undefined') { switch (typeof params.indexing_types) { case 'string': - url.indexing_types = params.indexing_types; + parts.indexing_types = params.indexing_types; break; case 'object': if (_.isArray(params.indexing_types)) { - url.indexing_types = params.indexing_types.join(','); + parts.indexing_types = params.indexing_types.join(','); } else { throw new TypeError('Invalid indexing_types: ' + params.indexing_types + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.indexing_types = !!params.indexing_types; + parts.indexing_types = !!params.indexing_types; } } - + if (typeof params.metric_family !== 'undefined') { if (_.contains(metricFamilyOptions, params.metric_family)) { - url.metric_family = params.metric_family; + parts.metric_family = params.metric_family; } else { throw new TypeError( 'Invalid metric_family: ' + params.metric_family + @@ -107,33 +107,33 @@ function doIndicesStats(params, callback) { ); } } - + if (typeof params.search_groups !== 'undefined') { switch (typeof params.search_groups) { case 'string': - url.search_groups = params.search_groups; + parts.search_groups = params.search_groups; break; case 'object': if (_.isArray(params.search_groups)) { - url.search_groups = params.search_groups.join(','); + parts.search_groups = params.search_groups.join(','); } else { throw new TypeError('Invalid search_groups: ' + params.search_groups + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.search_groups = !!params.search_groups; + parts.search_groups = !!params.search_groups; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_stats'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_stats'; } else { - request.url = '/_stats'; + request.path = '/_stats'; } - + // build the query string if (typeof params.all !== 'undefined') { @@ -145,7 +145,7 @@ function doIndicesStats(params, callback) { query.all = !!params.all; } } - + if (typeof params.clear !== 'undefined') { if (params.clear.toLowerCase && (params.clear = params.clear.toLowerCase()) && (params.clear === 'no' || params.clear === 'off') @@ -155,7 +155,7 @@ function doIndicesStats(params, callback) { query.clear = !!params.clear; } } - + if (typeof params.completion !== 'undefined') { if (params.completion.toLowerCase && (params.completion = params.completion.toLowerCase()) && (params.completion === 'no' || params.completion === 'off') @@ -165,7 +165,7 @@ function doIndicesStats(params, callback) { query.completion = !!params.completion; } } - + if (typeof params.completion_fields !== 'undefined') { switch (typeof params.completion_fields) { case 'string': @@ -182,7 +182,7 @@ function doIndicesStats(params, callback) { query.completion_fields = !!params.completion_fields; } } - + if (typeof params.docs !== 'undefined') { if (params.docs.toLowerCase && (params.docs = params.docs.toLowerCase()) && (params.docs === 'no' || params.docs === 'off') @@ -192,7 +192,7 @@ function doIndicesStats(params, callback) { query.docs = !!params.docs; } } - + if (typeof params.fielddata !== 'undefined') { if (params.fielddata.toLowerCase && (params.fielddata = params.fielddata.toLowerCase()) && (params.fielddata === 'no' || params.fielddata === 'off') @@ -202,7 +202,7 @@ function doIndicesStats(params, callback) { query.fielddata = !!params.fielddata; } } - + if (typeof params.fielddata_fields !== 'undefined') { switch (typeof params.fielddata_fields) { case 'string': @@ -219,7 +219,7 @@ function doIndicesStats(params, callback) { query.fielddata_fields = !!params.fielddata_fields; } } - + if (typeof params.fields !== 'undefined') { switch (typeof params.fields) { case 'string': @@ -236,7 +236,7 @@ function doIndicesStats(params, callback) { query.fields = !!params.fields; } } - + if (typeof params.filter_cache !== 'undefined') { if (params.filter_cache.toLowerCase && (params.filter_cache = params.filter_cache.toLowerCase()) && (params.filter_cache === 'no' || params.filter_cache === 'off') @@ -246,7 +246,7 @@ function doIndicesStats(params, callback) { query.filter_cache = !!params.filter_cache; } } - + if (typeof params.flush !== 'undefined') { if (params.flush.toLowerCase && (params.flush = params.flush.toLowerCase()) && (params.flush === 'no' || params.flush === 'off') @@ -256,7 +256,7 @@ function doIndicesStats(params, callback) { query.flush = !!params.flush; } } - + if (typeof params.get !== 'undefined') { if (params.get.toLowerCase && (params.get = params.get.toLowerCase()) && (params.get === 'no' || params.get === 'off') @@ -266,7 +266,7 @@ function doIndicesStats(params, callback) { query.get = !!params.get; } } - + if (typeof params.groups !== 'undefined') { if (params.groups.toLowerCase && (params.groups = params.groups.toLowerCase()) && (params.groups === 'no' || params.groups === 'off') @@ -276,7 +276,7 @@ function doIndicesStats(params, callback) { query.groups = !!params.groups; } } - + if (typeof params.id_cache !== 'undefined') { if (params.id_cache.toLowerCase && (params.id_cache = params.id_cache.toLowerCase()) && (params.id_cache === 'no' || params.id_cache === 'off') @@ -286,7 +286,7 @@ function doIndicesStats(params, callback) { query.id_cache = !!params.id_cache; } } - + if (typeof params.ignore_indices !== 'undefined') { if (_.contains(ignoreIndicesOptions, params.ignore_indices)) { query.ignore_indices = params.ignore_indices; @@ -297,7 +297,7 @@ function doIndicesStats(params, callback) { ); } } - + if (typeof params.indexing !== 'undefined') { if (params.indexing.toLowerCase && (params.indexing = params.indexing.toLowerCase()) && (params.indexing === 'no' || params.indexing === 'off') @@ -307,7 +307,7 @@ function doIndicesStats(params, callback) { query.indexing = !!params.indexing; } } - + if (typeof params.merge !== 'undefined') { if (params.merge.toLowerCase && (params.merge = params.merge.toLowerCase()) && (params.merge === 'no' || params.merge === 'off') @@ -317,7 +317,7 @@ function doIndicesStats(params, callback) { query.merge = !!params.merge; } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -327,7 +327,7 @@ function doIndicesStats(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params.search !== 'undefined') { if (params.search.toLowerCase && (params.search = params.search.toLowerCase()) && (params.search === 'no' || params.search === 'off') @@ -337,7 +337,7 @@ function doIndicesStats(params, callback) { query.search = !!params.search; } } - + if (typeof params.store !== 'undefined') { if (params.store.toLowerCase && (params.store = params.store.toLowerCase()) && (params.store === 'no' || params.store === 'off') @@ -347,7 +347,7 @@ function doIndicesStats(params, callback) { query.store = !!params.store; } } - + if (typeof params.warmer !== 'undefined') { if (params.warmer.toLowerCase && (params.warmer = params.warmer.toLowerCase()) && (params.warmer === 'no' || params.warmer === 'off') @@ -357,14 +357,10 @@ function doIndicesStats(params, callback) { query.warmer = !!params.warmer; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesStats; diff --git a/src/api/indices/status.js b/src/api/indices/status.js index 70a4c74d1..f4ceac4bd 100644 --- a/src/api/indices/status.js +++ b/src/api/indices/status.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.status](http://elasticsearch.org/guide/reference/api/admin-indices-status/) request * @@ -16,45 +16,45 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {boolean} params.recovery - Return information about shard recovery * @param {boolean} params.snapshot - TODO: ? */ -function doIndicesStatus(params, callback) { +function doIndicesStatus(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'get'; - // find the url's params + request.method = 'GET'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_status'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_status'; } else { - request.url = '/_status'; + request.path = '/_status'; } - + // build the query string if (typeof params.ignore_indices !== 'undefined') { @@ -67,11 +67,11 @@ function doIndicesStatus(params, callback) { ); } } - + if (typeof params.operation_threading !== 'undefined') { query.operation_threading = params.operation_threading; } - + if (typeof params.recovery !== 'undefined') { if (params.recovery.toLowerCase && (params.recovery = params.recovery.toLowerCase()) && (params.recovery === 'no' || params.recovery === 'off') @@ -81,7 +81,7 @@ function doIndicesStatus(params, callback) { query.recovery = !!params.recovery; } } - + if (typeof params.snapshot !== 'undefined') { if (params.snapshot.toLowerCase && (params.snapshot = params.snapshot.toLowerCase()) && (params.snapshot === 'no' || params.snapshot === 'off') @@ -91,14 +91,10 @@ function doIndicesStatus(params, callback) { query.snapshot = !!params.snapshot; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesStatus; diff --git a/src/api/indices/update_aliases.js b/src/api/indices/update_aliases.js index 4b616e974..eefba4ba2 100644 --- a/src/api/indices/update_aliases.js +++ b/src/api/indices/update_aliases.js @@ -1,7 +1,7 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); - - +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [indices.update_aliases](http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases/) request @@ -12,41 +12,41 @@ var _ = require('../../lib/toolbelt') * @param {Date|Number} params.timeout - Request timeout * @param {Date|Number} params.master_timeout - Specify timeout for connection to master */ -function doIndicesUpdateAliases(params, callback) { +function doIndicesUpdateAliases(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'post'; - // find the url's params + request.method = 'POST'; + + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - request.url = '/_aliases'; - + + // build the path + request.path = '/_aliases'; + // build the query string if (typeof params.timeout !== 'undefined') { @@ -58,7 +58,7 @@ function doIndicesUpdateAliases(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.master_timeout !== 'undefined') { if (params.master_timeout instanceof Date) { query.master_timeout = params.master_timeout.getTime(); @@ -68,14 +68,10 @@ function doIndicesUpdateAliases(params, callback) { throw new TypeError('Invalid master_timeout: ' + params.master_timeout + ' should be be some sort of time.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesUpdateAliases; diff --git a/src/api/indices/validate_query.js b/src/api/indices/validate_query.js index a46ee9558..4c47e02b6 100644 --- a/src/api/indices/validate_query.js +++ b/src/api/indices/validate_query.js @@ -1,10 +1,10 @@ -var _ = require('../../lib/toolbelt') - , paramHelper = require('../../lib/param_helper'); +var _ = require('../../lib/utils'), + paramHelper = require('../../lib/param_helper'), + errors = require('../../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [indices.validate_query](http://www.elasticsearch.org/guide/reference/api/validate/) request * @@ -17,74 +17,74 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {string} params.source - The URL-encoded query definition (instead of using the request body) * @param {string} params.q - Query in the Lucene query string syntax */ -function doIndicesValidateQuery(params, callback) { +function doIndicesValidateQuery(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'get' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'GET' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of get, post'); + throw new TypeError('Invalid method: should be one of GET, POST'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - + if (typeof params.type !== 'undefined') { switch (typeof params.type) { case 'string': - url.type = params.type; + parts.type = params.type; break; case 'object': if (_.isArray(params.type)) { - url.type = params.type.join(','); + parts.type = params.type.join(','); } else { throw new TypeError('Invalid type: ' + params.type + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.type = !!params.type; + parts.type = !!params.type; } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_validate/query'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_validate/query'; } - else if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_validate/query'; + else if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_validate/query'; } else { - request.url = '/_validate/query'; + request.path = '/_validate/query'; } - + // build the query string if (typeof params.explain !== 'undefined') { @@ -96,7 +96,7 @@ function doIndicesValidateQuery(params, callback) { query.explain = !!params.explain; } } - + if (typeof params.ignore_indices !== 'undefined') { if (_.contains(ignoreIndicesOptions, params.ignore_indices)) { query.ignore_indices = params.ignore_indices; @@ -107,11 +107,11 @@ function doIndicesValidateQuery(params, callback) { ); } } - + if (typeof params.operation_threading !== 'undefined') { query.operation_threading = params.operation_threading; } - + if (typeof params.source !== 'undefined') { if (typeof params.source !== 'object' && params.source) { query.source = '' + params.source; @@ -119,7 +119,7 @@ function doIndicesValidateQuery(params, callback) { throw new TypeError('Invalid source: ' + params.source + ' should be a string.'); } } - + if (typeof params.q !== 'undefined') { if (typeof params.q !== 'object' && params.q) { query.q = '' + params.q; @@ -127,14 +127,10 @@ function doIndicesValidateQuery(params, callback) { throw new TypeError('Invalid q: ' + params.q + ' should be a string.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doIndicesValidateQuery; diff --git a/src/api/info.js b/src/api/info.js index 9b52ed876..766b25515 100644 --- a/src/api/info.js +++ b/src/api/info.js @@ -1,7 +1,7 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); - - +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [info](http://elasticsearch.org/guide/) request @@ -10,42 +10,38 @@ var _ = require('../lib/toolbelt') * @method info * @param {Object} params - An object with parameters used to carry out this action */ -function doInfo(params, callback) { +function doInfo(params, cb) { params = params || {}; var request = { ignore: params.ignore } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'get' || params.method === 'head') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'GET' || params.method === 'HEAD') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of get, head'); + throw new TypeError('Invalid method: should be one of GET, HEAD'); } } else { - request.method = params.body ? 'head' : 'get'; + request.method = params.body ? 'HEAD' : 'GET'; } - // find the url's params + // find the paths's params - // build the url - request.url = '/'; - + // build the path + request.path = '/'; + // build the query string - request.url = request.url + _.makeQueryString(query); + request.path = request.path + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + this.client.request(request, cb); } module.exports = doInfo; diff --git a/src/api/mget.js b/src/api/mget.js index 4ab646243..72c4cfcb3 100644 --- a/src/api/mget.js +++ b/src/api/mget.js @@ -1,7 +1,7 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); - - +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [mget](http://elasticsearch.org/guide/reference/api/multi-get/) request @@ -17,56 +17,56 @@ var _ = require('../lib/toolbelt') * @param {String|ArrayOfStrings|Boolean} params._source_exclude - A list of fields to exclude from the returned _source field * @param {String|ArrayOfStrings|Boolean} params._source_include - A list of fields to extract and return from the _source field */ -function doMget(params, callback) { +function doMget(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'get' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'GET' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of get, post'); + throw new TypeError('Invalid method: should be one of GET, POST'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } } - + if (typeof params.type !== 'undefined') { if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_mget'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_mget'; } - else if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_mget'; + else if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_mget'; } else { - request.url = '/_mget'; + request.path = '/_mget'; } - + // build the query string if (typeof params.fields !== 'undefined') { @@ -85,7 +85,7 @@ function doMget(params, callback) { query.fields = !!params.fields; } } - + if (typeof params.preference !== 'undefined') { if (typeof params.preference !== 'object' && params.preference) { query.preference = '' + params.preference; @@ -93,7 +93,7 @@ function doMget(params, callback) { throw new TypeError('Invalid preference: ' + params.preference + ' should be a string.'); } } - + if (typeof params.realtime !== 'undefined') { if (params.realtime.toLowerCase && (params.realtime = params.realtime.toLowerCase()) && (params.realtime === 'no' || params.realtime === 'off') @@ -103,7 +103,7 @@ function doMget(params, callback) { query.realtime = !!params.realtime; } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -113,7 +113,7 @@ function doMget(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params._source !== 'undefined') { switch (typeof params._source) { case 'string': @@ -130,7 +130,7 @@ function doMget(params, callback) { query._source = !!params._source; } } - + if (typeof params._source_exclude !== 'undefined') { switch (typeof params._source_exclude) { case 'string': @@ -147,7 +147,7 @@ function doMget(params, callback) { query._source_exclude = !!params._source_exclude; } } - + if (typeof params._source_include !== 'undefined') { switch (typeof params._source_include) { case 'string': @@ -164,14 +164,10 @@ function doMget(params, callback) { query._source_include = !!params._source_include; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doMget; diff --git a/src/api/mlt.js b/src/api/mlt.js index 025ee8050..9778e9f64 100644 --- a/src/api/mlt.js +++ b/src/api/mlt.js @@ -1,7 +1,7 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); - - +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [mlt](http://elasticsearch.org/guide/reference/api/more-like-this/) request @@ -29,55 +29,55 @@ var _ = require('../lib/toolbelt') * @param {String|ArrayOfStrings|Boolean} params.search_types - A comma-separated list of types to perform the query against (default: the same type as the document) * @param {String|ArrayOfStrings|Boolean} params.stop_words - A list of stop words to be ignored */ -function doMlt(params, callback) { +function doMlt(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'get' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'GET' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of get, post'); + throw new TypeError('Invalid method: should be one of GET, POST'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.id !== 'object' && params.id) { - url.id = '' + params.id; + parts.id = '' + params.id; } else { throw new TypeError('Invalid id: ' + params.id + ' should be a string.'); } - + if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type') && url.hasOwnProperty('id')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/' + encodeURIComponent(url.id) + '/_mlt'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type') && parts.hasOwnProperty('id')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/' + encodeURIComponent(parts.id) + '/_mlt'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object], [object Object]'); } - + // build the query string if (typeof params.boost_terms !== 'undefined') { @@ -87,7 +87,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid boost_terms: ' + params.boost_terms + ' should be a number.'); } } - + if (typeof params.max_doc_freq !== 'undefined') { if (_.isNumeric(params.max_doc_freq)) { query.max_doc_freq = params.max_doc_freq * 1; @@ -95,7 +95,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid max_doc_freq: ' + params.max_doc_freq + ' should be a number.'); } } - + if (typeof params.max_query_terms !== 'undefined') { if (_.isNumeric(params.max_query_terms)) { query.max_query_terms = params.max_query_terms * 1; @@ -103,7 +103,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid max_query_terms: ' + params.max_query_terms + ' should be a number.'); } } - + if (typeof params.max_word_len !== 'undefined') { if (_.isNumeric(params.max_word_len)) { query.max_word_len = params.max_word_len * 1; @@ -111,7 +111,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid max_word_len: ' + params.max_word_len + ' should be a number.'); } } - + if (typeof params.min_doc_freq !== 'undefined') { if (_.isNumeric(params.min_doc_freq)) { query.min_doc_freq = params.min_doc_freq * 1; @@ -119,7 +119,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid min_doc_freq: ' + params.min_doc_freq + ' should be a number.'); } } - + if (typeof params.min_term_freq !== 'undefined') { if (_.isNumeric(params.min_term_freq)) { query.min_term_freq = params.min_term_freq * 1; @@ -127,7 +127,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid min_term_freq: ' + params.min_term_freq + ' should be a number.'); } } - + if (typeof params.min_word_len !== 'undefined') { if (_.isNumeric(params.min_word_len)) { query.min_word_len = params.min_word_len * 1; @@ -135,7 +135,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid min_word_len: ' + params.min_word_len + ' should be a number.'); } } - + if (typeof params.mlt_fields !== 'undefined') { switch (typeof params.mlt_fields) { case 'string': @@ -152,7 +152,7 @@ function doMlt(params, callback) { query.mlt_fields = !!params.mlt_fields; } } - + if (typeof params.percent_terms_to_match !== 'undefined') { if (_.isNumeric(params.percent_terms_to_match)) { query.percent_terms_to_match = params.percent_terms_to_match * 1; @@ -160,7 +160,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid percent_terms_to_match: ' + params.percent_terms_to_match + ' should be a number.'); } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -168,7 +168,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - + if (typeof params.search_from !== 'undefined') { if (_.isNumeric(params.search_from)) { query.search_from = params.search_from * 1; @@ -176,7 +176,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid search_from: ' + params.search_from + ' should be a number.'); } } - + if (typeof params.search_indices !== 'undefined') { switch (typeof params.search_indices) { case 'string': @@ -193,7 +193,7 @@ function doMlt(params, callback) { query.search_indices = !!params.search_indices; } } - + if (typeof params.search_query_hint !== 'undefined') { if (typeof params.search_query_hint !== 'object' && params.search_query_hint) { query.search_query_hint = '' + params.search_query_hint; @@ -201,7 +201,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid search_query_hint: ' + params.search_query_hint + ' should be a string.'); } } - + if (typeof params.search_scroll !== 'undefined') { if (typeof params.search_scroll !== 'object' && params.search_scroll) { query.search_scroll = '' + params.search_scroll; @@ -209,7 +209,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid search_scroll: ' + params.search_scroll + ' should be a string.'); } } - + if (typeof params.search_size !== 'undefined') { if (_.isNumeric(params.search_size)) { query.search_size = params.search_size * 1; @@ -217,7 +217,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid search_size: ' + params.search_size + ' should be a number.'); } } - + if (typeof params.search_source !== 'undefined') { if (typeof params.search_source !== 'object' && params.search_source) { query.search_source = '' + params.search_source; @@ -225,7 +225,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid search_source: ' + params.search_source + ' should be a string.'); } } - + if (typeof params.search_type !== 'undefined') { if (typeof params.search_type !== 'object' && params.search_type) { query.search_type = '' + params.search_type; @@ -233,7 +233,7 @@ function doMlt(params, callback) { throw new TypeError('Invalid search_type: ' + params.search_type + ' should be a string.'); } } - + if (typeof params.search_types !== 'undefined') { switch (typeof params.search_types) { case 'string': @@ -250,7 +250,7 @@ function doMlt(params, callback) { query.search_types = !!params.search_types; } } - + if (typeof params.stop_words !== 'undefined') { switch (typeof params.stop_words) { case 'string': @@ -267,14 +267,10 @@ function doMlt(params, callback) { query.stop_words = !!params.stop_words; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doMlt; diff --git a/src/api/msearch.js b/src/api/msearch.js index 65c8041e8..f941a61de 100644 --- a/src/api/msearch.js +++ b/src/api/msearch.js @@ -1,10 +1,10 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var searchTypeOptions = ['query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch', 'count', 'scan']; - - /** * Perform an elasticsearch [msearch](http://www.elasticsearch.org/guide/reference/api/multi-search/) request * @@ -13,74 +13,74 @@ var searchTypeOptions = ['query_then_fetch', 'query_and_fetch', 'dfs_query_then_ * @param {Object} params - An object with parameters used to carry out this action * @param {String} params.search_type - Search operation type */ -function doMsearch(params, callback) { +function doMsearch(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: paramHelper.bulkBody(params.body, this.client.serializer) || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'get' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'GET' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of get, post'); + throw new TypeError('Invalid method: should be one of GET, POST'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - + if (typeof params.type !== 'undefined') { switch (typeof params.type) { case 'string': - url.type = params.type; + parts.type = params.type; break; case 'object': if (_.isArray(params.type)) { - url.type = params.type.join(','); + parts.type = params.type.join(','); } else { throw new TypeError('Invalid type: ' + params.type + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.type = !!params.type; + parts.type = !!params.type; } } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_msearch'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_msearch'; } - else if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_msearch'; + else if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_msearch'; } else { - request.url = '/_msearch'; + request.path = '/_msearch'; } - + // build the query string if (typeof params.search_type !== 'undefined') { @@ -93,14 +93,10 @@ function doMsearch(params, callback) { ); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doMsearch; diff --git a/src/api/percolate.js b/src/api/percolate.js index 38a14c72a..770ddea7e 100644 --- a/src/api/percolate.js +++ b/src/api/percolate.js @@ -1,7 +1,7 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); - - +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [percolate](http://elasticsearch.org/guide/reference/api/percolate/) request @@ -11,49 +11,49 @@ var _ = require('../lib/toolbelt') * @param {Object} params - An object with parameters used to carry out this action * @param {boolean} params.prefer_local - With `true`, specify that a local shard should be used if available, with `false`, use a random shard (default: true) */ -function doPercolate(params, callback) { +function doPercolate(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'get' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'GET' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of get, post'); + throw new TypeError('Invalid method: should be one of GET, POST'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/_percolate'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/_percolate'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object]'); } - + // build the query string if (typeof params.prefer_local !== 'undefined') { @@ -65,14 +65,10 @@ function doPercolate(params, callback) { query.prefer_local = !!params.prefer_local; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doPercolate; diff --git a/src/api/scroll.js b/src/api/scroll.js index d4a8f7c64..d86e39372 100644 --- a/src/api/scroll.js +++ b/src/api/scroll.js @@ -1,7 +1,7 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); - - +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); /** * Perform an elasticsearch [scroll](http://www.elasticsearch.org/guide/reference/api/search/scroll/) request @@ -12,46 +12,46 @@ var _ = require('../lib/toolbelt') * @param {duration} params.scroll - Specify how long a consistent view of the index should be maintained for scrolled search * @param {string} params.scroll_id - The scroll ID for scrolled search */ -function doScroll(params, callback) { +function doScroll(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'get' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'GET' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of get, post'); + throw new TypeError('Invalid method: should be one of GET, POST'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.scroll_id !== 'undefined') { if (typeof params.scroll_id !== 'object' && params.scroll_id) { - url.scroll_id = '' + params.scroll_id; + parts.scroll_id = '' + params.scroll_id; } else { throw new TypeError('Invalid scroll_id: ' + params.scroll_id + ' should be a string.'); } } - - // build the url - if (url.hasOwnProperty('scroll_id')) { - request.url = '/_search/scroll/' + encodeURIComponent(url.scroll_id) + ''; + + // build the path + if (parts.hasOwnProperty('scroll_id')) { + request.path = '/_search/scroll/' + encodeURIComponent(parts.scroll_id) + ''; delete params.scroll_id; } else { - request.url = '/_search/scroll'; + request.path = '/_search/scroll'; } - + // build the query string if (typeof params.scroll !== 'undefined') { @@ -61,7 +61,7 @@ function doScroll(params, callback) { throw new TypeError('Invalid scroll: ' + params.scroll + ' should be a number or in interval notation (an integer followed by one of Mwdhmsy).'); } } - + if (typeof params.scroll_id !== 'undefined') { if (typeof params.scroll_id !== 'object' && params.scroll_id) { query.scroll_id = '' + params.scroll_id; @@ -69,14 +69,10 @@ function doScroll(params, callback) { throw new TypeError('Invalid scroll_id: ' + params.scroll_id + ' should be a string.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doScroll; diff --git a/src/api/search.js b/src/api/search.js index 2da3e5df3..e00f830f1 100644 --- a/src/api/search.js +++ b/src/api/search.js @@ -1,13 +1,13 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var defaultOperatorOptions = ['AND', 'OR']; var ignoreIndicesOptions = ['none', 'missing']; var searchTypeOptions = ['query_then_fetch', 'query_and_fetch', 'dfs_query_then_fetch', 'dfs_query_and_fetch', 'count', 'scan']; var suggestModeOptions = ['missing', 'popular', 'always']; - - /** * Perform an elasticsearch [search](http://www.elasticsearch.org/guide/reference/api/search/) request * @@ -44,71 +44,71 @@ var suggestModeOptions = ['missing', 'popular', 'always']; * @param {Date|Number} params.timeout - Explicit operation timeout * @param {boolean} params.version - Specify whether to return document version as part of a hit */ -function doSearch(params, callback) { +function doSearch(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'get' || params.method === 'post') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'GET' || params.method === 'POST') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of get, post'); + throw new TypeError('Invalid method: should be one of GET, POST'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - + if (typeof params.type !== 'undefined') { switch (typeof params.type) { case 'string': - url.type = params.type; + parts.type = params.type; break; case 'object': if (_.isArray(params.type)) { - url.type = params.type.join(','); + parts.type = params.type.join(','); } else { throw new TypeError('Invalid type: ' + params.type + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.type = !!params.type; + parts.type = !!params.type; } } - - // build the url - if (url.hasOwnProperty('type')) { - request.url = '/' + encodeURIComponent(url.index || '_all') + '/' + encodeURIComponent(url.type) + '/_search'; + + // build the path + if (parts.hasOwnProperty('type')) { + request.path = '/' + encodeURIComponent(parts.index || '_all') + '/' + encodeURIComponent(parts.type) + '/_search'; } else { - request.url = '/' + encodeURIComponent(url.index || '_all') + '/_search'; + request.path = '/' + encodeURIComponent(parts.index || '_all') + '/_search'; } - + // build the query string if (typeof params.analyzer !== 'undefined') { @@ -118,7 +118,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid analyzer: ' + params.analyzer + ' should be a string.'); } } - + if (typeof params.analyze_wildcard !== 'undefined') { if (params.analyze_wildcard.toLowerCase && (params.analyze_wildcard = params.analyze_wildcard.toLowerCase()) && (params.analyze_wildcard === 'no' || params.analyze_wildcard === 'off') @@ -128,7 +128,7 @@ function doSearch(params, callback) { query.analyze_wildcard = !!params.analyze_wildcard; } } - + if (typeof params.default_operator !== 'undefined') { if (_.contains(defaultOperatorOptions, params.default_operator)) { query.default_operator = params.default_operator; @@ -139,7 +139,7 @@ function doSearch(params, callback) { ); } } - + if (typeof params.df !== 'undefined') { if (typeof params.df !== 'object' && params.df) { query.df = '' + params.df; @@ -147,7 +147,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid df: ' + params.df + ' should be a string.'); } } - + if (typeof params.explain !== 'undefined') { if (params.explain.toLowerCase && (params.explain = params.explain.toLowerCase()) && (params.explain === 'no' || params.explain === 'off') @@ -157,7 +157,7 @@ function doSearch(params, callback) { query.explain = !!params.explain; } } - + if (typeof params.fields !== 'undefined') { switch (typeof params.fields) { case 'string': @@ -174,7 +174,7 @@ function doSearch(params, callback) { query.fields = !!params.fields; } } - + if (typeof params.from !== 'undefined') { if (_.isNumeric(params.from)) { query.from = params.from * 1; @@ -182,7 +182,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid from: ' + params.from + ' should be a number.'); } } - + if (typeof params.ignore_indices !== 'undefined') { if (_.contains(ignoreIndicesOptions, params.ignore_indices)) { query.ignore_indices = params.ignore_indices; @@ -193,7 +193,7 @@ function doSearch(params, callback) { ); } } - + if (typeof params.indices_boost !== 'undefined') { switch (typeof params.indices_boost) { case 'string': @@ -210,7 +210,7 @@ function doSearch(params, callback) { query.indices_boost = !!params.indices_boost; } } - + if (typeof params.lenient !== 'undefined') { if (params.lenient.toLowerCase && (params.lenient = params.lenient.toLowerCase()) && (params.lenient === 'no' || params.lenient === 'off') @@ -220,7 +220,7 @@ function doSearch(params, callback) { query.lenient = !!params.lenient; } } - + if (typeof params.lowercase_expanded_terms !== 'undefined') { if (params.lowercase_expanded_terms.toLowerCase && (params.lowercase_expanded_terms = params.lowercase_expanded_terms.toLowerCase()) && (params.lowercase_expanded_terms === 'no' || params.lowercase_expanded_terms === 'off') @@ -230,7 +230,7 @@ function doSearch(params, callback) { query.lowercase_expanded_terms = !!params.lowercase_expanded_terms; } } - + if (typeof params.preference !== 'undefined') { if (typeof params.preference !== 'object' && params.preference) { query.preference = '' + params.preference; @@ -238,7 +238,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid preference: ' + params.preference + ' should be a string.'); } } - + if (typeof params.q !== 'undefined') { if (typeof params.q !== 'object' && params.q) { query.q = '' + params.q; @@ -246,7 +246,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid q: ' + params.q + ' should be a string.'); } } - + if (typeof params.routing !== 'undefined') { switch (typeof params.routing) { case 'string': @@ -263,7 +263,7 @@ function doSearch(params, callback) { query.routing = !!params.routing; } } - + if (typeof params.scroll !== 'undefined') { if (_.isNumeric(params.scroll) || _.isInterval(params.scroll)) { query.scroll = params.scroll; @@ -271,7 +271,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid scroll: ' + params.scroll + ' should be a number or in interval notation (an integer followed by one of Mwdhmsy).'); } } - + if (typeof params.search_type !== 'undefined') { if (_.contains(searchTypeOptions, params.search_type)) { query.search_type = params.search_type; @@ -282,7 +282,7 @@ function doSearch(params, callback) { ); } } - + if (typeof params.size !== 'undefined') { if (_.isNumeric(params.size)) { query.size = params.size * 1; @@ -290,7 +290,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid size: ' + params.size + ' should be a number.'); } } - + if (typeof params.sort !== 'undefined') { switch (typeof params.sort) { case 'string': @@ -307,7 +307,7 @@ function doSearch(params, callback) { query.sort = !!params.sort; } } - + if (typeof params.source !== 'undefined') { if (typeof params.source !== 'object' && params.source) { query.source = '' + params.source; @@ -315,7 +315,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid source: ' + params.source + ' should be a string.'); } } - + if (typeof params._source !== 'undefined') { switch (typeof params._source) { case 'string': @@ -332,7 +332,7 @@ function doSearch(params, callback) { query._source = !!params._source; } } - + if (typeof params._source_exclude !== 'undefined') { switch (typeof params._source_exclude) { case 'string': @@ -349,7 +349,7 @@ function doSearch(params, callback) { query._source_exclude = !!params._source_exclude; } } - + if (typeof params._source_include !== 'undefined') { switch (typeof params._source_include) { case 'string': @@ -366,7 +366,7 @@ function doSearch(params, callback) { query._source_include = !!params._source_include; } } - + if (typeof params.stats !== 'undefined') { switch (typeof params.stats) { case 'string': @@ -383,7 +383,7 @@ function doSearch(params, callback) { query.stats = !!params.stats; } } - + if (typeof params.suggest_field !== 'undefined') { if (typeof params.suggest_field !== 'object' && params.suggest_field) { query.suggest_field = '' + params.suggest_field; @@ -391,7 +391,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid suggest_field: ' + params.suggest_field + ' should be a string.'); } } - + if (typeof params.suggest_mode !== 'undefined') { if (_.contains(suggestModeOptions, params.suggest_mode)) { query.suggest_mode = params.suggest_mode; @@ -402,7 +402,7 @@ function doSearch(params, callback) { ); } } - + if (typeof params.suggest_size !== 'undefined') { if (_.isNumeric(params.suggest_size)) { query.suggest_size = params.suggest_size * 1; @@ -410,7 +410,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid suggest_size: ' + params.suggest_size + ' should be a number.'); } } - + if (typeof params.suggest_text !== 'undefined') { if (typeof params.suggest_text !== 'object' && params.suggest_text) { query.suggest_text = '' + params.suggest_text; @@ -418,7 +418,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid suggest_text: ' + params.suggest_text + ' should be a string.'); } } - + if (typeof params.timeout !== 'undefined') { if (params.timeout instanceof Date) { query.timeout = params.timeout.getTime(); @@ -428,7 +428,7 @@ function doSearch(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.version !== 'undefined') { if (params.version.toLowerCase && (params.version = params.version.toLowerCase()) && (params.version === 'no' || params.version === 'off') @@ -438,14 +438,10 @@ function doSearch(params, callback) { query.version = !!params.version; } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doSearch; diff --git a/src/api/suggest.js b/src/api/suggest.js index 98411f35a..b0a571f84 100644 --- a/src/api/suggest.js +++ b/src/api/suggest.js @@ -1,10 +1,10 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var ignoreIndicesOptions = ['none', 'missing']; - - /** * Perform an elasticsearch [suggest](http://elasticsearch.org/guide/reference/api/search/suggest/) request * @@ -16,54 +16,54 @@ var ignoreIndicesOptions = ['none', 'missing']; * @param {string} params.routing - Specific routing value * @param {string} params.source - The URL-encoded request definition (instead of using request body) */ -function doSuggest(params, callback) { +function doSuggest(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - if (params.method = _.toLowerString(params.method)) { - if (params.method === 'post' || params.method === 'get') { + + if (params.method = _.toUpperString(params.method)) { + if (params.method === 'POST' || params.method === 'GET') { request.method = params.method; } else { - throw new TypeError('Invalid method: should be one of post, get'); + throw new TypeError('Invalid method: should be one of POST, GET'); } } else { - request.method = params.body ? 'post' : 'get'; + request.method = params.body ? 'POST' : 'GET'; } - // find the url's params + // find the paths's params if (typeof params.index !== 'undefined') { switch (typeof params.index) { case 'string': - url.index = params.index; + parts.index = params.index; break; case 'object': if (_.isArray(params.index)) { - url.index = params.index.join(','); + parts.index = params.index.join(','); } else { throw new TypeError('Invalid index: ' + params.index + ' should be a comma seperated list, array, or boolean.'); } break; default: - url.index = !!params.index; + parts.index = !!params.index; } } - - // build the url - if (url.hasOwnProperty('index')) { - request.url = '/' + encodeURIComponent(url.index) + '/_suggest'; + + // build the path + if (parts.hasOwnProperty('index')) { + request.path = '/' + encodeURIComponent(parts.index) + '/_suggest'; } else { - request.url = '/_suggest'; + request.path = '/_suggest'; } - + // build the query string if (typeof params.ignore_indices !== 'undefined') { @@ -76,7 +76,7 @@ function doSuggest(params, callback) { ); } } - + if (typeof params.preference !== 'undefined') { if (typeof params.preference !== 'object' && params.preference) { query.preference = '' + params.preference; @@ -84,7 +84,7 @@ function doSuggest(params, callback) { throw new TypeError('Invalid preference: ' + params.preference + ' should be a string.'); } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -92,7 +92,7 @@ function doSuggest(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - + if (typeof params.source !== 'undefined') { if (typeof params.source !== 'object' && params.source) { query.source = '' + params.source; @@ -100,14 +100,10 @@ function doSuggest(params, callback) { throw new TypeError('Invalid source: ' + params.source + ' should be a string.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doSuggest; diff --git a/src/api/update.js b/src/api/update.js index 26926cb49..96a7d89bf 100644 --- a/src/api/update.js +++ b/src/api/update.js @@ -1,11 +1,11 @@ -var _ = require('../lib/toolbelt') - , paramHelper = require('../lib/param_helper'); +var _ = require('../lib/utils'), + paramHelper = require('../lib/param_helper'), + errors = require('../lib/errors'), + q = require('q'); var consistencyOptions = ['one', 'quorum', 'all']; var replicationOptions = ['sync', 'async']; - - /** * Perform an elasticsearch [update](http://elasticsearch.org/guide/reference/api/update/) request * @@ -28,47 +28,47 @@ var replicationOptions = ['sync', 'async']; * @param {number} params.version - Explicit version number for concurrency control * @param {number} params.version_type - Explicit version number for concurrency control */ -function doUpdate(params, callback) { +function doUpdate(params, cb) { params = params || {}; var request = { ignore: params.ignore, body: params.body || null } - , url = {} + , parts = {} , query = {} , responseOpts = {}; - - request.method = 'post'; - // find the url's params + request.method = 'POST'; + + // find the paths's params if (typeof params.id !== 'object' && params.id) { - url.id = '' + params.id; + parts.id = '' + params.id; } else { throw new TypeError('Invalid id: ' + params.id + ' should be a string.'); } - + if (typeof params.index !== 'object' && params.index) { - url.index = '' + params.index; + parts.index = '' + params.index; } else { throw new TypeError('Invalid index: ' + params.index + ' should be a string.'); } - + if (typeof params.type !== 'object' && params.type) { - url.type = '' + params.type; + parts.type = '' + params.type; } else { throw new TypeError('Invalid type: ' + params.type + ' should be a string.'); } - - // build the url - if (url.hasOwnProperty('index') && url.hasOwnProperty('type') && url.hasOwnProperty('id')) { - request.url = '/' + encodeURIComponent(url.index) + '/' + encodeURIComponent(url.type) + '/' + encodeURIComponent(url.id) + '/_update'; + + // build the path + if (parts.hasOwnProperty('index') && parts.hasOwnProperty('type') && parts.hasOwnProperty('id')) { + request.path = '/' + encodeURIComponent(parts.index) + '/' + encodeURIComponent(parts.type) + '/' + encodeURIComponent(parts.id) + '/_update'; } else { - throw new TypeError('Unable to build a url with those params. Supply at least [object Object], [object Object], [object Object]'); + throw new TypeError('Unable to build a path with those params. Supply at least [object Object], [object Object], [object Object]'); } - + // build the query string if (typeof params.consistency !== 'undefined') { @@ -81,7 +81,7 @@ function doUpdate(params, callback) { ); } } - + if (typeof params.fields !== 'undefined') { switch (typeof params.fields) { case 'string': @@ -98,7 +98,7 @@ function doUpdate(params, callback) { query.fields = !!params.fields; } } - + if (typeof params.lang !== 'undefined') { if (typeof params.lang !== 'object' && params.lang) { query.lang = '' + params.lang; @@ -106,7 +106,7 @@ function doUpdate(params, callback) { throw new TypeError('Invalid lang: ' + params.lang + ' should be a string.'); } } - + if (typeof params.parent !== 'undefined') { if (typeof params.parent !== 'object' && params.parent) { query.parent = '' + params.parent; @@ -114,7 +114,7 @@ function doUpdate(params, callback) { throw new TypeError('Invalid parent: ' + params.parent + ' should be a string.'); } } - + if (typeof params.percolate !== 'undefined') { if (typeof params.percolate !== 'object' && params.percolate) { query.percolate = '' + params.percolate; @@ -122,7 +122,7 @@ function doUpdate(params, callback) { throw new TypeError('Invalid percolate: ' + params.percolate + ' should be a string.'); } } - + if (typeof params.refresh !== 'undefined') { if (params.refresh.toLowerCase && (params.refresh = params.refresh.toLowerCase()) && (params.refresh === 'no' || params.refresh === 'off') @@ -132,7 +132,7 @@ function doUpdate(params, callback) { query.refresh = !!params.refresh; } } - + if (typeof params.replication !== 'undefined') { if (_.contains(replicationOptions, params.replication)) { query.replication = params.replication; @@ -143,7 +143,7 @@ function doUpdate(params, callback) { ); } } - + if (typeof params.retry_on_conflict !== 'undefined') { if (_.isNumeric(params.retry_on_conflict)) { query.retry_on_conflict = params.retry_on_conflict * 1; @@ -151,7 +151,7 @@ function doUpdate(params, callback) { throw new TypeError('Invalid retry_on_conflict: ' + params.retry_on_conflict + ' should be a number.'); } } - + if (typeof params.routing !== 'undefined') { if (typeof params.routing !== 'object' && params.routing) { query.routing = '' + params.routing; @@ -159,11 +159,11 @@ function doUpdate(params, callback) { throw new TypeError('Invalid routing: ' + params.routing + ' should be a string.'); } } - + if (typeof params.script !== 'undefined') { query.script = params.script; } - + if (typeof params.timeout !== 'undefined') { if (params.timeout instanceof Date) { query.timeout = params.timeout.getTime(); @@ -173,7 +173,7 @@ function doUpdate(params, callback) { throw new TypeError('Invalid timeout: ' + params.timeout + ' should be be some sort of time.'); } } - + if (typeof params.timestamp !== 'undefined') { if (params.timestamp instanceof Date) { query.timestamp = params.timestamp.getTime(); @@ -183,7 +183,7 @@ function doUpdate(params, callback) { throw new TypeError('Invalid timestamp: ' + params.timestamp + ' should be be some sort of time.'); } } - + if (typeof params.ttl !== 'undefined') { if (_.isNumeric(params.ttl) || _.isInterval(params.ttl)) { query.ttl = params.ttl; @@ -191,7 +191,7 @@ function doUpdate(params, callback) { throw new TypeError('Invalid ttl: ' + params.ttl + ' should be a number or in interval notation (an integer followed by one of Mwdhmsy).'); } } - + if (typeof params.version !== 'undefined') { if (_.isNumeric(params.version)) { query.version = params.version * 1; @@ -199,7 +199,7 @@ function doUpdate(params, callback) { throw new TypeError('Invalid version: ' + params.version + ' should be a number.'); } } - + if (typeof params.version_type !== 'undefined') { if (_.isNumeric(params.version_type)) { query.version_type = params.version_type * 1; @@ -207,14 +207,10 @@ function doUpdate(params, callback) { throw new TypeError('Invalid version_type: ' + params.version_type + ' should be a number.'); } } - - request.url = request.url + _.makeQueryString(query); - var reqPromise = this.client.request(request); - if (callback) { - reqPromise.then(_.bind(callback, null, null), callback); - } - return reqPromise; + request.path = request.path + _.makeQueryString(query); + + this.client.request(request, cb); } module.exports = doUpdate; diff --git a/src/lib/Client.js b/src/lib/Client.js index 5d623ba1e..d7603516e 100644 --- a/src/lib/Client.js +++ b/src/lib/Client.js @@ -1,14 +1,3 @@ -var _ = require('./toolbelt') - , transports = _.requireClasses(module, './transports') - , serializers = _.requireClasses(module, './serializers') - , Log = require('./log') - , api = _.reKey(_.requireDir(module, '../api'), _.camelCase); - -// Many API commands are namespaced, like cluster.node_stats. The names of these namespaces will be -// tracked here and the namespace objects will be instantiated by reading the values from this -// array -var namespaces = []; - /** * A client that makes requests to Elasticsearch via a {{#crossLink "Transport"}}Transport{{/crossLink}} * @@ -16,80 +5,126 @@ var namespaces = []; * * ``` * var client = new Elasticsearch.Client({ - * transport: { - * hosts: [ - * 'es1.net:9200', - * 'es2.net:9200' - * ], - * sniff_on_start: true - * }, + * hosts: [ + * 'es1.net:9200', + * { + * host: 'es2.net', + * port: 9200 + * } + * ], + * sniffOnStart: true, * log: { * type: 'file', * level: 'warning' * } - * }) + * }); * ``` * * @class Client * @constructor * @param {Object} [config={}] - Configuration for the transport * @param {Object} [config.transport] - Transport settings passed to {{#crossLink "Transport"}}Transport Constructor{{/crossLink}} - * @param {String|ArrayOfStrings>} [config.log] - Log output settings {{#crossLink "Log"}}Log Constructor{{/crossLink}} + * @param {String|Array} [config.log] - Log output settings {{#crossLink "Log"}}Log Constructor{{/crossLink}} * @param {Object} [config.trace=false] - Create a log output to stdio that only tracks trace logs */ + +module.exports = Client; + +var _ = require('./utils'), + ClientConfig = require('./client_config'), + api = _.reKey(_.requireDir(module, '../api'), _.camelCase), + q = require('q'), + Transport = require('./transport'), + ConnectionPool = require('./connection_pool'), + Log = require('./log'), + serializers = _.requireClasses(module, './serializers'), + errors = require('./errors'); + +// Many API commands are namespaced, like cluster.node_stats. The names of these namespaces will be +// tracked here and the namespace objects will be instantiated by reading the values from this +// array +var namespaces = []; + function Client(config) { this.client = this; + this.config = !config || _.isPlainObject(config) ? new ClientConfig(config) : config; for (var i = 0; i < namespaces.length; i++) { this[namespaces[i]] = new this[namespaces[i]](this); } - this.log = new Log(config && config.log, this); + this.log = new Log(this); + this.transport = new Transport(this); this.serializer = new serializers.Json(this); - this.transport = new transports.NodeHttp(config.hosts || ['//localhost:9200'], this); + this.connectionPool = new ConnectionPool(this); } -Client.prototype.ping = function () { - return this.request({ - url: '/', - method: 'HEAD', - timeout: '100' - }); -}; - /** * Perform a request with the client's transport * * @method request + * @todo async body writing + * @todo abort + * @todo access to custom headers, modifying of request in general * @param {object} params * @param {String} params.url - The url for the request * @param {String} params.method - The HTTP method for the request * @param {String} params.body - The body of the HTTP request - * @return {Promise} - A promise that will be resolved with the response + * @param {Function} cb - A function to call back with (error, responseBody, responseStatus) */ -Client.prototype.request = function (params) { - - // serialize the body - params.body = this.serializer.serialize(params.body); - - // ensure that ignore is an array - if (params.ignore && !_.isArray(params.ignore)) { - params.ignore = [params.ignore]; +Client.prototype.request = function (params, cb) { + if (typeof cb !== 'function') { + cb = _.noop; } - // return the request's promise - return this.transport.request(params); + // get ignore and ensure that it's an array + var ignore = params.ignore; + if (ignore && !_.isArray(ignore)) { + ignore = [ignore]; + } + + this.transport.request(params, function (err, body, status) { + if (err) { + return cb(err, body, status); + } else if ((status >= 200 && status < 300) || ignore && _.contains(ignore, status)) { + return cb(void 0, body, status); + } else { + if (errors[status]) { + return cb(new errors[status](body.error), body, status); + } else { + console.log({ + status: status, + body: body + }); + return cb(new errors.Generic('unknown error'), body, status); + } + } + }); }; /** - * These namespaces will be instanciated + * Ping some node to ensure that the cluster is available in some respect + * + * @param {Object} params - Currently just a placeholder, no params used at this time + * @param {Function} cb - callback + */ +Client.prototype.ping = function (params, cb) { + this.transport.request({ + method: 'HEAD', + path: '/' + }, cb); +}; + +/** + * These names of the properties that hold namespace objects in the Client prototype * @type {Array} */ Client.namespaces = []; /** - * creates a namespace, who's prototype offers the actions within that namespace and this context + * Creates a namespace, who's prototype offers the actions within that namespace and this context * provides the API actions and a link back to the client they were intended to operate on. + * @param {Object} actions - An object to use as the prototype for the namespace */ function makeNamespaceConstructor(actions) { @@ -112,5 +147,3 @@ _.extend(Client.prototype, _.map(api, function (action, name) { return makeNamespaceConstructor(action); } })); - -module.exports = Client; diff --git a/src/lib/Interfaces.js b/src/lib/Interfaces.js deleted file mode 100644 index b9700190c..000000000 --- a/src/lib/Interfaces.js +++ /dev/null @@ -1,42 +0,0 @@ -var _ = require('./toolbelt') - , TransportAbstract = require('./transports/TransportAbstract'); - -function Interface(methods, properties) { - this.methods = methods; - this.properties = properties; -} - -Interface.properties.implementedBy = function (object) { - var i; - - if (this.methods) { - for (i = 0; i < this.methods.length; i++) { - if (!object[this.methods[i]] || typeof object[this.methods[i]] !== 'function') { - return false; - } - } - } -}; - -var Transport = new Interface( - [// methods - '' - ], - {// properties - '': '' - } -); - -var Client = new Interface( - [ - '' - ], - { - transport: Transport - } -); - -module.exports = { - Transport: Transport, - Client: Client -}; diff --git a/src/lib/Log.js b/src/lib/Log.js index 19944d656..cf2b7d78e 100644 --- a/src/lib/Log.js +++ b/src/lib/Log.js @@ -1,6 +1,6 @@ -var _ = require('./toolbelt') - , url = require('url') - , EventEmitter = require('events').EventEmitter; +var _ = require('./utils'), + url = require('url'), + EventEmitter = require('events').EventEmitter; /** * Log bridge, which is an [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter) @@ -16,10 +16,11 @@ var _ = require('./toolbelt') * @param {string} output.level - One of the keys in Log.levels (error, warning, etc.) * @param {string} output.type - The name of the logger to use for this output */ -function Log(output, client) { - var i; +function Log(client) { + this.client = client; - output = output || 2; + var i; + var output = client.config.log || 2; if (_.isString(output) || _.isFinite(output)) { output = [ @@ -39,7 +40,7 @@ function Log(output, client) { } } - if (!_.isArrayOfObjects(output)) { + if (!_.isArrayOfPlainObjects(output)) { throw new TypeError('Invalid Logging output config'); } @@ -63,7 +64,7 @@ Log.levels = [ * @event error * @param {Error} error - The error object to log */ - 'error' + 'error', /** * Event fired for "warning" level log entries, which usually represent things * like correctly formatted error responses from ES (400, ...) and recoverable @@ -72,7 +73,7 @@ Log.levels = [ * @event warning * @param {String} message - A message to be logged */ - , 'warning' + 'warning', /** * Event fired for "info" level log entries, which usually describe what a * client is doing (sniffing etc) @@ -80,7 +81,7 @@ Log.levels = [ * @event info * @param {String} message - A message to be logged */ - , 'info' + 'info', /** * Event fired for "debug" level log entries, which will describe requests sent, * including their url (no data, response codes, or exec times) @@ -88,7 +89,7 @@ Log.levels = [ * @event debug * @param {String} message - A message to be logged */ - , 'debug' + 'debug', /** * Event fired for "trace" level log entries, which provide detailed information * about each request made from a client, including reponse codes, execution times, @@ -101,7 +102,7 @@ Log.levels = [ * @param {Integer} responseStatus - The status code returned from the response * @param {String} responseBody - The body of the response */ - , 'trace' + 'trace' ]; /** @@ -233,11 +234,11 @@ Log.prototype.debug = function (/* ...msg */) { * @param {String|Object} requestUrl - URL requested. If the value is an object, * it is expected to be the return value of Node's url.parse() * @param {String} body - The request's body - * @param {Number} responseStatus - The status code returned - * @param {String} responseBody - The body of the returned response + * @param {String} responseBody - body returned from ES + * @param {String} responseStatus - HTTP status code * @return {Boolean} - True if any outputs accepted the message */ -Log.prototype.trace = function (method, requestUrl, body, responseStatus, responseBody) { +Log.prototype.trace = function (method, requestUrl, body, responseBody, responseStatus) { if (EventEmitter.listenerCount(this, 'trace')) { if (typeof requestUrl === 'object') { if (!requestUrl.protocol) { @@ -245,7 +246,7 @@ Log.prototype.trace = function (method, requestUrl, body, responseStatus, respon } requestUrl = url.format(requestUrl); } - return this.emit('trace', method, requestUrl, body, responseStatus, responseBody); + return this.emit('trace', method, requestUrl, body, responseBody, responseStatus); } }; diff --git a/src/lib/Transport.js b/src/lib/Transport.js index 70581bb12..9b5c885c3 100644 --- a/src/lib/Transport.js +++ b/src/lib/Transport.js @@ -1,59 +1,90 @@ -var _ = require('./toolbelt') - , selectors = require('./selector'); - -var configDefaults = { - hosts : [ - { - host: 'localhost', - port: 9200 - } - ], - - //nodes_to_host_callback : construct_hosts_list, - sniff_on_start : false, - sniff_after_requests : 0, - sniff_on_connection_fail : false, - max_retries : 3, - selector : 'roundRobin' -}; - - /** - * "Abstract" class responsible for managing connection pools, sniffing for nodes, and serializing/ - * deserializing requests and ES errors. + * Manages connection pools, sniffs for nodes, and runs requests * * @main Transport * @class Transport * @constructor * @param {Object} [config={}] - An object with configuration parameters * @param {String|ArrayOfStrings} [config.hosts='localhost:9200'] - Host(s) that this client should communicate with. - * @param {Boolean} [config.sniff_on_start=false] - inspect the cluster for a list of nodes upon startup - * @param {Number} [config.sniff_after_requests=false] - Sniff after completing a certain number of request (disabled by default) - * @param {Boolean} [config.sniff_on_connection_fail=false] - Sniff after a connection fails (disabled by default) - * @param {Number} [config.max_retries=3] - The maximum number of time the client should retry connecting to a node + * @param {Boolean} [config.connectionConstructor=false] - A constructor to use for connections to ES nodes + * @param {Function} [config.nodesToHostCallback=parseNodeList] - convert the value returned from _cluster/nodes into + * a host list + * @param {Boolean} [config.sniffOnStart=false] - inspect the cluster for a list of nodes upon startup + * @param {Number} [config.sniffAfterRequests=null] - Sniff after completing a certain number of request + * @param {Boolean} [config.sniffOnConnectionFail=false] - Sniff after a connection fails + * @param {Number} [config.max_retries=3] - The maximum number of times the client should retry connecting to a node */ -function Transport(config) { - // These are all unique to each instance of client - config = _.defaults(config || {}, configDefaults); - if (_.isFunction(this.opts.selector)) { - this.selector = this.opts.selector; - } else if (_.has(selectors, this.opts.selector)) { - this.selector = selectors[this.opts.selector]; - } else { - throw new Error('Invalid Selector, specify a function or selector name.'); - } +module.exports = Transport; +var _ = require('./utils'), + q = require('q'), + ConnectionPool = require('./connection_pool'), + errors = require('./errors'); + +function Transport(client) { + this.client = client; } -/** - * Modify the defaults for the Transport class - * - * @method defaults - * @param {Object} update An object representing the changes to be made to the defaults. - * @static - * @return {undefined} - */ -Transport.defaults = function (update) { - _.assign(configDefaults, update); + +Transport.prototype.sniff = function (cb) { + cb = typeof cb === 'function' ? cb : _.noop; + + var connectionPool = this.client.connectionPool, + nodesToHostCallback = _.bind(this.client.config.nodesToHostCallback, this); + + this.client.request({ + path: '/_cluster/nodes' + }, function (err, resp) { + if (!err && resp && resp.nodes) { + connectionPool.setHosts(nodesToHostCallback(resp.nodes)); + } + cb(err, resp); + }); +}; + + +Transport.prototype.request = function (params, cb) { + cb = typeof cb === 'function' ? cb : _.noop; + + var client = this.client, + remainingRetries = client.config.maxRetries, + connection; + + // serialize the body + params.body = client.serializer.serialize(params.body); + + function sendRequestWithConnection(err, c) { + if (err) { + cb(err); + } else if (c) { + connection = c; + connection.request(params, checkRespForFailure); + } else { + cb(new errors.ConnectionError('No active nodes at this time.')); + } + } + + function checkRespForFailure(err, body, status) { + // check for posotive response + if (err) { + client.connectionPool.setStatus(connection, 'dead'); + checkForRetry(err, null, status); + } else { + client.connectionPool.setStatus(connection, 'alive'); + return cb(null, client.serializer.unserialize(body), status); + } + } + + function checkForRetry(err, resp) { + client.connectionPool.setStatus(connection, 'dead'); + if (remainingRetries) { + remainingRetries--; + client.connectionPool.select(sendRequestWithConnection); + } else { + return cb(err, null); + } + } + + client.connectionPool.select(sendRequestWithConnection); }; diff --git a/src/lib/client_config.js b/src/lib/client_config.js new file mode 100644 index 000000000..d066ab588 --- /dev/null +++ b/src/lib/client_config.js @@ -0,0 +1,86 @@ +/** + * Manages the configuration of the client. + * + * @class ClientConfig + * @type {Function} + */ +module.exports = ClientConfig; + +var url = require('url'), + _ = require('./utils'), + selectors = _.reKey(_.requireDir(module, './selectors'), _.camelCase), + connections = _.requireClasses(module, './connections'), + extractHostPartsRE = /\[([^:]+):(\d+)]/, + hostProtocolRE = /^([a-z]+:)?\/\//; + +var defaultConfig = { + hosts: [ + { + protocol: 'http:', + host: 'localhost', + port: 9200 + } + ], + connectionConstructor: 'Http', + selector: selectors.roundRobin, + nodesToHostCallback: function (nodes) { + var hosts = []; + _.each(nodes, function (node, id) { + var hostnameMatches = extractHostPartsRE.exec(node.hostname); + hosts.push({ + hostname: hostnameMatches[1], + port: hostnameMatches[2], + id: id, + name: node.name, + servername: node.hostname, + version: node.version + }); + }); + return hosts; + }, + sniffOnStart: false, + sniffAfterRequests: null, + sniffOnConnectionFail: false, + maxRetries: 3 +}; + +function ClientConfig(config) { + _.extend(this, defaultConfig, config); + + if (typeof this.hosts !== 'object') { + this.hosts = [this.hosts]; + } + + this.hosts = _.map(this.hosts, this.transformHost); +} + +ClientConfig.prototype.transformHost = function (host) { + if (typeof host === 'object') { + if (host.protocol) { + // the protocol must end in a color + if (host.protocol[host.protocol.length - 1] !== ':') { + host.protocol = host.protocol + ':'; + } + } else { + host.protocol = 'http:'; + } + + if (host.host && !host.hostname) { + // utl.format && url.parse uses "hostname" to represent just the name of the host, "host" is "hostname + port" + host.hostname = host.host; + delete host.host; + } + + return host; + } + + if (!hostProtocolRE.test(host)) { + host = 'http://' + host; + } + var urlInfo = url.parse(host, false, true); + return { + protocol: urlInfo.protocol, + hostname: urlInfo.hostname, + port: urlInfo.port + }; +}; diff --git a/src/lib/connection.js b/src/lib/connection.js new file mode 100644 index 000000000..08636f41f --- /dev/null +++ b/src/lib/connection.js @@ -0,0 +1,45 @@ +module.exports = ConnectionAbstract; + +var _ = require('./utils'), + EventEmitter = require('events').EventEmitter; + +/** + * Abstract class used for Connection classes + * @param client {Client} - The client that this connection belongs to + * @param config {Object} - a map of configuration details for this connection + * @param [config.hostname=localhost] {String} - The hostname for the node this connection connects to + * @param [config.port=9200] {Integer} - The port on the server that ES is listening to + * @class ConnectionAbstract + * @constructor + */ +function ConnectionAbstract(client, config, id) { + EventEmitter.call(this); + this.client = client; + this.id = id; + this.hostname = config.hostname || 'localhost'; + this.port = config.port || 9200; + this.timeout = config.timeout || 10000; +} +_.inherits(ConnectionAbstract, EventEmitter); + +/** + * Make a request using this connection. Must be overridden by Connection classes, which can add whatever keys to + * params that they like. These are just the basics. + * + * @param [params] {Object} - The parameters for the request + * @param params.path {String} - The path for which you are requesting + * @param params.method {String} - The HTTP method for the request (GET, HEAD, etc.) + * @param params.timeout {Integer} - The amount of time in milliseconds that this request should be allowed to run for. + * @param cb {Function} - A callback to be called once with `cb(err, responseBody, responseStatus)` + */ +ConnectionAbstract.prototype.request = function () { + throw new Error('Connection#request must be overwritten by the Connector'); +}; + +ConnectionAbstract.prototype.ping = function () { + return this.request({ + path: '/', + method: 'HEAD', + timeout: '100' + }); +}; diff --git a/src/lib/connection_pool.js b/src/lib/connection_pool.js index b576c458d..7d0226fc7 100644 --- a/src/lib/connection_pool.js +++ b/src/lib/connection_pool.js @@ -3,9 +3,140 @@ * before providing them to the application * * @class ConnectionPool - * @constructor - * @param {object} [config={}] - an object describing the configuration for the ConnectionPool + * @param {Client} client - The client this pool belongs to */ -function ConnectionPool(config) { -} \ No newline at end of file +module.exports = ConnectionPool; + +var _ = require('./utils'), + selectors = _.reKey(_.requireDir(module, './selectors'), _.camelCase), + connectors = _.reKey(_.requireDir(module, './connections'), _.studlyCase), + EventEmitter = require('events').EventEmitter, + q = require('q'), + errors = require('./errors'); + +function ConnectionPool(client) { + this.client = client; + this.index = {}; + this.connections = { + alive: [], + dead: [] + }; + + var config = client.config; + + // validate connectionConstructor + if (typeof config.connectionConstructor !== 'function') { + if (_.has(connectors, config.connectionConstructor)) { + config.connectionConstructor = connectors[config.connectionConstructor]; + } else { + throw new TypeError('Invalid connectionConstructor ' + config.connectionConstructor + + ', specify a function or one of ' + _.keys(connectors).join(', ')); + } + } + + this.connectionConstructor = config.connectionConstructor; + this.setNodes(config.hosts); +} + +ConnectionPool.prototype.setNodes = function (nodes) { + var client = this.client; + + if (!_.isArrayOfObjects(nodes)) { + throw new TypeError('Invalid hosts: specify an Array of Objects with host and port keys'); + } + + var i, id, prevIndex = _.clone(this.index), connection; + for (i = 0; i < nodes.length; i++) { + id = nodes[i].host + ':' + nodes[i].port; + if (prevIndex[id]) { + delete prevIndex[id]; + } else { + client.log.info('Creating connection to ' + id); + connection = new this.connectionConstructor(this.client, nodes[i]); + if (!(connection instanceof EventEmitter)) { + throw new Error('ConnectionConstructor does not implement the event interface'); + } else if (!EventEmitter.listenerCount(connection, 'closed')) { + throw new Error( + 'Connection Constructor ' + this.connectionConstructor.name + + ' does not listen for the closed event. No bueno.' + ); + } + this.index[id] = connection; + this.setStatus(connection, 'alive'); + } + } + + var toRemove = _.keys(prevIndex); + for (i = 0; i < toRemove.length; i++) { + client.log.info('Closing connection to ' + toRemove[i]); + this.index[toRemove[i]].isClosed(); + delete this.index[toRemove[i]]; + } + + client.log.info('Nodes successfully changed'); +}; + +ConnectionPool.prototype.select = function (cb) { + var config = this.client.config; + + if (typeof config.selector !== 'function') { + if (_.has(selectors, config.selector)) { + config.selector = selectors[config.selector]; + } else { + throw new TypeError('Invalid Selector ' + config.selector + '. specify a function or one of ' + _.keys(selectors).join(', ')); + } + } + + if (this.connections.alive.length) { + if (config.selector.length > 1) { + config.selector(this.connections.alive, cb); + } else { + cb(null, config.selector(this.connections.alive)); + } + } else { + cb(new errors.ConnectionError('No living connections')); + } +}; + + +ConnectionPool.prototype.setStatus = function (connection, status) { + var origStatus = connection.status, from, to, index; + + if (origStatus === status) { + return true; + } else { + this.client.log.info('connection to', _.formatUrl(connection), 'is', status); + } + + switch (status) { + case 'alive': + from = this.connections.dead; + to = this.connections.alive; + break; + case 'dead': + from = this.connections.alive; + to = this.connections.dead; + break; + case 'closed': + from = this.connections[origStatus]; + break; + } + + if (from && from.indexOf) { + index = from.indexOf(connection); + if (~index) { + from.splice(index, 1); + } + } + + if (to && to.indexOf) { + index = to.indexOf(connection); + if (!~index) { + to.push(connection); + } + } + + connection.status = status; + connection.emit(status, origStatus); +}; diff --git a/src/lib/connections/angular.js b/src/lib/connections/angular.js new file mode 100644 index 000000000..fa4e412ad --- /dev/null +++ b/src/lib/connections/angular.js @@ -0,0 +1,15 @@ +/** + * Connection that registers a module with angular, using angular's $http service + * to communicate with ES. + * + * @class connections.Angular + */ +module.exports = AngularConnection; + +var _ = require('../utils'), + ConnectionAbstract = require('../connection'); + +function AngularConnection() { + +} +_.inherits(AngularConnection, ConnectionAbstract); diff --git a/src/lib/connections/http.js b/src/lib/connections/http.js new file mode 100644 index 000000000..0cf8e5cb0 --- /dev/null +++ b/src/lib/connections/http.js @@ -0,0 +1,117 @@ +/** + * A Connection that operates using Node's http module + * + * @param client {Client} - The Client that this class belongs to + * @param config {Object} - Configuration options + * @param [config.protocol=http:] {String} - The HTTP protocol that this connection will use, can be set to https: + * @class HttpConnection + */ +module.exports = HttpConnection; + +var http = require('http'), + _ = require('../utils'), + q = require('q'), + errors = require('../errors'), + ConnectionAbstract = require('../connection'), + defaultHeaders = { + 'connection': 'keep-alive' + }; + + +function HttpConnection(client, config) { + ConnectionAbstract.call(this, client, config); + + this.protocol = config.protocol || 'http:'; + if (this.protocol[this.protocol.length - 1] !== ':') { + this.protocol = this.protocol + ':'; + } + + this.agent = new http.Agent({ + keepAlive: true, + // delay between the last data packet received and the first keepalive probe + keepAliveMsecs: 1000, + maxSockets: this.client.config.maxSockets, + maxFreeSockets: this.client.config.maxFreeSockets + }); + + this.on('closed', function () { + this.agent.destroy(); + this.removeAllListeners(); + }); +} +_.inherits(HttpConnection, ConnectionAbstract); + +HttpConnection.prototype.request = function (params, cb) { + var request, + response, + status = 0, + timeout = params.timeout || this.timeout, + timeoutId, + log = this.client.log; + + var reqParams = _.defaults({ + protocol: this.protocol, + hostname: this.hostname, + port: this.port, + path: params.path, + method: _.toUpperString(params.method) || (params.body ? 'POST' : 'GET'), + headers: _.defaults(params.headers || {}, defaultHeaders) + }); + + // general clean-up procedure to run after the request, can only run once + var cleanUp = function (err) { + cleanUp = _.noop; + + if (err) { + log.error(err); + } + + clearTimeout(timeoutId); + if (request) { + request.removeAllListeners(); + } + _.nextTick(cb, err, response, status); + }; + + // ensure that "get" isn't being used with a request body + if (params.body && reqParams.method === 'GET') { + cleanUp(new TypeError('HTTP Method GET can not have a body')); + return; + } + + reqParams.agent = this.agent; + + request = http.request(reqParams); + + request.on('response', function (incoming) { + status = incoming.statusCode; + incoming.setEncoding('utf8'); + + incoming.on('data', function (d) { + response += d; + }); + + incoming.on('close', function (err) { + console.log('closed'); + cleanUp(err); + }); + + incoming.on('end', function requestComplete() { + incoming.removeAllListeners(); + log.trace(reqParams.method, reqParams, params.body, response, status); + cleanUp(); + }); + }); + + request.on('error', function (err) { + request.abort(); + cleanUp(err); + }); + + // timeout for the entire request, req.setTimeout only set the socket level timeout + timeoutId = setTimeout(function () { + request.emit('error', new errors.RequestTimeout('Request timed out at ' + timeout + 'ms')); + }, timeout); + + request.end(params.body); +}; diff --git a/src/lib/connections/jquery.js b/src/lib/connections/jquery.js new file mode 100644 index 000000000..53a872cb1 --- /dev/null +++ b/src/lib/connections/jquery.js @@ -0,0 +1,9 @@ +module.exports = JqueryConnection; + +var _ = require('../utils'), + ConnectionAbstract = require('../connection'); + +function JqueryConnection() { + +} +_.inherits(JqueryConnection, ConnectionAbstract); diff --git a/src/lib/connections/xhr.js b/src/lib/connections/xhr.js new file mode 100644 index 000000000..3ed381af3 --- /dev/null +++ b/src/lib/connections/xhr.js @@ -0,0 +1,15 @@ +/** + * Generic Transport for the browser, using the XmlHttpRequest object + * + * @class connections.Xhr + */ + +module.exports = XhrConnection; + +var _ = require('../utils'), + ConnectionAbstract = require('../connection'); + +function XhrConnection() { + +} +_.inherits(XhrConnection, ConnectionAbstract); diff --git a/src/lib/errors.js b/src/lib/errors.js index e69de29bb..b552a457f 100644 --- a/src/lib/errors.js +++ b/src/lib/errors.js @@ -0,0 +1,105 @@ +var _ = require('./utils'), + errors = module.exports; + +function ErrorAbstract(msg) { + Error.call(this, msg); + Error.captureStackTrace(this, this.constructor); + + this.message = msg; +} +_.inherits(ErrorAbstract, Error); + +/** + * Connection Error + * @param {String} [msg] - An error message that will probably end up in a log. + */ +errors.ConnectionError = function ConnectionError(msg) { + return new Error(msg || 'Connection Failure'); + ErrorAbstract.call(this, msg || 'Connection Failure'); +}; +_.inherits(errors.ConnectionError, ErrorAbstract); + +/** + * Generic Error + * @param {String} [msg] - An error message that will probably end up in a log. + */ +errors.Generic = function Generic(msg) { + return new Error(msg || 'Generic Error'); + ErrorAbstract.call(this, msg || 'Generic Error'); +}; +_.inherits(errors.Generic, ErrorAbstract); + +/** + * Request Timeout Error + * @param {String} [msg] - An error message that will probably end up in a log. + */ +errors.RequestTimeout = function RequestTimeout(msg) { + return new Error(msg || 'RequestTimeout'); + ErrorAbstract.call(this, msg || 'Request Timeout'); +}; +_.inherits(errors.RequestTimeout, ErrorAbstract); + + +var statusCodes = { + + /** + * Service Unavailable + * @param {String} [msg] - An error message that will probably end up in a log. + */ + 503: 'Service Unavailable', + + /** + * Internal Server Error + * @param {String} [msg] - An error message that will probably end up in a log. + */ + 500: 'Internal Server Error', + + /** + * Precondition Failed + * @param {String} [msg] - An error message that will probably end up in a log. + */ + 412: 'Precondition Failed', + + /** + * Conflict + * @param {String} [msg] - An error message that will probably end up in a log. + */ + 409: 'Conflict', + + /** + * Forbidden + * @param {String} [msg] - An error message that will probably end up in a log. + */ + 403: 'Forbidden', + + /** + * Not Found + * @param {String} [msg] - An error message that will probably end up in a log. + */ + 404: 'Not Found', + + /** + * Bad Request + * @param {String} [msg] - An error message that will probably end up in a log. + */ + 400: 'Bad Request', + + /** + * Moved Permanently + * @param {String} [msg] - An error message that will probably end up in a log. + */ + 301: 'Moved Permanently' +}; + +_.each(statusCodes, function (name, status) { + var className = _.studlyCase(name); + + function StatusCodeError(msg) { + return new Error(msg || name); + ErrorAbstract.call(this, msg || name); + } + + _.inherits(StatusCodeError, ErrorAbstract); + errors[className] = StatusCodeError; + errors[status] = StatusCodeError; +}); diff --git a/src/lib/logger.js b/src/lib/logger.js new file mode 100644 index 000000000..4442dfaf3 --- /dev/null +++ b/src/lib/logger.js @@ -0,0 +1,157 @@ +var Log = require('./log'), + _ = require('./utils'); + +/** + * Abstract class providing common functionality to loggers + * @param {[type]} config [description] + * @param {[type]} bridge [description] + */ +function LoggerAbstract(config, bridge) { + + this.bridge = bridge; + this.listeningLevels = []; + + // bound copies of the event handlers + this.handlers = _.reduce(Log.levels, function (handlers, name) { + handlers[name] = _.bindKey(this, 'on' + _.studlyCase(name)); + return handlers; + }, {}, this); + + // then the bridge closes, remove our event listeners + this.bridge.on('closing', _.bindKey(this, 'cleanUpListeners')); + + this.setupListeners(config.levels); +} + +function padNumToTen(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + +/** + * Create a timestamp string used in the format function. Defers to Log.timestamp if it is defined, + * Also, feel free to override this at the logger level. + * @return {String} - Timestamp in ISO 8601 UTC + */ +LoggerAbstract.prototype.timestamp = function () { + var d = new Date(); + return d.getUTCFullYear() + '-' + + padNumToTen(d.getUTCMonth() + 1) + '-' + + padNumToTen(d.getUTCDate()) + 'T' + + padNumToTen(d.getUTCHours()) + ':' + + padNumToTen(d.getUTCMinutes()) + ':' + + padNumToTen(d.getUTCSeconds()) + 'Z'; +}; + +function indent(text, spaces) { + var space = _.repeat(' ', spaces || 2); + return text.split(/\r?\n/).map(function (line) { + return space + line; + }).join('\n'); +} + +LoggerAbstract.prototype.format = function (label, message) { + return label + ': ' + this.timestamp() + '\n' + indent(message) + '\n\n'; +}; + +LoggerAbstract.prototype.write = function () { + throw new Error('This should be overwritten by the logger'); +}; + +/** + * Clear the current event listeners and then re-listen for events based on the level specified + * + * @method setupListeners + * @private + * @param {Integer} level - The max log level that this logger should listen to + * @return {undefined} + */ +LoggerAbstract.prototype.setupListeners = function (levels) { + this.cleanUpListeners(); + + this.listeningLevels = levels; + + _.each(this.listeningLevels, function (level) { + this.bridge.on(level, this.handlers[level]); + }, this); +}; + +/** + * Clear the current event listeners + * + * @method cleanUpListeners + * @private + * @return {undefined} + */ +LoggerAbstract.prototype.cleanUpListeners = function () { + _.each(this.listeningLevels, function (level) { + this.bridge.removeListener(level, this.handlers[level]); + }, this); +}; + +/** + * Handler for the bridges "error" event + * + * @method onError + * @private + * @param {Error} e - The Error object to log + * @return {undefined} + */ +LoggerAbstract.prototype.onError = function (e) { + this.write((e.name === 'Error' ? 'ERROR' : e.name), e.stack); +}; + +/** + * Handler for the bridges "warning" event + * + * @method onWarning + * @private + * @param {String} msg - The message to be logged + * @return {undefined} + */ +LoggerAbstract.prototype.onWarning = function (msg) { + this.write('WARNING', msg); +}; + +/** + * Handler for the bridges "info" event + * + * @method onInfo + * @private + * @param {String} msg - The message to be logged + * @return {undefined} + */ +LoggerAbstract.prototype.onInfo = function (msg) { + this.write('INFO', msg); +}; + +/** + * Handler for the bridges "debug" event + * + * @method onDebug + * @private + * @param {String} msg - The message to be logged + * @return {undefined} + */ +LoggerAbstract.prototype.onDebug = function (msg) { + this.write('DEBUG', msg); +}; + +/** + * Handler for the bridges "trace" event + * + * @method onTrace + * @private + * @param {String} msg - The message to be logged + * @return {undefined} + */ +LoggerAbstract.prototype.onTrace = function (method, url, body, responseBody, responseStatus) { + var message = 'curl "' + url.replace(/"/g, '\\"') + '" -X' + method.toUpperCase(); + if (body) { + message += ' -d "' + body.replace(/"/g, '\\"') + '"'; + } + message += '\n<- ' + responseStatus + '\n' + responseBody; + this.write('TRACE', message); +}; + + +module.exports = LoggerAbstract; diff --git a/src/lib/loggers/File.js b/src/lib/loggers/File.js index f70a5643f..78a15faf2 100644 --- a/src/lib/loggers/File.js +++ b/src/lib/loggers/File.js @@ -1,106 +1,26 @@ -var LogAbstract = require('./log_abstract') - , _ = require('../toolbelt') - , fs = require('fs'); - -function prettyPrint(json) { - try { - json = JSON.stringify(JSON.parse(json), null, ' '); - } catch (e) {} - return json; -} - - /** * Logger that writes to a file * * @class Loggers.File + * @extends StreamLogger * @constructor - * @see LoggerAbstract * @param {Object} config - The configuration for the Logger (See LoggerAbstract for generic options) * @param {String} config.path - The location to write * @param {Log} bridge - The object that triggers logging events, which we will record */ -function File(config, bridge) { - this._constructSuper(arguments); - - this.outputPath = config.path; -} -_.inherits(File, LogAbstract); - -File.prototype.write = function (label, message) { - if (!this.file) { - this.file = fs.createWriteStream(this.outputPath, { - flags: 'a', - encoding: 'utf8' - }); - } - - this.file.write(this.format(label, message), 'utf8'); -}; - -/** - * Handler for the bridges "error" event - * - * @method onError - * @private - * @param {Error} e - The Error object to log - * @return {undefined} - */ -File.prototype.onError = function (e) { - this.write((e.name === 'Error' ? 'ERROR' : e.name), e.message + '\n\nStack Trace:\n' + e.stack); -}; - -/** - * Handler for the bridges "warning" event - * - * @method onWarning - * @private - * @param {String} msg - The message to be logged - * @return {undefined} - */ -File.prototype.onWarning = function (msg) { - this.write('WARNING', msg); -}; - -/** - * Handler for the bridges "info" event - * - * @method onInfo - * @private - * @param {String} msg - The message to be logged - * @return {undefined} - */ -File.prototype.onInfo = function (msg) { - this.write('INFO', msg); -}; - -/** - * Handler for the bridges "debug" event - * - * @method onDebug - * @private - * @param {String} msg - The message to be logged - * @return {undefined} - */ -File.prototype.onDebug = function (msg) { - this.write('DEBUG', msg); -}; - -/** - * Handler for the bridges "trace" event - * - * @method onTrace - * @private - * @param {String} msg - The message to be logged - * @return {undefined} - */ -File.prototype.onTrace = function (method, url, body, responseStatus, responseBody) { - var message = 'curl "' + url.replace(/"/g, '\\"') + '" -X' + method.toUpperCase(); - if (body) { - message += ' -d "' + body.replace(/"/g, '\\"') + '"'; - } - message += '\n<- ' + responseStatus + '\n' + prettyPrint(responseBody); - this.write('TRACE', message); -}; module.exports = File; + +var StreamLogger = require('./stream'), + _ = require('../utils'), + fs = require('fs'); + +function File(config, bridge) { + config.stream = fs.createWriteStream(config.path, { + flags: 'a', + encoding: 'utf8' + }); + + File.callSuper(this, arguments); +} +_.inherits(File, StreamLogger); diff --git a/src/lib/loggers/StdIo.js b/src/lib/loggers/StdIo.js index 8c682107b..1692bd16d 100644 --- a/src/lib/loggers/StdIo.js +++ b/src/lib/loggers/StdIo.js @@ -1,34 +1,38 @@ -var clc = require('cli-color') - , LogAbstract = require('./log_abstract') - , _ = require('../toolbelt'); - /** * Special version of the Stream logger, which logs errors and warnings to stderr and all other * levels to stdout. * * @class Loggers.Stdio + * @extends LoggerAbstract * @constructor * @param {Object} config - The configuration for the Logger * @param {string} config.level - The highest log level for this logger to output. * @param {Log} bridge - The object that triggers logging events, which we will record */ + +module.exports = Stdio; + +var clc = require('cli-color'), + LoggerAbstract = require('../logger'), + _ = require('../utils'); + function Stdio(config, bridge) { - this._constructSuper(arguments); + Stdio.callSuper(this, arguments); // config/state this.color = _.has(config, 'color') ? !!config.color : true; } -_.inherits(Stdio, LogAbstract); +_.inherits(Stdio, LoggerAbstract); /** * Sends output to a stream, does some formatting first * * @method write * @private - * @param {WriteableStream} to - The stream that should receive this message - * @param {String} label - The text that should be used at the begining of the message - * @param {function} colorize - A function that recieves a string and returned a colored version of it + * @param {WritableStream} to - The stream that should receive this message + * @param {String} label - The text that should be used at the beginning the message + * @param {function} colorize - A function that receives a string and returned a colored version of it * @param {*} what - The message to log * @return {undefined} */ @@ -48,7 +52,7 @@ Stdio.prototype.write = function (to, label, colorize, message) { * @return {undefined} */ Stdio.prototype.onError = function (e) { - this.write(process.stderr, e.name === 'Error' ? 'ERROR' : e.name, clc.red.bold, [e.message, '\n\nStack Trace:\n' + e.stack]); + this.write(process.stderr, e.name === 'Error' ? 'ERROR' : e.name, clc.red.bold, e.stack); }; /** @@ -92,11 +96,14 @@ Stdio.prototype.onDebug = function (msg) { * * @method onTrace * @private - * @param {String} msg - The message to be logged * @return {undefined} */ -Stdio.prototype.onTrace = function (method, url, body, responseStatus, responseBody) { - var message = '\nHTTP ' + method + ' ' + url + ' -> '; +Stdio.prototype.onTrace = function (method, url, body, responseBody, responseStatus) { + var message = 'curl "' + url.replace(/"/g, '\\"') + '" -X' + method.toUpperCase(); + if (body) { + message += ' -d "' + body.replace(/"/g, '\\"') + '"'; + } + message += '\n<- '; if (this.color) { if (responseStatus === 200) { message += clc.green.bold(responseStatus); @@ -106,12 +113,7 @@ Stdio.prototype.onTrace = function (method, url, body, responseStatus, responseB } else { message += responseStatus; } - message += '\n' + responseBody + '\n\n'; - message += 'curl "' + url.replace('"', '\\"') + '" -X' + method.toUpperCase(); - if (body) { - message += ' -d ' + JSON.stringify(JSON.stringify(body)); - } - this.write(process.stdout, 'TRACE', clc.cyanBright.bold, message + '\n\n'); -}; + message += '\n' + responseBody; -module.exports = Stdio; + this.write(process.stdout, 'TRACE', clc.cyanBright.bold, message); +}; diff --git a/src/lib/loggers/Stream.js b/src/lib/loggers/Stream.js index 29754dc2c..224c073ab 100644 --- a/src/lib/loggers/Stream.js +++ b/src/lib/loggers/Stream.js @@ -1,14 +1,37 @@ /** - * A logger object, which listens to the LogBridge for logging events based on it's config. This - * logger writes it logs to any [WriteableStream](http://nodejs.org/api/stream.html#stream_class_stream_writable_1). + * Logger that writes to a file * - * @class Loggers.Stream + * @class Loggers.File + * @extends LoggerAbstract * @constructor - * @param {Object} config - A hash of the config options - * @param {Log} logBridge - The log bridge that will emit events for each log entry + * @see LoggerAbstract + * @param {Object} config - The configuration for the Logger (See LoggerAbstract for generic options) + * @param {String} config.path - The location to write + * @param {Log} bridge - The object that triggers logging events, which we will record */ -function Stream(config, logBridge) { - this.setLevel(config.level); -} -module.exports = Stream; \ No newline at end of file +module.exports = Stream; + +var LoggerAbstract = require('../Logger'), + nodeStreams = require('stream'), + _ = require('../utils'), + fs = require('fs'); + +function Stream(config, bridge) { + Stream.callSuper(this, arguments); + + if (config.stream instanceof nodeStreams.Writable) { + this.stream = config.stream; + } else { + throw new TypeError('Invalid stream, use an instance of stream.Writeable'); + } +} +_.inherits(Stream, LoggerAbstract); + +Stream.prototype.write = function (label, message) { + this.stream.write(this.format(label, message), 'utf8'); +}; + +Stream.prototype.close = function () { + this.stream.end(); +}; diff --git a/src/lib/loggers/log_abstract.js b/src/lib/loggers/log_abstract.js deleted file mode 100644 index fc6984d1b..000000000 --- a/src/lib/loggers/log_abstract.js +++ /dev/null @@ -1,83 +0,0 @@ -var Log = require('../log') - , _ = require('../toolbelt'); - -function LogAbstract(config, bridge) { - - this.bridge = bridge; - this.listeningLevels = []; - - // bound copies of the event handlers - this.handlers = _.reduce(Log.levels, function (handlers, name) { - handlers[name] = _.bindKey(this, 'on' + _.studlyCase(name)); - return handlers; - }, {}, this); - - // then the bridge closes, remove our event listeners - this.bridge.on('closing', _.bindKey(this, 'cleanUpListeners')); - - this.setupListeners(config.levels); -} - -function padNumToTen(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - -/** - * Create a timestamp string used in the format function. Defers to Log.timestamp if it is defined, - * Also, feel free to override this at the logger level. - * @return {String} - Timestamp in ISO 8601 UTC - */ -LogAbstract.prototype.timestamp = function () { - var d = new Date(); - return d.getUTCFullYear() + '-' + - padNumToTen(d.getUTCMonth() + 1) + '-' + - padNumToTen(d.getUTCDate()) + 'T' + - padNumToTen(d.getUTCHours()) + ':' + - padNumToTen(d.getUTCMinutes()) + ':' + - padNumToTen(d.getUTCSeconds()) + 'Z'; -}; - -function indent(test, spaces) { - var space = _.repeat(' ', spaces || 2); - return test.split(/\r?\n/).map(function (line) { - return space + line; - }).join('\n'); -} - -LogAbstract.prototype.format = function (label, message) { - return label + ': ' + this.timestamp() + '\n' + indent(message) + '\n\n'; -}; - -/** - * Clear the current event listeners and then re-listen for events based on the level specified - * - * @method setupListeners - * @private - * @param {Integer} level - The max log level that this logger should listen to - * @return {undefined} - */ -LogAbstract.prototype.setupListeners = function (levels) { - this.cleanUpListeners(); - - this.listeningLevels = levels; - - _.each(this.listeningLevels, function (level) { - this.bridge.on(level, this.handlers[level]); - }, this); -}; - -/** - * Clear the current event listeners - * - * @method cleanUpListeners - * @private - * @return {undefined} - */ -LogAbstract.prototype.cleanUpListeners = function () { - _.each(this.listeningLevels, function (level) { - this.bridge.removeListener(level, this.handlers[level]); - }, this); -}; - - -module.exports = LogAbstract; diff --git a/src/lib/param_helper.js b/src/lib/param_helper.js index a07b47c94..2f0ef6dd3 100644 --- a/src/lib/param_helper.js +++ b/src/lib/param_helper.js @@ -1,4 +1,4 @@ -var _ = require('./toolbelt'); +var _ = require('./utils'); exports.bulkBody = function (val, serializer) { var body = '', i; diff --git a/src/lib/selectors/Random.js b/src/lib/selectors/Random.js index a0f0f7843..88e565ab5 100644 --- a/src/lib/selectors/Random.js +++ b/src/lib/selectors/Random.js @@ -1,7 +1,5 @@ -var _ = require('../toolbelt'); +module.exports = RandomSelect; function RandomSelect(connections) { - return _.shuffle(connections).unshift(); + return connections[Math.floor(Math.random() * connections.length)]; } - -module.exports = RandomSelect; diff --git a/src/lib/selectors/round_robin.js b/src/lib/selectors/round_robin.js index 6e4364d63..d4c035d5e 100644 --- a/src/lib/selectors/round_robin.js +++ b/src/lib/selectors/round_robin.js @@ -1,6 +1,13 @@ +/** + * Selects a connection the simplest way possible, Round Robin + * + * @class selector.roundRobin + * @constructor + * @type {Function} + */ +module.exports = RoundRobinSelect; + function RoundRobinSelect(connections) { connections.unshift(connections.pop()); return connections[0]; } - -module.exports = RoundRobinSelect; \ No newline at end of file diff --git a/src/lib/serializers/Json.js b/src/lib/serializers/Json.js index b9d6e5dbf..516c10f77 100644 --- a/src/lib/serializers/Json.js +++ b/src/lib/serializers/Json.js @@ -1,6 +1,10 @@ -/* JSON serializer */ +/** + * Simple JSON serializer + * @type {[type]} + */ +module.exports = Json; -var _ = require('../toolbelt'); +var _ = require('../utils'); function Json(client) { this.client = client; @@ -11,13 +15,21 @@ Json.prototype.serialize = function (val, replacer, spaces) { return null; } else if (typeof val === 'string') { - this.client.log.info('body is already a string, not encoding'); return val; } else { return JSON.stringify(val, replacer, spaces); } }; -Json.prototype.unserialize = _.bind(JSON.parse, JSON); - -module.exports = Json; +Json.prototype.unserialize = function (str) { + if (typeof str === 'string') { + try { + return JSON.parse(str); + } catch (e) { + this.client.log.error(new Error('unable to parse', str)); + return null; + } + } else { + return str; + } +}; diff --git a/src/lib/serializers/query_string.js b/src/lib/serializers/query_string.js deleted file mode 100644 index 088f736b5..000000000 --- a/src/lib/serializers/query_string.js +++ /dev/null @@ -1,17 +0,0 @@ -/* JSON serializer */ - -var _ = require('lodash'); - -function QueryString() {} - -QueryString.prototype.serialize = function (obj) { - return JSON.stringify(obj); -}; - -// TODO: real query string parsing... there is a well tested module for this :P -QueryString.prototype.unserialize = function (string) { - return _.object(_.map(_.map(string.split('&'), function splitOnEqlAndDecode(string) { - return _.map(string.split('='), decodeURIComponent); - }))); -}; -module.exports = QueryString; \ No newline at end of file diff --git a/src/lib/transports/Xhr.js b/src/lib/transports/Xhr.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/lib/transports/angular_http.js b/src/lib/transports/angular_http.js deleted file mode 100644 index 4c9f00c3a..000000000 --- a/src/lib/transports/angular_http.js +++ /dev/null @@ -1 +0,0 @@ -/* angular.js transport client for elasticsearch-js */ \ No newline at end of file diff --git a/src/lib/transports/jquery_xhr.js b/src/lib/transports/jquery_xhr.js deleted file mode 100644 index 0f0c8dcb8..000000000 --- a/src/lib/transports/jquery_xhr.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Transport class for making HTTP requests using jQuery's ajax methods - * - * @class jQueryXhr - * @constructor - */ -function jQueryXhr() { - -} \ No newline at end of file diff --git a/src/lib/transports/node_http.js b/src/lib/transports/node_http.js deleted file mode 100644 index 2ed63b301..000000000 --- a/src/lib/transports/node_http.js +++ /dev/null @@ -1,109 +0,0 @@ -/* elasticsearch-js nodejs transport */ -var http = require('http') - , _ = require('../toolbelt') - , url = require('url') - , Q = require('q'); - -/** - * Http transport to use in Node.js - * - * @class NodeHttp - */ -function NodeHttp(hosts, client) { - this.hosts = _.map(hosts, function (host) { - if (!~host.indexOf('//')) { - host = '//' + host; - } - return _.pick(url.parse(host, false, true), ['hostname', 'port']); - }); - this.client = client; -} - -NodeHttp.prototype.request = function (params) { - var deferred = Q.defer() - , req = _.extend( - url.parse(params.url, false, false), - this.hosts[Math.round(Math.random() * (this.hosts.length - 1))] - ); - - // we need to have a method - req.method = params.method || (params.body ? 'post' : 'get'); - - // ensure that get isn't being used with a request body - if (params.body && req.method.toLowerCase() === 'get') { - deferred.reject(new TypeError('HTTP Method GET can not have a body')); - return deferred.promise; - } - - var request = http.request(req, function (res) { - var response = { - data : '', - headers : res.headers, - status : res.statusCode - }; - - res.setEncoding('utf8'); - - res.on('data', function (d) { - response.data += d; - }); - - res.on('end', function () { - this.client.log.trace(req.method, req, params.body, response.status, response.data); - - // attempt to parse the response - if (response.data) { - try { - response.data = JSON.parse(response.data); - } catch (e) { - response.error = new TypeError('Non-valid JSON reponse from Elasticsearch'); - } - } - - if (!response.error && response.status >= 400) { - response.error = new Error(errorMessage(response)); - response.error.status = response.status; - } - - if (response.error) { - if (_.contains(params.ignore, response.status)) { - deferred.resolve(false, response); - } else { - // reject with error - deferred.reject(response.error, response); - } - } else { - // we're done - deferred.resolve(req.method === 'head' ? true : response.data, response); - } - }.bind(this)); - - }.bind(this)); - - request.on('error', function (err) { - deferred.reject(err); - }); - - if (params.body) { - request.write(params.body); - } - - request.end(); - - return deferred.promise; -}; - -function errorMessage(response) { - if (response.data.error) { - return response.data.error; - } else { - switch (response.status) { - case 404: - return 'Not Found'; - default: - return response.status + ' - Unkown Error'; - } - } -} - -module.exports = NodeHttp; diff --git a/src/lib/toolbelt.js b/src/lib/utils.js similarity index 53% rename from src/lib/toolbelt.js rename to src/lib/utils.js index 28a91178f..dffa648e1 100644 --- a/src/lib/toolbelt.js +++ b/src/lib/utils.js @@ -1,13 +1,14 @@ -var path = require('path') - , _ = require('lodash') - , fs = require('fs') - , requireDir = require('require-directory') - , qs = require('qs') - , nodeUtils = require('util'); +var path = require('path'), + _ = require('lodash'), + fs = require('fs'), + requireDir = require('require-directory'), + qs = require('qs'), + url = require('url'), + nodeUtils = require('util'); /** * Custom utils library, basically a modified version of [lodash](http://lodash.com/docs) + - * [node.uitls](http://nodejs.org/api/util.html#util_util) that doesn't use mixins to prevent + * [node.utils](http://nodejs.org/api/util.html#util_util) that doesn't use mixins to prevent * confusion when requiring lodash itself. * * @class utils @@ -33,11 +34,11 @@ utils.inspect = function (thing, opts) { utils.joinPath = path.join; /** - * Extends lodash's map function so that objects can be passed to map and will be retuned as an object with - * each value transformed by the itterator. + * Extends lodash's map function so that objects can be passed to map and will be returned as an object with + * each value transformed by the iterator. * * @method utils.map - * @param [Iterable] obj - the thing to iterate over + * @param [Collection] obj - the thing to iterate over * @param [Function] mapper - the function to call for each element in obj * @param [*] context - the this context to use for each call to mapper */ @@ -53,7 +54,7 @@ utils.map = function (obj, mapper, context) { * Require all of the modules in a directory * * @method requireDir - * @param {Module} module - The module object which will own the required modules. + * @param {Function} module - The module object which will own the required modules. * @param {String} path - Path to the directory which will be traversed (can be relative to module) * @return {Object} - An object with each required files */ @@ -67,9 +68,9 @@ utils.requireDir = function (module, dirPath) { /** * Requires all of the files in a directory, then transforms the filenames into * StudlyCase -- one level deep for now. - * @param {Module} module - The module object which will own the required modules. - * @param {String} path - Path to the directory which will be traversed (can be relative to module) - * @return {Object} - An object with each required files, keys will be the StudlyCase version of the filesnames. + * @param {Function} module - The module object which will own the required modules. + * @param {String} dirPath - Path to the directory which will be traversed (can be relative to module) + * @return {Object} - An object with each required files, keys will be the StudlyCase version of the filenames. */ utils.requireClasses = function (module, dirPath) { return utils.reKey(utils.requireDir(module, dirPath), utils.studlyCase, false); @@ -79,7 +80,7 @@ utils.requireClasses = function (module, dirPath) { * Recursively re-key an object, applying "transform" to each key * @param {Object} obj - The object to re-key * @param {Function} transform - The transformation function to apply to each key - * @param {Boolean} recursive - Should this act recursively? + * @param {Boolean} [recursive=false] - Should this act recursively? * @param {Object} out - used primarily for recursion, allows you to specify the object which new keys will be written to * @return {Object} */ @@ -102,11 +103,11 @@ utils.reKey = function (obj, transform, recursive) { }; /** - * Recursively merge two objects, walking into each object and concating arrays. - * If both to and from have a value at a key, but the values' types don't match - * to's value is left unmodified. Only Array and Object values are merged - that + * Recursively merge two objects, walking into each object and concating arrays. If both to and from have a value at a + * key, but the values' types don't match to's value is left unmodified. Only Array and Object values are merged - that * it to say values with a typeof "object" - * @param {Obejct} to - Object to merge into (no cloning, the original object + * + * @param {Object} to - Object to merge into (no cloning, the original object * is modified) * @param {Object} from - Object to pull changed from * @return {Object} - returns the modified to value @@ -132,18 +133,16 @@ utils.deepMerge = function (to, from) { /** * Test if a value is an array and it's contents are of a specific type * - * @method isArrayOf + * @method isArrayOfs * @param {Array} arr - An array to check * @return {Boolean} */ 'String Object PlainObject Array Finite Function RegExp'.split(' ').forEach(function (type) { - var check = _.bind(_['is' + type], _) - // used to find the first value that isn't of the sub type specified - , checkForNotType = function (val) { return !check(val); }; + var check = _.bind(_['is' + type], _); utils['isArrayOf' + type + 's'] = function (arr) { // quick shallow check of arrays - return _.isArray(arr) && !_.find(arr.slice(0, 10), checkForNotType); + return _.isArray(arr) && _.every(arr.slice(0, 10), check); }; }); @@ -175,7 +174,7 @@ utils.studlyCase = function (string) { }; /** - * Transfor a string into camelCase + * Transform a string into camelCase * * @todo Tests * @method cameCase @@ -192,6 +191,13 @@ utils.camelCase = function (string) { }).join(''); }; +/** + * Lower-case a string, and return an empty string if any is not a string + * + * @todo Tests + * @param any {*} - Something or nothing + * @returns {string} + */ utils.toLowerString = function (any) { if (any) { if (typeof any !== 'string') { @@ -203,10 +209,28 @@ utils.toLowerString = function (any) { return any.toLowerCase(); }; +/** + * Upper-case the string, return an empty string if any is not a string + * + * @todo Tests + * @param any {*} - Something or nothing + * @returns {string} + */ +utils.toUpperString = function (any) { + if (any) { + if (typeof any !== 'string') { + any = any.toString(); + } + } else { + any = ''; + } + return any.toUpperCase(); +}; + /** * Test if a value is "numeric" meaning that it can be transformed into something besides NaN * - * @todo Test + * @todo Tests * @method isNumeric * @param {*} val * @return {Boolean} @@ -257,13 +281,39 @@ utils.makeQueryString = function (obj, start) { return (start === false || str === '') ? str : '?' + str; }; +/** + * Override node's util.inherits function to also supply a callSuper function on the child class that can be called + * with the instance and the arguments passed to the child's constructor. This should only be called from within the + * constructor of the child class and should be removed from the code once the constructor is "done". + * + * @param constructor {Function} - the constructor that should subClass superConstructor + * @param superConstructor {Function} - The parent constructor + */ utils.inherits = function (constructor, superConstructor) { nodeUtils.inherits(constructor, superConstructor); - constructor.prototype._constructSuper = function (args) { - constructor.super_.apply(this, _.toArray(args)); + constructor.callSuper = function (inst, args) { + if (args) { + if (_.isArguments(args)) { + utils.applyArgs(superConstructor, inst, args); + } else { + utils.applyArgs(superConstructor, inst, arguments, 1); + } + } else { + superConstructor.call(inst); + } }; }; +/** + * Remove leading/trailing spaces from a string + * + * @param str {String} - Any string + * @returns {String} + */ +utils.trim = function (str) { + return typeof str !== 'string' ? str.replace(/^\s+|\s+$/g, '') : ''; +}; + utils.collectMatches = function (text, regExp) { var matches = [], match; while (match = regExp.exec(text)) { @@ -276,4 +326,86 @@ utils.collectMatches = function (text, regExp) { return matches; }; +var startsWithProtocolRE = /^([a-z]+:)?\/\//; + +/** + * Runs a string through node's url.parse, removing the return value's host property and insuring the text has a + * protocol first + * + * @todo Tests + * @param urlString {String} - a url of some sort + * @returns {Object} - an object containing 'hostname', 'port', 'protocol', 'path', and a few other keys + */ +utils.parseUrl = function (urlString) { + if (!startsWithProtocolRE.text(urlString)) { + urlString = 'http://' + urlString; + } + var info = url.parse(urlString); + delete info.host; + return info; +}; + +/** + * Formats a urlinfo object, sort of juggling the 'host' and 'hostname' keys based on the presense of the port and + * including http: as the default protocol. + * + * @todo Tests, + * @todo add checking for ':' at the end of the protocol + * @param urlInfo {Object} - An object, similar to that returned from _.parseUrl + * @returns {String} + */ +utils.formatUrl = function (urlInfo) { + var info = _.clone(urlInfo); + if (info.port && info.host && !info.hostname) { + info.hostname = info.host; + delete info.host; + } + if (!info.protocol) { + info.protocol = 'http:'; + } + return url.format(info); +}; + +/** + * Call a function, applying the arguments object to it in an optimized way, rather than always turning it into an array + * + * @param func {Function} - The function to execute + * @param context {*} - The context the function will be executed with + * @param args {Arguments} - The arguments to send to func + * @param [sliceIndex=0] {Integer} - The index that args should be sliced at, before feeding args to func + * @returns {*} - the return value of func + */ +utils.applyArgs = function (func, context, args, sliceIndex) { + sliceIndex = sliceIndex || 0; + switch (args.length - sliceIndex) { + case 0: + return func.call(context); + case 1: + return func.call(context, args[0 + sliceIndex]); + case 2: + return func.call(context, args[0 + sliceIndex], args[1 + sliceIndex]); + case 3: + return func.call(context, args[0 + sliceIndex], args[1 + sliceIndex], args[2 + sliceIndex]); + case 4: + return func.call(context, args[0 + sliceIndex], args[1 + sliceIndex], args[2 + sliceIndex], args[3 + sliceIndex]); + case 5: + return func.call(context, args[0 + sliceIndex], args[1 + sliceIndex], + args[2 + sliceIndex], args[3 + sliceIndex], args[4 + sliceIndex]); + default: + return func.apply(context, Array.prototype.slice.call(args, sliceIndex)); + } +}; + +/** + * Schedule a function to be called on the next tick, and supply it with these arguments + * when it is called. + * @return {[type]} [description] + */ +utils.nextTick = function (cb) { + // bind the function and schedule it + process.nextTick(utils.bindKey(utils, 'applyArgs', cb, null, arguments, 1)); +}; + +utils.noop = function () {}; + module.exports = utils; diff --git a/test/.jshintrc b/test/.jshintrc index cdc4384e4..424c016e3 100644 --- a/test/.jshintrc +++ b/test/.jshintrc @@ -23,7 +23,8 @@ "validthis": true, "sub": true, "maxlen": 140, - "-W030":true, + "-W030": true, + "-W068": true, "globals": { "describe": true, @@ -32,4 +33,4 @@ "it": true, "beforeEach": true } -} \ No newline at end of file +} diff --git a/test/integration-test.log b/test/integration-test.log index 116e4d4a5..7082fce6e 100644 --- a/test/integration-test.log +++ b/test/integration-test.log @@ -1,7198 +1,2101 @@ -TRACE: 2013-10-03T16:57:01Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:40Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/_bulk?refresh=true" -XPOST -d "{\"index\":{\"_index\":\"test_index\",\"_type\":\"test_type\",\"_id\":\"test_id\"}} +TRACE: 2013-10-16T19:35:40Z + curl "http://127.0.0.1" -XPOST -d "{\"index\":{\"_index\":\"test_index\",\"_type\":\"test_type\",\"_id\":\"test_id\"}} {\"f1\":\"v1\",\"f2\":42} {\"index\":{\"_index\":\"test_index\",\"_type\":\"test_type\",\"_id\":\"test_id2\"}} {\"f1\":\"v2\",\"f2\":47} " <- 200 - { - "took": 717, - "items": [ - { - "index": { - "_index": "test_index", - "_type": "test_type", - "_id": "test_id", - "_version": 1, - "ok": true - } - }, - { - "index": { - "_index": "test_index", - "_type": "test_type", - "_id": "test_id2", - "_version": 1, - "ok": true - } - } - ] - } + {"took":539,"items":[{"index":{"_index":"test_index","_type":"test_type","_id":"test_id","_version":1,"ok":true}},{"index":{"_index":"test_index","_type":"test_type","_id":"test_id2","_version":1,"ok":true}}]} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/test_index/_count" -XGET +TRACE: 2013-10-16T19:35:40Z + curl "http://127.0.0.1" -XGET <- 200 - { - "count": 2, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - } - } + {"count":2,"_shards":{"total":5,"successful":5,"failed":0}} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:40Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/_bulk?refresh=true" -XPOST -d "{\"index\": {\"_index\": \"test_index\", \"_type\": \"test_type\", \"_id\": \"test_id\"}} +TRACE: 2013-10-16T19:35:40Z + curl "http://127.0.0.1" -XPOST -d "{\"index\": {\"_index\": \"test_index\", \"_type\": \"test_type\", \"_id\": \"test_id\"}} {\"f1\": \"v1\", \"f2\": 42} {\"index\": {\"_index\": \"test_index\", \"_type\": \"test_type\", \"_id\": \"test_id2\"}} {\"f1\": \"v2\", \"f2\": 47} " <- 200 - { - "took": 146, - "items": [ - { - "index": { - "_index": "test_index", - "_type": "test_type", - "_id": "test_id", - "_version": 1, - "ok": true - } - }, - { - "index": { - "_index": "test_index", - "_type": "test_type", - "_id": "test_id2", - "_version": 1, - "ok": true - } - } - ] - } + {"took":146,"items":[{"index":{"_index":"test_index","_type":"test_type","_id":"test_id","_version":1,"ok":true}},{"index":{"_index":"test_index","_type":"test_type","_id":"test_id2","_version":1,"ok":true}}]} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/test_index/_count" -XGET +TRACE: 2013-10-16T19:35:40Z + curl "http://127.0.0.1" -XGET <- 200 - { - "count": 2, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - } - } + {"count":2,"_shards":{"total":5,"successful":5,"failed":0}} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:40Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/_bulk?refresh=true" -XPOST -d "{\"index\": {\"_index\": \"test_index\", \"_type\": \"test_type\", \"_id\": \"test_id\"}} +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST -d "{\"index\": {\"_index\": \"test_index\", \"_type\": \"test_type\", \"_id\": \"test_id\"}} {\"f1\": \"v1\", \"f2\": 42} {\"index\": {\"_index\": \"test_index\", \"_type\": \"test_type\", \"_id\": \"test_id2\"}} {\"f1\": \"v2\", \"f2\": 47} " <- 200 - { - "took": 150, - "items": [ - { - "index": { - "_index": "test_index", - "_type": "test_type", - "_id": "test_id", - "_version": 1, - "ok": true - } - }, - { - "index": { - "_index": "test_index", - "_type": "test_type", - "_id": "test_id2", - "_version": 1, - "ok": true - } - } - ] - } + {"took":122,"items":[{"index":{"_index":"test_index","_type":"test_type","_id":"test_id","_version":1,"ok":true}},{"index":{"_index":"test_index","_type":"test_type","_id":"test_id2","_version":1,"ok":true}}]} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/test_index/_count" -XGET +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XGET <- 200 - { - "count": 2, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - } - } + {"count":2,"_shards":{"total":5,"successful":5,"failed":0}} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/_nodes" -XGET +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XGET <- 200 - { - "ok": true, - "cluster_name": "spencera", - "nodes": { - "eShMMMk0Sk6ucyGA0vf6MQ": { - "name": "Anti-Cap", - "transport_address": "inet[/127.0.0.1:9300]", - "hostname": "Spencers-MacBook-Pro.local", - "version": "0.90.5", - "http_address": "inet[/127.0.0.1:9200]" - } - } - } + {"ok":true,"cluster_name":"yaml-test-runner","nodes":{"sWNssRMeTg-dP2MS2xxRGQ":{"name":"Nimrod","transport_address":"inet[/127.0.0.1:9300]","hostname":"Spencers-MacBook-Pro.local","version":"0.90.5","http_address":"inet[/127.0.0.1:9200]"}}} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/_nodes/stats?indices=true&transport=true" -XGET +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "nodes": { - "eShMMMk0Sk6ucyGA0vf6MQ": { - "timestamp": 1380819422887, - "name": "Anti-Cap", - "transport_address": "inet[/127.0.0.1:9300]", - "hostname": "Spencers-MacBook-Pro.local", - "indices": { - "docs": { - "count": 0, - "deleted": 0 - }, - "store": { - "size": "0b", - "size_in_bytes": 0, - "throttle_time": "0s", - "throttle_time_in_millis": 0 - }, - "indexing": { - "index_total": 6, - "index_time": "104ms", - "index_time_in_millis": 104, - "index_current": 0, - "delete_total": 0, - "delete_time": "0s", - "delete_time_in_millis": 0, - "delete_current": 0 - }, - "get": { - "total": 0, - "get_time": "0s", - "time_in_millis": 0, - "exists_total": 0, - "exists_time": "0s", - "exists_time_in_millis": 0, - "missing_total": 0, - "missing_time": "0s", - "missing_time_in_millis": 0, - "current": 0 - }, - "search": { - "open_contexts": 0, - "query_total": 0, - "query_time": "0s", - "query_time_in_millis": 0, - "query_current": 0, - "fetch_total": 0, - "fetch_time": "0s", - "fetch_time_in_millis": 0, - "fetch_current": 0 - }, - "merges": { - "current": 0, - "current_docs": 0, - "current_size": "0b", - "current_size_in_bytes": 0, - "total": 0, - "total_time": "0s", - "total_time_in_millis": 0, - "total_docs": 0, - "total_size": "0b", - "total_size_in_bytes": 0 - }, - "refresh": { - "total": 18, - "total_time": "97ms", - "total_time_in_millis": 97 - }, - "flush": { - "total": 0, - "total_time": "0s", - "total_time_in_millis": 0 - }, - "warmer": { - "current": 0, - "total": 0, - "total_time": "0s", - "total_time_in_millis": 0 - }, - "filter_cache": { - "memory_size": "0b", - "memory_size_in_bytes": 0, - "evictions": 0 - }, - "id_cache": { - "memory_size": "0b", - "memory_size_in_bytes": 0 - }, - "fielddata": { - "memory_size": "0b", - "memory_size_in_bytes": 0, - "evictions": 0 - }, - "completion": { - "size": "0b", - "size_in_bytes": 0 - } - }, - "transport": { - "server_open": 10, - "rx_count": 0, - "rx_size": "0b", - "rx_size_in_bytes": 0, - "tx_count": 0, - "tx_size": "0b", - "tx_size_in_bytes": 0 - } - } - } - } + {"cluster_name":"yaml-test-runner","nodes":{"sWNssRMeTg-dP2MS2xxRGQ":{"timestamp":1381952141089,"name":"Nimrod","transport_address":"inet[/127.0.0.1:9300]","hostname":"Spencers-MacBook-Pro.local","indices":{"docs":{"count":0,"deleted":0},"store":{"size":"0b","size_in_bytes":0,"throttle_time":"0s","throttle_time_in_millis":0},"indexing":{"index_total":6,"index_time":"76ms","index_time_in_millis":76,"index_current":0,"delete_total":0,"delete_time":"0s","delete_time_in_millis":0,"delete_current":0},"get":{"total":0,"get_time":"0s","time_in_millis":0,"exists_total":0,"exists_time":"0s","exists_time_in_millis":0,"missing_total":0,"missing_time":"0s","missing_time_in_millis":0,"current":0},"search":{"open_contexts":0,"query_total":0,"query_time":"0s","query_time_in_millis":0,"query_current":0,"fetch_total":0,"fetch_time":"0s","fetch_time_in_millis":0,"fetch_current":0},"merges":{"current":0,"current_docs":0,"current_size":"0b","current_size_in_bytes":0,"total":0,"total_time":"0s","total_time_in_millis":0,"total_docs":0,"total_size":"0b","total_size_in_bytes":0},"refresh":{"total":18,"total_time":"81ms","total_time_in_millis":81},"flush":{"total":0,"total_time":"0s","total_time_in_millis":0},"warmer":{"current":0,"total":0,"total_time":"0s","total_time_in_millis":0},"filter_cache":{"memory_size":"0b","memory_size_in_bytes":0,"evictions":0},"id_cache":{"memory_size":"0b","memory_size_in_bytes":0},"fielddata":{"memory_size":"0b","memory_size_in_bytes":0,"evictions":0},"completion":{"size":"0b","size_in_bytes":0}},"transport":{"server_open":10,"rx_count":0,"rx_size":"0b","rx_size_in_bytes":0,"tx_count":0,"tx_size":"0b","tx_size_in_bytes":0}}}} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/_cluster/settings" -XPUT -d "{\"transient\":{\"discovery.zen.minimum_master_nodes\":1}}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPUT -d "{\"transient\":{\"discovery.zen.minimum_master_nodes\":1}}" <- 200 - { - "persistent": {}, - "transient": { - "discovery.zen.minimum_master_nodes": "1" - } - } + {"persistent":{},"transient":{"discovery.zen.minimum_master_nodes":"1"}} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/_cluster/settings" -XGET +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XGET <- 200 - { - "persistent": {}, - "transient": { - "discovery.zen.minimum_master_nodes": "1" - } - } + {"persistent":{},"transient":{"discovery.zen.minimum_master_nodes":"1"}} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/_cluster/reroute" -XPOST +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST <- 200 - { - "ok": true, - "state": { - "master_node": "eShMMMk0Sk6ucyGA0vf6MQ", - "blocks": {}, - "nodes": { - "eShMMMk0Sk6ucyGA0vf6MQ": { - "name": "Anti-Cap", - "transport_address": "inet[/127.0.0.1:9300]", - "attributes": {} - } - }, - "routing_table": { - "indices": {} - }, - "routing_nodes": { - "unassigned": [], - "nodes": { - "eShMMMk0Sk6ucyGA0vf6MQ": [] - } - }, - "allocations": [] - } - } + {"ok":true,"state":{"master_node":"sWNssRMeTg-dP2MS2xxRGQ","blocks":{},"nodes":{"sWNssRMeTg-dP2MS2xxRGQ":{"name":"Nimrod","transport_address":"inet[/127.0.0.1:9300]","attributes":{}}},"routing_table":{"indices":{}},"routing_nodes":{"unassigned":[],"nodes":{"sWNssRMeTg-dP2MS2xxRGQ":[]}},"allocations":[]}} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/_cluster/state" -XGET +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "master_node": "eShMMMk0Sk6ucyGA0vf6MQ", - "blocks": {}, - "nodes": { - "eShMMMk0Sk6ucyGA0vf6MQ": { - "name": "Anti-Cap", - "transport_address": "inet[/127.0.0.1:9300]", - "attributes": {} - } - }, - "metadata": { - "templates": { - "test": { - "template": "test-*", - "order": 0, - "settings": { - "index.number_of_replicas": "0", - "index.number_of_shards": "1" - }, - "mappings": {} - } - }, - "indices": {} - }, - "routing_table": { - "indices": {} - }, - "routing_nodes": { - "unassigned": [], - "nodes": { - "eShMMMk0Sk6ucyGA0vf6MQ": [] - } - }, - "allocations": [] - } + {"cluster_name":"yaml-test-runner","master_node":"sWNssRMeTg-dP2MS2xxRGQ","blocks":{},"nodes":{"sWNssRMeTg-dP2MS2xxRGQ":{"name":"Nimrod","transport_address":"inet[/127.0.0.1:9300]","attributes":{}}},"metadata":{"templates":{"test":{"template":"test-*","order":0,"settings":{"index.number_of_replicas":"0","index.number_of_shards":"1"},"mappings":{}}},"indices":{}},"routing_table":{"indices":{}},"routing_nodes":{"unassigned":[],"nodes":{"sWNssRMeTg-dP2MS2xxRGQ":[]}},"allocations":[]} -TRACE: 2013-10-03T16:57:02Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1/_create" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1" -XGET +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true, "_source" : {"foo":"bar"}} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1/_create" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 409 - { - "error": "DocumentAlreadyExistsException[[test_1][2] [test][1]: document already exists]", - "status": 409 - } + {"error":"DocumentAlreadyExistsException[[test_1][2] [test][1]: document already exists]","status":409} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "cJgVOJstTSS1HNkDrcChWg", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"medlG3j7Q725GE-XyZH7eg","_version":1} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/cJgVOJstTSS1HNkDrcChWg" -XGET +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "cJgVOJstTSS1HNkDrcChWg", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"medlG3j7Q725GE-XyZH7eg","_version":1,"exists":true, "_source" : {"foo":"bar"}} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1/_create" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1/_create" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 409 - { - "error": "DocumentAlreadyExistsException[[test_1][2] [test][1]: document already exists]", - "status": 409 - } + {"error":"DocumentAlreadyExistsException[[test_1][2] [test][1]: document already exists]","status":409} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1/_create?version=5&version_type=external" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 5 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":5} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1/_create?version=5&version_type=external" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 409 - { - "error": "VersionConflictEngineException[[test_1][2] [test][1]: version conflict, current [5], provided [5]]", - "status": 409 - } + {"error":"VersionConflictEngineException[[test_1][2] [test][1]: version conflict, current [5], provided [5]]","status":409} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1/_create?version=6&version_type=external" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 409 - { - "error": "DocumentAlreadyExistsException[[test_1][2] [test][1]: document already exists]", - "status": 409 - } + {"error":"DocumentAlreadyExistsException[[test_1][2] [test][1]: document already exists]","status":409} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1/_create?routing=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1?fields=_routing&routing=5" -XGET +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "5" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_routing":"5"}} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1" -XGET +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XGET <- 404 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } + {"_index":"test_1","_type":"test","_id":"1","exists":false} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:41Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1/_create" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 500 - { - "error": "RoutingMissingException[routing is required for [test_1]/[test]/[1]]", - "status": 500 - } + {"error":"RoutingMissingException[routing is required for [test_1]/[test]/[1]]","status":500} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1/_create?parent=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1?fields=_parent%2C_routing&parent=5" -XGET +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "5", - "_parent": "5" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_routing":"5","_parent":"5"}} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/test_1/test/1" -XGET +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XGET <- 404 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } + {"_index":"test_1","_type":"test","_id":"1","exists":false} -TRACE: 2013-10-03T16:57:03Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1/_create?parent=5&routing=4" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1?fields=_parent%2C_routing&parent=5&routing=4" -XGET +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "4", - "_parent": "5" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_routing":"4","_parent":"5"}} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1?parent=5" -XGET +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XGET <- 404 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } + {"_index":"test_1","_type":"test","_id":"1","exists":false} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1?routing=4" -XGET +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true, "_source" : {"foo":"bar"}} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1/_create" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/_search" -XPOST -d "{\"query\":{\"term\":{\"_id\":1}}}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPOST -d "{\"query\":{\"term\":{\"_id\":1}}}" <- 200 - { - "took": 33, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 0, - "max_score": null, - "hits": [] - } - } + {"took":25,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/2/_create?refresh=true" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "2", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"2","_version":1} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/_search" -XPOST -d "{\"query\":{\"term\":{\"_id\":2}}}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPOST -d "{\"query\":{\"term\":{\"_id\":2}}}" <- 200 - { - "took": 19, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 1, - "max_score": 1, - "hits": [ - { - "_index": "test_1", - "_type": "test", - "_id": "2", - "_score": 1, - "_source": { - "foo": "bar" - } - } - ] - } - } + {"took":15,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"test_1","_type":"test","_id":"2","_score":1.0, "_source" : {"foo":"bar"}}]}} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_timestamp\":{\"enabled\":1,\"store\":\"yes\"}}}}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_timestamp\":{\"enabled\":1,\"store\":\"yes\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1/_create" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1?fields=_timestamp" -XGET +TRACE: 2013-10-16T19:35:42Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_timestamp": 1380819424933 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_timestamp":1381952142993}} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1/_create?timestamp=1372011280000" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":3} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1?fields=_timestamp" -XGET +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3, - "exists": true, - "fields": { - "_timestamp": 1372011280000 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":3,"exists":true,"fields":{"_timestamp":1372011280000}} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 4 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":4} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1/_create?timestamp=1372011280000" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 5 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":5} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/test_1/test/1?fields=_timestamp" -XGET +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 5, - "exists": true, - "fields": { - "_timestamp": 1372011280000 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":5,"exists":true,"fields":{"_timestamp":1372011280000}} -TRACE: 2013-10-03T16:57:04Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_ttl\":{\"enabled\":1,\"store\":\"yes\",\"default\":\"10s\"}}}}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_ttl\":{\"enabled\":1,\"store\":\"yes\",\"default\":\"10s\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1/_create" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?fields=_ttl" -XGET +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_ttl": 9993 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_ttl":9994}} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1/_create?ttl=100000" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":3} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?fields=_ttl" -XGET +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3, - "exists": true, - "fields": { - "_ttl": 99996 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":3,"exists":true,"fields":{"_ttl":99996}} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 4 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":4} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1/_create?ttl=20s" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 5 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":5} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?fields=_ttl" -XGET +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 5, - "exists": true, - "fields": { - "_ttl": 19996 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":5,"exists":true,"fields":{"_ttl":19997}} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 6 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":6} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1/_create?timestamp=1372011280000&ttl=20s" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 400 - { - "error": "MapperParsingException[failed to parse [_ttl]]; nested: AlreadyExpiredException[already expired [test_1]/[test]/[1] due to expire at [1372011300000] and was processed at [1380819425294]]; ", - "status": 400 - } + {"error":"MapperParsingException[failed to parse [_ttl]]; nested: AlreadyExpiredException[already expired [test_1]/[test]/[1] due to expire at [1372011300000] and was processed at [1381952143344]]; ","status":400} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?version=2" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 409 - { - "error": "VersionConflictEngineException[[test_1][2] [test][1]: version conflict, current [1], provided [2]]", - "status": 409 - } + {"error":"VersionConflictEngineException[[test_1][2] [test][1]: version conflict, current [1], provided [2]]","status":409} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?version=1" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?version=5&version_type=external" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 5 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":5} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?version=4&version_type=external" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 409 - { - "error": "VersionConflictEngineException[[test_1][2] [test][1]: version conflict, current [5], provided [4]]", - "status": 409 - } + {"error":"VersionConflictEngineException[[test_1][2] [test][1]: version conflict, current [5], provided [4]]","status":409} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?version=6&version_type=external" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 6 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":6} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?routing=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?routing=4" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "ok": true, - "found": false, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"found":false,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?routing=5" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE + <- 200 + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":2} + +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE + <- 200 + {"ok":true,"acknowledged":true} + +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XGET <- 200 { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } - -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/" -XGET - <- 200 - { - "ok": true, - "status": 200, - "name": "Anti-Cap", - "version": { - "number": "0.90.5", - "build_hash": "c8714e8e0620b62638f660f6144831792b9dedee", - "build_timestamp": "2013-09-17T12:50:20Z", - "build_snapshot": false, - "lucene_version": "4.4" + "ok" : true, + "status" : 200, + "name" : "Nimrod", + "version" : { + "number" : "0.90.5", + "build_hash" : "c8714e8e0620b62638f660f6144831792b9dedee", + "build_timestamp" : "2013-09-17T12:50:20Z", + "build_snapshot" : false, + "lucene_version" : "4.4" }, - "tagline": "You Know, for Search" + "tagline" : "You Know, for Search" } -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?parent=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?parent=1" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "ok": true, - "found": false, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"found":false,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/test_1/test/1?parent=5" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:05Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:43Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1?parent=5&routing=4" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1?parent=5&routing=1" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "ok": true, - "found": false, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"found":false,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1?parent=5&routing=4" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1?refresh=true" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/2?refresh=true" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "2", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"2","_version":1} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/_search" -XPOST -d "{\"query\":{\"terms\":{\"_id\":[1,2]}}}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPOST -d "{\"query\":{\"terms\":{\"_id\":[1,2]}}}" <- 200 - { - "took": 7, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 2, - "max_score": 0.35355338, - "hits": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_score": 0.35355338, - "_source": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "2", - "_score": 0.35355338, - "_source": { - "foo": "bar" - } - } - ] - } - } + {"took":6,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2,"max_score":0.35355338,"hits":[{"_index":"test_1","_type":"test","_id":"1","_score":0.35355338, "_source" : {"foo":"bar"}},{"_index":"test_1","_type":"test","_id":"2","_score":0.35355338, "_source" : {"foo":"bar"}}]}} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/_search" -XPOST -d "{\"query\":{\"terms\":{\"_id\":[1,2]}}}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPOST -d "{\"query\":{\"terms\":{\"_id\":[1,2]}}}" <- 200 - { - "took": 2, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 2, - "max_score": 0.35355338, - "hits": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_score": 0.35355338, - "_source": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "2", - "_score": 0.35355338, - "_source": { - "foo": "bar" - } - } - ] - } - } + {"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2,"max_score":0.35355338,"hits":[{"_index":"test_1","_type":"test","_id":"1","_score":0.35355338, "_source" : {"foo":"bar"}},{"_index":"test_1","_type":"test","_id":"2","_score":0.35355338, "_source" : {"foo":"bar"}}]}} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/2?refresh=true" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "found": true, - "_index": "test_1", - "_type": "test", - "_id": "2", - "_version": 2 - } + {"ok":true,"found":true,"_index":"test_1","_type":"test","_id":"2","_version":2} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/_search" -XPOST -d "{\"query\":{\"terms\":{\"_id\":[1,2]}}}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPOST -d "{\"query\":{\"terms\":{\"_id\":[1,2]}}}" <- 200 - { - "took": 1, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 1, - "max_score": 0.35355338, - "hits": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_score": 0.35355338, - "_source": { - "foo": "bar" - } - } - ] - } - } + {"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.35355338,"hits":[{"_index":"test_1","_type":"test","_id":"1","_score":0.35355338, "_source" : {"foo":"bar"}}]}} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "ok": true, - "found": false, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"found":false,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "ok": true, - "found": false, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"found":false,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/2" -XPOST -d "{\"foo\":\"baz\"}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"baz\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "2", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"2","_version":1} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/3" -XPOST -d "{\"foo\":\"foo\"}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"foo\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "3", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"3","_version":1} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/_refresh" -XGET +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XGET <- 200 - { - "ok": true, - "_shards": { - "total": 10, - "successful": 5, - "failed": 0 - } - } + {"ok":true,"_shards":{"total":10,"successful":5,"failed":0}} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/_query" -XDELETE -d "{\"match\":{\"foo\":\"bar\"}}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE -d "{\"match\":{\"foo\":\"bar\"}}" <- 200 - { - "ok": true, - "_indices": { - "test_1": { - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - } - } - } - } + {"ok":true,"_indices":{"test_1":{"_shards":{"total":5,"successful":5,"failed":0}}}} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/_refresh" -XGET +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XGET <- 200 - { - "ok": true, - "_shards": { - "total": 10, - "successful": 5, - "failed": 0 - } - } + {"ok":true,"_shards":{"total":10,"successful":5,"failed":0}} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/_count" -XGET +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XGET <- 200 - { - "count": 2, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - } - } + {"count":2,"_shards":{"total":5,"successful":5,"failed":0}} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1" -XHEAD +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XHEAD <- 404 -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } +ERROR: 2013-10-16T19:35:44Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1/test/1" -XHEAD +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" + <- 201 + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} + +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } +ERROR: 2013-10-16T19:35:44Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:06Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:44Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?parent=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET + <- 200 + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?parent=5" -XHEAD +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1" -XHEAD +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 404 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?routing=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XDELETE + <- 200 + {"ok":true,"acknowledged":true} + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?routing=5" -XHEAD +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1" -XHEAD +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 404 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?parent=5&routing=4" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET + <- 200 + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?parent=5&routing=4" -XHEAD +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?parent=5" -XHEAD +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 404 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?routing=4" -XHEAD +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET + <- 200 + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?realtime=true" -XHEAD +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?realtime=false" -XHEAD +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 404 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1?realtime=false&refresh=true" -XHEAD +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/*" -XDELETE +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/_all/1" -XHEAD +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } +ERROR: 2013-10-16T19:35:45Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\",\"title\":\"howdy\"}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XDELETE + <- 200 + {"ok":true,"acknowledged":true} + +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\",\"title\":\"howdy\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/_refresh" -XGET +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET <- 200 - { - "ok": true, - "_shards": { - "total": 10, - "successful": 5, - "failed": 0 - } - } + {"ok":true,"_shards":{"total":10,"successful":5,"failed":0}} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/1/_explain" -XPOST -d "{\"query\":{\"match_all\":{}}}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPOST -d "{\"query\":{\"match_all\":{}}}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "matched": true, - "explanation": { - "value": 1, - "description": "ConstantScore(cache(_type:test)), product of:", - "details": [ - { - "value": 1, - "description": "boost" - }, - { - "value": 1, - "description": "queryNorm" - } - ] - } - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","matched":true,"explanation":{"value":1.0,"description":"ConstantScore(cache(_type:test)), product of:","details":[{"value":1.0,"description":"boost"},{"value":1.0,"description":"queryNorm"}]}} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:07Z - curl "http://localhost:9200/test_1/test/%E4%B8%AD%E6%96%87" -XPOST -d "{\"foo\":\"Hello: 中文\"}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"Hello: 中文\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "中文", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"中文","_version":1} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/%E4%B8%AD%E6%96%87" -XGET +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "中文", - "_version": 1, - "exists": true, - "_source": { - "foo": "Hello: 中文" - } - } + {"_index":"test_1","_type":"test","_id":"中文","_version":1,"exists":true, "_source" : {"foo":"Hello: 中文"}} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/_all/%E4%B8%AD%E6%96%87" -XGET +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "中文", - "_version": 1, - "exists": true, - "_source": { - "foo": "Hello: 中文" - } - } + {"_index":"test_1","_type":"test","_id":"中文","_version":1,"exists":true, "_source" : {"foo":"Hello: 中文"}} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/_all/1" -XGET +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true, "_source" : {"foo":"bar"}} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\",\"count\":1}" +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\",\"count\":1}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?fields=foo" -XGET +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"foo":"bar"}} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?fields=foo%2Ccount" -XGET +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "count": 1, - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"count":1,"foo":"bar"}} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?fields=foo%2Ccount%2C_source" -XGET +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar", - "count": 1 - }, - "fields": { - "count": 1, - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true, "_source" : {"foo":"bar","count":1},"fields":{"count":1,"foo":"bar"}} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:45Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?parent=%E4%B8%AD%E6%96%87" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?fields=_parent%2C_routing&parent=%E4%B8%AD%E6%96%87" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "中文", - "_parent": "中文" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_routing":"中文","_parent":"中文"}} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 404 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } + {"_index":"test_1","_type":"test","_id":"1","exists":false} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?routing=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?fields=_routing&routing=5" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "5" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_routing":"5"}} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 404 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } + {"_index":"test_1","_type":"test","_id":"1","exists":false} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?parent=5&routing=4" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?fields=_parent%2C_routing&parent=5&routing=4" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "4", - "_parent": "5" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_routing":"4","_parent":"5"}} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?parent=5" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 404 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } + {"_index":"test_1","_type":"test","_id":"1","exists":false} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1/test/1?routing=4" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true, "_source" : {"foo":"bar"}} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:08Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1?realtime=true" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true, "_source" : {"foo":"bar"}} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1?realtime=false" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 404 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } + {"_index":"test_1","_type":"test","_id":"1","exists":false} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1?realtime=false&refresh=true" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true, "_source" : {"foo":"bar"}} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 404 - { - "error": "IndexMissingException[[test_1] missing]", - "status": 404 - } + {"error":"IndexMissingException[[test_1] missing]","status":404} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 404 - { - "error": "IndexMissingException[[test_1] missing]", - "status": 404 - } + {"error":"IndexMissingException[[test_1] missing]","status":404} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "foo": "bar" - } + {"foo":"bar"} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/_all/1/_source" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "foo": "bar" - } + {"foo":"bar"} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/_all/1/_source" -XGET +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XGET <- 200 - { - "foo": "bar" - } + {"foo":"bar"} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:46Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1?parent=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source?parent=5" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "foo": "bar" - } + {"foo":"bar"} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 404 -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } +ERROR: 2013-10-16T19:35:47Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1?routing=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE + <- 200 + {"ok":true,"acknowledged":true} + +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source?routing=5" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "foo": "bar" - } + {"foo":"bar"} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 404 -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } +ERROR: 2013-10-16T19:35:47Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1?parent=5&routing=4" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET + <- 200 + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} + +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source?parent=5&routing=4" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "foo": "bar" - } + {"foo":"bar"} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source?parent=5" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 404 -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source?routing=4" -XGET - <- 200 - { - "foo": "bar" - } +ERROR: 2013-10-16T19:35:47Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "ok": true, - "acknowledged": true - } + {"foo":"bar"} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE + <- 200 + {"ok":true,"acknowledged":true} + +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source?realtime=true" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "foo": "bar" - } + {"foo":"bar"} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source?realtime=false" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 404 -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source?realtime=false&refresh=true" -XGET +ERROR: 2013-10-16T19:35:47Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) + +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "foo": "bar" - } + {"foo":"bar"} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 404 - { - "error": "IndexMissingException[[test_1] missing]", - "status": 404 - } + {"error":"IndexMissingException[[test_1] missing]","status":404} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/1/_source" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 404 - { - "error": "IndexMissingException[[test_1] missing]", - "status": 404 - } + {"error":"IndexMissingException[[test_1] missing]","status":404} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test-weird-index-%E4%B8%AD%E6%96%87/weird.type/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test-weird-index-中文", - "_type": "weird.type", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test-weird-index-中文","_type":"weird.type","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test-weird-index-%E4%B8%AD%E6%96%87/weird.type/1" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test-weird-index-中文", - "_type": "weird.type", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } + {"_index":"test-weird-index-中文","_type":"weird.type","_id":"1","_version":1,"exists":true, "_source" : {"foo":"bar"}} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "IoN2mZ0tRY2PbtbY0bGRqA", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"LCMkK-QgRLulc3OgonIyRw","_version":1} -TRACE: 2013-10-03T16:57:09Z - curl "http://localhost:9200/test_1/test/IoN2mZ0tRY2PbtbY0bGRqA" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "IoN2mZ0tRY2PbtbY0bGRqA", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"LCMkK-QgRLulc3OgonIyRw","_version":1,"exists":true, "_source" : {"foo":"bar"}} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?op_type=create" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?op_type=create" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 409 - { - "error": "DocumentAlreadyExistsException[[test_1][2] [test][1]: document already exists]", - "status": 409 - } + {"error":"DocumentAlreadyExistsException[[test_1][2] [test][1]: document already exists]","status":409} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?op_type=index" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?version=1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 409 - { - "error": "VersionConflictEngineException[[test_1][2] [test][1]: version conflict, current [2], provided [1]]", - "status": 409 - } + {"error":"VersionConflictEngineException[[test_1][2] [test][1]: version conflict, current [2], provided [1]]","status":409} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?version=2" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":3} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?version=5&version_type=external" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 5 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":5} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?version=5&version_type=external" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 409 - { - "error": "VersionConflictEngineException[[test_1][2] [test][1]: version conflict, current [5], provided [5]]", - "status": 409 - } + {"error":"VersionConflictEngineException[[test_1][2] [test][1]: version conflict, current [5], provided [5]]","status":409} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?version=6&version_type=external" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 6 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":6} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?routing=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?fields=_routing&routing=5" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "5" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_routing":"5"}} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1" -XGET +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XGET <- 404 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } + {"_index":"test_1","_type":"test","_id":"1","exists":false} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:47Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 500 - { - "error": "RoutingMissingException[routing is required for [test_1]/[test]/[1]]", - "status": 500 - } + {"error":"RoutingMissingException[routing is required for [test_1]/[test]/[1]]","status":500} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?parent=5" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?fields=_parent%2C_routing&parent=5" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "5", - "_parent": "5" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_routing":"5","_parent":"5"}} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 404 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } + {"_index":"test_1","_type":"test","_id":"1","exists":false} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?parent=5&routing=4" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?fields=_parent%2C_routing&parent=5&routing=4" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "4", - "_parent": "5" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_routing":"4","_parent":"5"}} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?parent=5" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 404 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } + {"_index":"test_1","_type":"test","_id":"1","exists":false} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1/test/1?routing=4" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true, "_source" : {"foo":"bar"}} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:10Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/_search" -XPOST -d "{\"query\":{\"term\":{\"_id\":1}}}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPOST -d "{\"query\":{\"term\":{\"_id\":1}}}" <- 200 - { - "took": 1, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 0, - "max_score": null, - "hits": [] - } - } + {"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/2?refresh=true" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "2", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"2","_version":1} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/_search" -XPOST -d "{\"query\":{\"term\":{\"_id\":2}}}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPOST -d "{\"query\":{\"term\":{\"_id\":2}}}" <- 200 - { - "took": 1, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 1, - "max_score": 1, - "hits": [ - { - "_index": "test_1", - "_type": "test", - "_id": "2", - "_score": 1, - "_source": { - "foo": "bar" - } - } - ] - } - } + {"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"test_1","_type":"test","_id":"2","_score":1.0, "_source" : {"foo":"bar"}}]}} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_timestamp\":{\"enabled\":1,\"store\":\"yes\"}}}}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_timestamp\":{\"enabled\":1,\"store\":\"yes\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?fields=_timestamp" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_timestamp": 1380819431333 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_timestamp":1381952148953}} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?timestamp=1372011280000" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?fields=_timestamp" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "exists": true, - "fields": { - "_timestamp": 1372011280000 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":2,"exists":true,"fields":{"_timestamp":1372011280000}} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?timestamp=1372011280000" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":3} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?fields=_timestamp" -XGET +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3, - "exists": true, - "fields": { - "_timestamp": 1372011280000 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":3,"exists":true,"fields":{"_timestamp":1372011280000}} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:48Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_ttl\":{\"enabled\":1,\"store\":\"yes\",\"default\":\"10s\"}}}}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"_ttl\":{\"enabled\":1,\"store\":\"yes\",\"default\":\"10s\"}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":1} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?fields=_ttl" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_ttl": 9995 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":1,"exists":true,"fields":{"_ttl":9996}} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?ttl=100000" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":2} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?fields=_ttl" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "exists": true, - "fields": { - "_ttl": 99996 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":2,"exists":true,"fields":{"_ttl":99997}} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?ttl=20s" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3 - } + {"ok":true,"_index":"test_1","_type":"test","_id":"1","_version":3} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?fields=_ttl" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3, - "exists": true, - "fields": { - "_ttl": 19996 - } - } + {"_index":"test_1","_type":"test","_id":"1","_version":3,"exists":true,"fields":{"_ttl":19997}} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test_1/test/1?timestamp=1372011280000&ttl=20s" -XPOST -d "{\"foo\":\"bar\"}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPOST -d "{\"foo\":\"bar\"}" <- 400 - { - "error": "MapperParsingException[failed to parse [_ttl]]; nested: AlreadyExpiredException[already expired [test_1]/[test]/[1] due to expire at [1372011300000] and was processed at [1380819431633]]; ", - "status": 400 - } + {"error":"MapperParsingException[failed to parse [_ttl]]; nested: AlreadyExpiredException[already expired [test_1]/[test]/[1] due to expire at [1372011300000] and was processed at [1381952149250]]; ","status":400} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/" -XHEAD +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/_analyze?text=Foo%20Bar" -XGET - <- 200 - { - "tokens": [ - { - "token": "foo", - "start_offset": 0, - "end_offset": 3, - "type": "", - "position": 1 - }, - { - "token": "bar", - "start_offset": 4, - "end_offset": 7, - "type": "", - "position": 2 - } - ] - } +ERROR: 2013-10-16T19:35:49Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/_analyze?filters=lowercase&text=Foo%20Bar&tokenizer=keyword" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "tokens": [ - { - "token": "foo bar", - "start_offset": 0, - "end_offset": 7, - "type": "word", - "position": 1 - } - ] - } + {"tokens":[{"token":"foo","start_offset":0,"end_offset":3,"type":"","position":1},{"token":"bar","start_offset":4,"end_offset":7,"type":"","position":2}]} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test" -XPUT -d "{\"mappings\":{\"test\":{\"properties\":{\"text\":{\"type\":\"string\",\"analyzer\":\"whitespace\"}}}}}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "ok": true, - "acknowledged": true - } + {"tokens":[{"token":"foo bar","start_offset":0,"end_offset":7,"type":"word","position":1}]} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test\":{\"properties\":{\"text\":{\"type\":\"string\",\"analyzer\":\"whitespace\"}}}}}" <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/test/_analyze?field=text&text=Foo%20Bar!" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "tokens": [ - { - "token": "Foo", - "start_offset": 0, - "end_offset": 3, - "type": "word", - "position": 1 - }, - { - "token": "Bar!", - "start_offset": 4, - "end_offset": 8, - "type": "word", - "position": 2 - } - ] - } + {"cluster_name":"yaml-test-runner","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":5,"active_shards":5,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":5} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "ok": true, - "acknowledged": true - } + {"tokens":[{"token":"Foo","start_offset":0,"end_offset":3,"type":"word","position":1},{"token":"Bar!","start_offset":4,"end_offset":8,"type":"word","position":2}]} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE + <- 200 + {"ok":true,"acknowledged":true} + +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/_analyze?text=tHE%20BLACK%20and%20white!%20AND%20red&format=text" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "tokens": "[black:4->9:]\n\n4: \n[white:14->19:]\n\n6: \n[red:25->28:]\n" - } + {"tokens":"[black:4->9:]\n\n4: \n[white:14->19:]\n\n6: \n[red:25->28:]\n"} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/_cache/clear" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "ok": true, - "_shards": { - "total": 0, - "successful": 0, - "failed": 0 - } - } + {"ok":true,"_shards":{"total":0,"successful":0,"failed":0}} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/testind" -XPUT +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPUT <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:11Z - curl "http://localhost:9200/testind/_alias/testali" -XPUT -d "{\"routing\":\"routing value\"}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPUT -d "{\"routing\":\"routing value\"}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_alias/testali" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "testind": { - "aliases": { - "testali": { - "index_routing": "routing value", - "search_routing": "routing value" - } - } - } - } + {"testind":{"aliases":{"testali":{"index_routing":"routing value","search_routing":"routing value"}}}} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/testind/_alias/testali" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/testind/_alias/testali" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 404 - { - "error": "alias [testali] missing", - "status": 404 - } + {"error":"alias [testali] missing","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index" -XPUT -d "{\"mappings\":{\"test_type\":{\"properties\":{\"text\":{\"type\":\"string\",\"analyzer\":\"whitespace\"}}}}}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test_type\":{\"properties\":{\"text\":{\"type\":\"string\",\"analyzer\":\"whitespace\"}}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/test_type" -XHEAD +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/test_type" -XDELETE - <- 200 - { - "ok": true - } +ERROR: 2013-10-16T19:35:49Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/test_type" -XHEAD +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE + <- 200 + {"ok":true} + +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XHEAD <- 404 -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } +ERROR: 2013-10-16T19:35:49Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index" -XHEAD +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE + <- 200 + {"ok":true,"acknowledged":true} + +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XHEAD <- 404 -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } +ERROR: 2013-10-16T19:35:49Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index" -XHEAD +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPUT + <- 200 + {"ok":true,"acknowledged":true} + +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XHEAD <- 200 -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } +ERROR: 2013-10-16T19:35:49Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index" -XPUT -d "{\"mappings\":{\"test_type\":{\"properties\":{\"text\":{\"type\":\"string\",\"analyzer\":\"whitespace\"}}}}}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/_mapping" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test_type\":{\"properties\":{\"text\":{\"type\":\"string\",\"analyzer\":\"whitespace\"}}}}}" <- 200 - { - "test_index": { - "test_type": { - "properties": { - "text": { - "type": "string", - "analyzer": "whitespace" - } - } - } - } - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/test_type/_mapping" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "test_type": { - "properties": { - "text": { - "type": "string", - "analyzer": "whitespace" - } - } - } - } + {"test_index":{"test_type":{"properties":{"text":{"type":"string","analyzer":"whitespace"}}}}} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "ok": true, - "acknowledged": true - } + {"test_type":{"properties":{"text":{"type":"string","analyzer":"whitespace"}}}} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE + <- 200 + {"ok":true,"acknowledged":true} + +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index" -XPUT -d "{\"mappings\":{\"test_type\":{\"properties\":{\"text\":{\"type\":\"string\",\"analyzer\":\"whitespace\"}}}}}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPUT -d "{\"mappings\":{\"test_type\":{\"properties\":{\"text\":{\"type\":\"string\",\"analyzer\":\"whitespace\"}}}}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/not_test_type/_mapping" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 404 - { - "error": "TypeMissingException[[test_index] type[not_test_type] missing]", - "status": 404 - } + {"error":"TypeMissingException[[test_index] type[not_test_type] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/not_test_type/_mapping" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 404 - { - "error": "IndexMissingException[[test_index] missing]", - "status": 404 - } + {"error":"IndexMissingException[[test_index] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_template/test" -XPUT -d "{\"template\":\"test-*\",\"settings\":{\"number_of_shards\":1,\"number_of_replicas\":0}}" +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPUT -d "{\"template\":\"test-*\",\"settings\":{\"number_of_shards\":1,\"number_of_replicas\":0}}" <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_template/test" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 200 - { - "test": { - "order": 0, - "template": "test-*", - "settings": { - "index.number_of_replicas": "0", - "index.number_of_shards": "1" - }, - "mappings": {} - } - } + {"test":{"order":0,"template":"test-*","settings":{"index.number_of_replicas":"0","index.number_of_shards":"1"},"mappings":{}}} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_template/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_template/test" -XGET +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XGET <- 404 -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +ERROR: 2013-10-16T19:35:49Z + Error: unable to parse + at Json.unserialize (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/serializers/json.js:29:29) + at checkRespForFailure (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/transport.js:75:41) + at IncomingMessage.requestComplete (/Users/spenceralger/dev/es/elasticsearch-js/src/lib/connections/http.js:87:9) + at IncomingMessage.EventEmitter.emit (events.js:125:20) + at _stream_readable.js:896:16 + at process._tickCallback (node.js:317:11) + +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index" -XPUT +TRACE: 2013-10-16T19:35:49Z + curl "http://127.0.0.1" -XPUT <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:50Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/_close" -XPOST +TRACE: 2013-10-16T19:35:50Z + curl "http://127.0.0.1" -XPOST <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/_search" -XGET +TRACE: 2013-10-16T19:35:50Z + curl "http://127.0.0.1" -XGET <- 403 - { - "error": "ClusterBlockException[blocked by: [FORBIDDEN/4/index closed];]", - "status": 403 - } + {"error":"ClusterBlockException[blocked by: [FORBIDDEN/4/index closed];]","status":403} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/_open" -XPOST +TRACE: 2013-10-16T19:35:50Z + curl "http://127.0.0.1" -XGET <- 200 - { - "ok": true, - "acknowledged": true - } + {"cluster_name":"yaml-test-runner","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:50Z + curl "http://127.0.0.1" -XGET <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"cluster_name":"yaml-test-runner","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"active_primary_shards":0,"active_shards":0,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/_search" -XGET - <- 200 - { - "took": 1, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 0, - "max_score": null, - "hits": [] - } - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/testing" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/testing/_optimize?max_num_segments=1" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 10, - "successful": 3, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_alias/test_alias" -XHEAD +TRACE: 2013-10-16T19:35:50Z + curl "http://127.0.0.1" -XGET <- 404 - + {"error":"IndexMissingException[[test_index] missing]","status":404} -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/_alias/test_alias" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_alias/test_alias" -XHEAD - <- 200 - - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_alias/test_alias" -XGET - <- 200 - { - "test_index": { - "aliases": { - "test_alias": {} - } - } - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/test_type/_mapping" -XPUT -d "{\"test_type\":{\"properties\":{\"text\":{\"type\":\"string\",\"analyzer\":\"whitespace\"}}}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/_mapping" -XGET - <- 200 - { - "test_index": { - "test_type": { - "properties": { - "text": { - "type": "string", - "analyzer": "whitespace" - } - } - } - } - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/test_type/_mapping" -XPUT -d "{\"test_type\":{\"properties\":{\"text\":{\"type\":\"multi_field\",\"fields\":{\"text\":{\"type\":\"string\",\"analyzer\":\"whitespace\"},\"text_raw\":{\"type\":\"string\",\"index\":\"not_analyzed\"}}}}}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test_index/_mapping" -XGET - <- 200 - { - "test_index": { - "test_type": { - "properties": { - "text": { - "type": "multi_field", - "fields": { - "text": { - "type": "string", - "analyzer": "whitespace" - }, - "text_raw": { - "type": "string", - "index": "not_analyzed", - "omit_norms": true, - "index_options": "docs", - "include_in_all": false - } - } - } - } - } - } - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test-index" -XPUT -d "{\"settings\":{\"index\":{\"number_of_replicas\":0}}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/test-index/_settings" -XGET - <- 200 - { - "test-index": { - "settings": { - "index.number_of_replicas": "0", - "index.number_of_shards": "5", - "index.version.created": "900599" - } - } - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_settings" -XPUT -d "{\"number_of_replicas\":1}" - <- 200 - { - "ok": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_settings" -XGET - <- 200 - { - "test-index": { - "settings": { - "index.number_of_replicas": "1", - "index.number_of_shards": "5", - "index.version.created": "900599" - } - } - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_template/test" -XPUT -d "{\"template\":\"test-*\",\"settings\":{\"number_of_shards\":1,\"number_of_replicas\":0}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/_template/test" -XGET - <- 200 - { - "test": { - "order": 0, - "template": "test-*", - "settings": { - "index.number_of_replicas": "0", - "index.number_of_shards": "1" - }, - "mappings": {} - } - } - -TRACE: 2013-10-03T16:57:12Z - curl "http://localhost:9200/*" -XDELETE +TRACE: 2013-10-16T19:35:50Z + curl "http://127.0.0.1" -XDELETE <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"error":"IndexMissingException[[*] missing]","status":404} -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_index" -XPUT +TRACE: 2013-10-16T19:35:50Z + curl "http://127.0.0.1" -XDELETE <- 200 - { - "ok": true, - "acknowledged": true - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET +TRACE: 2013-10-16T19:35:50Z + curl "http://127.0.0.1" -XPUT <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } + {"ok":true,"acknowledged":true} -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_index/_warmer/test_warmer" -XGET - <- 404 - { - "error": "IndexWarmerMissingException[index_warmer [test_warmer] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_index/_warmer/test_warmer" -XPUT -d "{\"query\":{\"match_all\":{}}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_index/_warmer/test_warmer" -XGET - <- 200 - { - "test_index": { - "warmers": { - "test_warmer": { - "types": [], - "source": { - "query": { - "match_all": {} - } - } - } - } - } - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_index/_warmer" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_index/_warmer/test_warmer" -XGET - <- 404 - { - "error": "IndexWarmerMissingException[index_warmer [test_warmer] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_segments" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 0, - "successful": 0, - "failed": 0 - }, - "indices": {} - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_gateway/snapshot" -XPOST - <- 200 - { - "ok": true, - "_shards": { - "total": 0, - "successful": 0, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_stats" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 0, - "successful": 0, - "failed": 0 - }, - "_all": { - "primaries": {}, - "total": {} - }, - "indices": {} - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_status" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 0, - "successful": 0, - "failed": 0 - }, - "indices": {} - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/not_here/_status" -XGET - <- 404 - { - "error": "IndexMissingException[[not_here] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_index" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_alias/test_alias" -XHEAD - <- 404 - - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_aliases" -XPOST -d "{\"actions\":[{\"add\":{\"index\":\"test_index\",\"alias\":\"test_alias\",\"routing\":\"routing_value\"}}]}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_alias/test_alias" -XHEAD - <- 200 - - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_index/_aliases" -XGET - <- 200 - { - "test_index": { - "aliases": { - "test_alias": { - "index_routing": "routing_value", - "search_routing": "routing_value" - } - } - } - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/testing" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_validate/query?q=query%20string" -XGET - <- 200 - { - "valid": true, - "_shards": { - "total": 1, - "successful": 1, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_validate/query" -XPOST -d "{\"query\":{\"invalid_query\":{}}}" - <- 200 - { - "valid": false, - "_shards": { - "total": 1, - "successful": 1, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/" -XGET - <- 200 - { - "ok": true, - "status": 200, - "name": "Anti-Cap", - "version": { - "number": "0.90.5", - "build_hash": "c8714e8e0620b62638f660f6144831792b9dedee", - "build_timestamp": "2013-09-17T12:50:20Z", - "build_snapshot": false, - "lucene_version": "4.4" - }, - "tagline": "You Know, for Search" - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/" -XGET - <- 200 - { - "ok": true, - "status": 200, - "name": "Anti-Cap", - "version": { - "number": "0.90.5", - "build_hash": "c8714e8e0620b62638f660f6144831792b9dedee", - "build_timestamp": "2013-09-17T12:50:20Z", - "build_snapshot": false, - "lucene_version": "4.4" - }, - "tagline": "You Know, for Search" - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_2" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_flush?refresh=true" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 20, - "successful": 10, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_mget" -XPOST -d "{\"docs\":[{\"_index\":\"test_2\",\"_type\":\"test\",\"_id\":1},{\"_index\":\"test_1\",\"_type\":\"none\",\"_id\":1},{\"_index\":\"test_1\",\"_type\":\"test\",\"_id\":2},{\"_index\":\"test_1\",\"_type\":\"test\",\"_id\":1}]}" - <- 200 - { - "docs": [ - { - "_index": "test_2", - "_type": "test", - "_id": "1", - "exists": false - }, - { - "_index": "test_1", - "_type": "none", - "_id": "1", - "exists": false - }, - { - "_index": "test_1", - "_type": "test", - "_id": "2", - "exists": false - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } - ] - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_2" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 10, - "active_shards": 10, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 10 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_1/test/_mget" -XPOST -d "{\"docs\":[{\"_index\":\"test_2\",\"_id\":1},{\"_type\":\"none\",\"_id\":1},{\"_id\":2},{\"_id\":1}]}" - <- 200 - { - "docs": [ - { - "_index": "test_2", - "_type": "test", - "_id": "1", - "exists": false - }, - { - "_index": "test_1", - "_type": "none", - "_id": "1", - "exists": false - }, - { - "_index": "test_1", - "_type": "test", - "_id": "2", - "exists": false - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } - ] - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_mget" -XPOST -d "{\"docs\":[{\"_index\":\"test_2\",\"_type\":\"test\",\"_id\":1}]}" - <- 200 - { - "docs": [ - { - "_index": "test_2", - "_type": "test", - "_id": "1", - "error": "[test_2] missing" - } - ] - } - -TRACE: 2013-10-03T16:57:13Z - curl "http://localhost:9200/_mget" -XPOST -d "{\"index\":\"test_2\",\"docs\":[{\"_index\":\"test_1\",\"_type\":\"test\",\"_id\":1}]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } - ] - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/_mget" -XPOST -d "{\"docs\":[{\"_index\":\"test_1\",\"_type\":\"test\"}]}" - <- 500 - { - "error": "ActionRequestValidationException[Validation Failed: 1: id is missing for doc 0;]", - "status": 500 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/_mget" -XPOST -d "{\"docs\":[{\"_type\":\"test\",\"_id\":1}]}" - <- 500 - { - "error": "ActionRequestValidationException[Validation Failed: 1: index is missing for doc 0;]", - "status": 500 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/_mget" -XPOST -d "{\"docs\":[]}" - <- 500 - { - "error": "ActionRequestValidationException[Validation Failed: 1: no documents to get;]", - "status": 500 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/_mget" -XPOST -d "{}" - <- 500 - { - "error": "ActionRequestValidationException[Validation Failed: 1: no documents to get;]", - "status": 500 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/_mget" -XPOST -d "{\"docs\":[{\"_index\":\"test_1\",\"_id\":1}]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } - ] - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test_2/2" -XPOST -d "{\"foo\":\"baz\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test_2", - "_id": "2", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/_mget" -XPOST -d "{\"ids\":[1,2]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "2", - "exists": false - } - ] - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/_mget" -XPOST -d "{\"ids\":[1,2]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test_2", - "_id": "2", - "_version": 1, - "exists": true, - "_source": { - "foo": "baz" - } - } - ] - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/_mget" -XPOST -d "{\"ids\":[]}" - <- 500 - { - "error": "ActionRequestValidationException[Validation Failed: 1: no documents to get;]", - "status": 500 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/_mget" -XPOST -d "{}" - <- 500 - { - "error": "ActionRequestValidationException[Validation Failed: 1: no documents to get;]", - "status": 500 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/_mget" -XPOST -d "{\"docs\":[{\"_id\":1},{\"_id\":1,\"fields\":\"foo\"},{\"_id\":1,\"fields\":[\"foo\"]},{\"_id\":1,\"fields\":[\"foo\",\"_source\"]}]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - }, - "fields": { - "foo": "bar" - } - } - ] - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/_mget?fields=foo" -XPOST -d "{\"docs\":[{\"_id\":1},{\"_id\":1,\"fields\":\"foo\"},{\"_id\":1,\"fields\":[\"foo\"]},{\"_id\":1,\"fields\":[\"foo\",\"_source\"]}]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - }, - "fields": { - "foo": "bar" - } - } - ] - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/_mget?fields=foo" -XPOST -d "{\"docs\":[{\"_id\":1},{\"_id\":1,\"fields\":\"foo\"},{\"_id\":1,\"fields\":[\"foo\"]},{\"_id\":1,\"fields\":[\"foo\",\"_source\"]}]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - }, - "fields": { - "foo": "bar" - } - } - ] - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/_mget?fields=foo%2C_source" -XPOST -d "{\"docs\":[{\"_id\":1},{\"_id\":1,\"fields\":\"foo\"},{\"_id\":1,\"fields\":[\"foo\"]},{\"_id\":1,\"fields\":[\"foo\",\"_source\"]}]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - }, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - }, - "fields": { - "foo": "bar" - } - } - ] - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/1?parent=4" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/2?parent=5" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "2", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/_mget" -XPOST -d "{\"docs\":[{\"_id\":1},{\"_id\":1,\"parent\":5,\"fields\":[\"_parent\",\"_routing\"]},{\"_id\":1,\"parent\":4,\"fields\":[\"_parent\",\"_routing\"]},{\"_id\":2,\"parent\":5,\"fields\":[\"_parent\",\"_routing\"]}]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "4", - "_parent": "4" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "2", - "_version": 1, - "exists": true, - "fields": { - "_routing": "5", - "_parent": "5" - } - } - ] - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/1?routing=5" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1/test/_mget?fields=_routing" -XPOST -d "{\"docs\":[{\"_id\":1},{\"_id\":1,\"routing\":4},{\"_id\":1,\"routing\":5}]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "5" - } - } - ] - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:14Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/1?parent=4&routing=5" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/_mget?fields=_routing%2C_parent" -XPOST -d "{\"docs\":[{\"_id\":1},{\"_id\":1,\"parent\":4},{\"_id\":1,\"parent\":4,\"routing\":5}]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - }, - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_parent": "4", - "_routing": "5" - } - } - ] - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/_mget?realtime=false" -XPOST -d "{\"ids\":[1]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "exists": false - } - ] - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/_mget?realtime=true" -XPOST -d "{\"ids\":[1]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } - ] - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/_mget?realtime=false&refresh=true" -XPOST -d "{\"ids\":[1]}" - <- 200 - { - "docs": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar" - } - } - ] - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\",\"title\":\"howdy\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_refresh" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 10, - "successful": 5, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/1/_mlt?mlt_fields=title" -XGET - <- 200 - { - "took": 5, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 0, - "max_score": null, - "hits": [] - } - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/2" -XPOST -d "{\"foo\":\"baz\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "2", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/3" -XPOST -d "{\"foo\":\"foo\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "3", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_refresh" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 10, - "successful": 5, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_msearch" -XPOST -d "{\"index\":\"test_1\"} - {\"query\":{\"match_all\":{}}} - {\"index\":\"test_2\"} - {\"query\":{\"match_all\":{}}} - {\"search_type\":\"count\",\"index\":\"test_1\"} - {\"query\":{\"match\":{\"foo\":\"bar\"}}} - " - <- 200 - { - "responses": [ - { - "took": 1, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 3, - "max_score": 1, - "hits": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_score": 1, - "_source": { - "foo": "bar" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "3", - "_score": 1, - "_source": { - "foo": "foo" - } - }, - { - "_index": "test_1", - "_type": "test", - "_id": "2", - "_score": 1, - "_source": { - "foo": "baz" - } - } - ] - } - }, - { - "error": "IndexMissingException[[test_2] missing]" - }, - { - "took": 1, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 1, - "max_score": 0, - "hits": [] - } - } - ] - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_index" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_percolator/test_index/test_percolator" -XPOST -d "{\"query\":{\"match_all\":{}}}" - <- 201 - { - "ok": true, - "_index": "_percolator", - "_type": "test_index", - "_id": "test_percolator", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_refresh" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 11, - "successful": 6, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_index/test_type/_percolate" -XPOST -d "{\"doc\":{\"foo\":\"bar\"}}" - <- 200 - { - "ok": true, - "matches": [ - "test_percolator" - ] - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/" -XHEAD - <- 200 - - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_scroll" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_scroll/test/42" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_scroll", - "_type": "test", - "_id": "42", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_refresh" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 10, - "successful": 5, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_scroll/_search?scroll=1m&search_type=scan" -XPOST -d "{\"query\":{\"match_all\":{}}}" - <- 200 - { - "_scroll_id": "c2Nhbjs1OzY1OmVTaE1NTWswU2s2dWN5R0EwdmY2TVE7NjQ6ZVNoTU1NazBTazZ1Y3lHQTB2ZjZNUTs2MjplU2hNTU1rMFNrNnVjeUdBMHZmNk1ROzYzOmVTaE1NTWswU2s2dWN5R0EwdmY2TVE7NjE6ZVNoTU1NazBTazZ1Y3lHQTB2ZjZNUTsxO3RvdGFsX2hpdHM6MTs=", - "took": 1, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 1, - "max_score": 0, - "hits": [] - } - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_search/scroll/c2Nhbjs1OzY1OmVTaE1NTWswU2s2dWN5R0EwdmY2TVE7NjQ6ZVNoTU1NazBTazZ1Y3lHQTB2ZjZNUTs2MjplU2hNTU1rMFNrNnVjeUdBMHZmNk1ROzYzOmVTaE1NTWswU2s2dWN5R0EwdmY2TVE7NjE6ZVNoTU1NazBTazZ1Y3lHQTB2ZjZNUTsxO3RvdGFsX2hpdHM6MTs%3D" -XGET - <- 200 - { - "took": 3, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 1, - "max_score": 0, - "hits": [ - { - "_index": "test_scroll", - "_type": "test", - "_id": "42", - "_score": 0, - "_source": { - "foo": "bar" - } - } - ] - } - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_2" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1" -XPUT - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_2/test/42" -XPOST -d "{\"foo\":\"bar\"}" - <- 201 - { - "ok": true, - "_index": "test_2", - "_type": "test", - "_id": "42", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test_1%2Ctest_2/_refresh" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 20, - "successful": 10, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_all/test/_search" -XPOST -d "{\"query\":{\"match\":{\"foo\":\"bar\"}}}" - <- 200 - { - "took": 1, - "timed_out": false, - "_shards": { - "total": 10, - "successful": 10, - "failed": 0 - }, - "hits": { - "total": 2, - "max_score": 0.30685282, - "hits": [ - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_score": 0.30685282, - "_source": { - "foo": "bar" - } - }, - { - "_index": "test_2", - "_type": "test", - "_id": "42", - "_score": 0.30685282, - "_source": { - "foo": "bar" - } - } - ] - } - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/test/test/testing_document" -XPOST -d "{\"body\":\"Amsterdam meetup\"}" - <- 201 - { - "ok": true, - "_index": "test", - "_type": "test", - "_id": "testing_document", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_refresh" -XGET - <- 200 - { - "ok": true, - "_shards": { - "total": 10, - "successful": 5, - "failed": 0 - } - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/_suggest" -XPOST -d "{\"test_suggestion\":{\"text\":\"The Amsterdma meetpu\",\"term\":{\"field\":\"body\"}}}" - <- 200 - { - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "test_suggestion": [ - { - "text": "amsterdma", - "offset": 4, - "length": 9, - "options": [ - { - "text": "amsterdam", - "score": 0.8888889, - "freq": 1 - } - ] - }, - { - "text": "meetpu", - "offset": 14, - "length": 6, - "options": [ - { - "text": "meetup", - "score": 0.8333333, - "freq": 1 - } - ] - } - ] - } - -TRACE: 2013-10-03T16:57:15Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\",\"count\":1,\"nested\":{\"one\":1,\"two\":2}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"baz\",\"nested\":{\"one\":3}}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "exists": true, - "_source": { - "foo": "baz", - "count": 1, - "nested": { - "one": 3, - "two": 2 - } - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XPOST -d "{\"foo\":\"bar\",\"count\":1}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update?script=1" -XPOST -d "{\"lang\":\"mvel\",\"script\":\"ctx._source.foo = bar\",\"params\":{\"bar\":\"xxx\"}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "exists": true, - "_source": { - "foo": "xxx", - "count": 1 - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update?lang=mvel&script=ctx._source.foo%20%3D%20%27yyy%27" -XPOST - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3, - "exists": true, - "_source": { - "foo": "yyy", - "count": 1 - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"script\":\"1\",\"lang\":\"doesnotexist\",\"params\":{\"bar\":\"xxx\"}}" - <- 400 - { - "error": "ElasticSearchIllegalArgumentException[failed to execute script]; nested: ElasticSearchIllegalArgumentException[script_lang not supported [doesnotexist]]; ", - "status": 400 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update?lang=doesnotexist&script=1" -XPOST - <- 400 - { - "error": "ElasticSearchIllegalArgumentException[failed to execute script]; nested: ElasticSearchIllegalArgumentException[script_lang not supported [doesnotexist]]; ", - "status": 400 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"bar\",\"count\":1},\"upsert\":{\"foo\":\"baz\"}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "baz" - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"bar\",\"count\":1},\"upsert\":{\"foo\":\"baz\"}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "exists": true, - "_source": { - "foo": "bar", - "count": 1 - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"bar\",\"count\":1},\"doc_as_upsert\":1}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "bar", - "count": 1 - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"count\":2},\"doc_as_upsert\":1}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "exists": true, - "_source": { - "foo": "bar", - "count": 2 - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"script\":\"ctx._source.foo = bar\",\"params\":{\"bar\":\"xxx\"},\"upsert\":{\"foo\":\"baz\"}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "_source": { - "foo": "baz" - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"script\":\"ctx._source.foo = bar\",\"params\":{\"bar\":\"xxx\"},\"upsert\":{\"foo\":\"baz\"}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "exists": true, - "_source": { - "foo": "xxx" - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update?routing=5" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1?fields=_routing&routing=5" -XGET +TRACE: 2013-10-16T19:35:50Z + curl "http://127.0.0.1" -XGET <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "5" - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"baz\"}}" - <- 404 - { - "error": "DocumentMissingException[[test_1][2] [test][1]: document missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update?fields=foo&routing=5" -XPOST -d "{\"doc\":{\"foo\":\"baz\"}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "get": { - "exists": true, - "fields": { - "foo": "baz" - } - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 500 - { - "error": "RoutingMissingException[routing is required for [test_1]/[test]/[1]]", - "status": 500 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update?parent=5" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1?fields=_parent%2C_routing&parent=5" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "5", - "_parent": "5" - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"baz\"}}" - <- 404 - { - "error": "DocumentMissingException[[test_1][2] [test][1]: document missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1/test/1/_update?fields=foo&parent=5" -XPOST -d "{\"doc\":{\"foo\":\"baz\"}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "get": { - "exists": true, - "fields": { - "foo": "baz" - } - } - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:16Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_parent\":{\"type\":\"foo\"}}}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update?parent=5&routing=4" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1?fields=_parent%2C_routing&parent=5&routing=4" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_routing": "4", - "_parent": "5" - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update?parent=5" -XPOST -d "{\"doc\":{\"foo\":\"baz\"}}" - <- 404 - { - "error": "DocumentMissingException[[test_1][1] [test][1]: document missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update?fields=foo&parent=5&routing=4" -XPOST -d "{\"doc\":{\"foo\":\"baz\"}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "get": { - "exists": true, - "fields": { - "foo": "baz" - } - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"settings\":{\"index.refresh_interval\":-1}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/_search" -XPOST -d "{\"query\":{\"term\":{\"_id\":1}}}" - <- 200 - { - "took": 0, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 0, - "max_score": null, - "hits": [] - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/2/_update?refresh=true" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "2", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/_search" -XPOST -d "{\"query\":{\"term\":{\"_id\":2}}}" - <- 200 - { - "took": 1, - "timed_out": false, - "_shards": { - "total": 5, - "successful": 5, - "failed": 0 - }, - "hits": { - "total": 1, - "max_score": 1, - "hits": [ - { - "_index": "test_1", - "_type": "test", - "_id": "2", - "_score": 1, - "_source": { - "foo": "bar" - } - } - ] - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_timestamp\":{\"enabled\":1,\"store\":\"yes\"}}}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1?fields=_timestamp" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_timestamp": 1380819437569 - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update?timestamp=1372011280000" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1?fields=_timestamp" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "exists": true, - "fields": { - "_timestamp": 1372011280000 - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update?timestamp=1372011280000" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1?fields=_timestamp" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3, - "exists": true, - "fields": { - "_timestamp": 1372011280000 - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1" -XPUT -d "{\"mappings\":{\"test\":{\"_ttl\":{\"enabled\":1,\"store\":\"yes\",\"default\":\"10s\"}}}}" - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/_cluster/health?wait_for_status=yellow" -XGET - <- 200 - { - "cluster_name": "spencera", - "status": "yellow", - "timed_out": false, - "number_of_nodes": 1, - "number_of_data_nodes": 1, - "active_primary_shards": 5, - "active_shards": 5, - "relocating_shards": 0, - "initializing_shards": 0, - "unassigned_shards": 5 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1?fields=_ttl" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "exists": true, - "fields": { - "_ttl": 9997 - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update?ttl=100000" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1?fields=_ttl" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 2, - "exists": true, - "fields": { - "_ttl": 99996 - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update?ttl=20s" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 200 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1?fields=_ttl" -XGET - <- 200 - { - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 3, - "exists": true, - "fields": { - "_ttl": 19997 - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1?timestamp=1372011280000&ttl=20s" -XPOST -d "{\"foo\":\"bar\"}" - <- 400 - { - "error": "MapperParsingException[failed to parse [_ttl]]; nested: AlreadyExpiredException[already expired [test_1]/[test]/[1] due to expire at [1372011300000] and was processed at [1380819437862]]; ", - "status": 400 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update?fields=foo%2Cbar%2C_source" -XPOST -d "{\"doc\":{\"foo\":\"baz\"},\"upsert\":{\"foo\":\"bar\"}}" - <- 201 - { - "ok": true, - "_index": "test_1", - "_type": "test", - "_id": "1", - "_version": 1, - "get": { - "exists": true, - "_source": { - "foo": "bar" - }, - "fields": { - "foo": "bar" - } - } - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"bar\"}}" - <- 404 - { - "error": "DocumentMissingException[[test_1][2] [test][1]: document missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"doc\":{\"foo\":\"bar\"}}" - <- 404 - { - "error": "DocumentMissingException[[test_1][2] [test][1]: document missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"script\":\"ctx._source.foo = bar\",\"params\":{\"bar\":\"xxx\"}}" - <- 404 - { - "error": "DocumentMissingException[[test_1][2] [test][1]: document missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/test_1/test/1/_update" -XPOST -d "{\"script\":\"ctx._source.foo = bar\",\"params\":{\"bar\":\"xxx\"}}" - <- 404 - { - "error": "DocumentMissingException[[test_1][2] [test][1]: document missing]", - "status": 404 - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/*" -XDELETE - <- 200 - { - "ok": true, - "acknowledged": true - } - -TRACE: 2013-10-03T16:57:17Z - curl "http://localhost:9200/*" -XDELETE - <- 404 - { - "error": "IndexMissingException[[*] missing]", - "status": 404 - } + {"ok":true,"_shards":{"total":10,"successful":0,"failed":0}} diff --git a/test/integration/args.js b/test/integration/args.js new file mode 100644 index 000000000..db83624d2 --- /dev/null +++ b/test/integration/args.js @@ -0,0 +1,11 @@ +var program = require('commander'); + +program + .version('0.0.1') + .option('-c, --clusterName [name]', 'Set the name of the "cluster" this node will start', 'yaml_test_runners') + .option('-n, --nodeName [name]', 'Set the node\'s name', 'yaml_runner') + .option('-p, --httpPort [port]', 'Set the port for this node', 9299) + .option('-d, --dataPath [path]', 'Do not set this', '/tmp/yaml-test-data') + .parse(process.argv); + +module.exports = program; diff --git a/test/integration/RunYamlTests.test.js b/test/integration/index.js similarity index 76% rename from test/integration/RunYamlTests.test.js rename to test/integration/index.js index 2bf9eac85..11d91afc9 100644 --- a/test/integration/RunYamlTests.test.js +++ b/test/integration/index.js @@ -1,48 +1,89 @@ -var fs = require('fs') - , path = require('path') - , async = require('async') - , assert = require('assert') - , jsYaml = require('js-yaml') - , expect = require('expect.js') - , nodeunit = require('nodeunit') - , _ = require('../../src/lib/toolbelt') - , es = require('../../src/elasticsearch'); +var path = require('path'), + fs = require('fs'), + async = require('async'), + jsYaml = require('js-yaml'), + expect = require('expect.js'), + server = require('./server'), + _ = require('../../src/lib/utils'), + es = require('../../src/elasticsearch'); -require('mocha-as-promised')(); +var argv = require('optimist') + .default('executable', path.join(process.env.ES_HOME, './bin/elasticsearch')) + .default('clusterName', 'yaml-test-runner') + .default('dataPath', '/tmp/yaml-test-runner') + .argv; -/** - * Where do our tests live? - * @type {[type]} - */ + +if (argv.hostname || argv.port) { + console.log('working with ES instance at ' + argv.hostname + ':' + argv.port); +} + +// Where do the tests live? var TEST_DIR = path.resolve(__dirname, '../../es_api_spec/test/'); -// var doRE = '.*'; +// test names matching this will be run var doRE = /(^|\/)(.*)\/.*/; -// var FILE_WHITELIST = ['indices.analyze/10_analyze.yaml']; -/** - * We'll use this client for all of our work - * @type {es.Client} - */ -var client = new es.Client({ - hosts: ['localhost:9200'], - log: { - type: 'file', - level: 'trace', - path: path.resolve(__dirname, '../integration-test.log') - }, - max_connections: 1 +// a reference to a personal instance of ES Server +var esServer = null; + +// the client +var client = null; + +// location that the logger will write to +var logFile = path.resolve(__dirname, '../integration-test.log'); + +// empty all of the indices in ES please +function clearIndices (done) { + client.indices.delete({ + index: '*', + ignore: 404 + }, done); +} + +// before running any tests... +before(function (done) { + // start our personal ES Server + this.timeout(null); + if (argv.hostname) { + done(); + } else { + server.start(argv, function (err, server) { + esServer = server; + done(err); + }); + } }); -function clearIndicies (done) { - client.indices.delete({ - index: '*' - }, function () { - done(); +before(function (done) { + // delete the integration log + fs.unlink(logFile, function (err) { + if (err && ~err.message.indexOf('ENOENT')) { + done(); + } else { + done(err); + } }); -} -// before running any tests, clear the test* indicies -before(clearIndicies); +}); + +before(function () { + // create the client + client = new es.Client({ + hosts: [ + { + hostname: esServer ? esServer.__hostname : argv.hostname, + port: esServer ? esServer.__port : argv.port + } + ], + log: { + type: 'file', + level: ['error', 'trace'], + path: logFile + } + }); +}); + +before(clearIndices); /** * recursively crawl the directory, looking for yaml files which will be passed to loadFile @@ -52,8 +93,8 @@ before(clearIndicies); function loadDir(dir) { fs.readdirSync(dir).forEach(function (fileName) { describe(fileName, function () { - var location = path.join(dir, fileName) - , stat = fs.statSync(location); + var location = path.join(dir, fileName), + stat = fs.statSync(location); if (stat.isFile() && fileName.match(/\.yaml$/) && location.match(doRE)) { loadFile(location); @@ -71,16 +112,30 @@ function loadDir(dir) { */ var ES_VERSION = null; +// core expression for finding a version +var versionExp = '([\\d\\.]*\\d)(?:\\.\\w+)?'; + /** - * Regular Expression to extract version numbers from a version string + * Regular Expression to extract a version number from a string * @type {RegExp} */ -var versionExp = '([\\d\\.]*\\d)(?:\\.\\w+)?'; var versionRE = new RegExp(versionExp); + +/** + * Regular Expression to extract a version range from a string + * @type {RegExp} + */ var versionRangeRE = new RegExp(versionExp + '\\s*\\-\\s*' + versionExp); +/** + * Fetches the client.info, and parses out the version number to a comparable string + * @param done {Function} - callback + */ function getVersionFromES(done) { - client.info().then(function (resp) { + client.info({}, function (err, resp) { + if (err) { + throw new Error('unable to get info about ES'); + } expect(resp.version.number).to.match(versionRE); ES_VERSION = versionToComparableString(versionRE.exec(resp.version.number)[1]); done(); @@ -89,6 +144,7 @@ function getVersionFromES(done) { /** * Transform x.x.x into xxx.xxx.xxx, striping off any text at the end like beta or pre-alpha35 + * * @param {String} version - Version number represented as a string * @return {String} - Version number represented as three numbers, seperated by -, all numbers are * padded with 0 and will be three characters long so the strings can be compared. @@ -109,6 +165,7 @@ function versionToComparableString(version) { /** * Compare a version range to the ES_VERSION, determining if the current version * falls within the range. + * * @param {String} rangeString - a string representing two version numbers seperated by a "-" * @return {Boolean} - is the current version within the range (inclusive) */ @@ -131,15 +188,12 @@ function rangeMatchesCurrentVersion(rangeString, done) { /** * read the file's contents, parse the yaml, pass to makeTest + * * @param {String} path - Full path to yaml file * @return {undefined} */ function loadFile(location) { - var relativeName = path.relative(TEST_DIR, location) - , groupName = path.dirname(relativeName) - , fileName = path.basename(relativeName) - , docsInFile = [] - , standardTestConfigs = []; + var docsInFile = []; jsYaml.loadAll( fs.readFileSync(location, { encoding:'utf8' }), @@ -158,6 +212,7 @@ function loadFile(location) { * Read the test descriptions from a yaml document (usually only one test, per doc but * sometimes multiple docs per file, and because of the layout there COULD be * multiple test per test...) + * * @param {Object} testConfigs - The yaml document * @return {undefined} */ @@ -165,7 +220,6 @@ function makeTest(testConfig, count) { var setup; if (_.has(testConfig, 'setup')) { (new ActionRunner(testConfig.setup)).each(function (action, name) { - console.log('setup', name); before(action); }); delete testConfig.setup; @@ -180,9 +234,16 @@ function makeTest(testConfig, count) { }); // after running the tests, remove all indices - after(clearIndicies); + after(clearIndices); } +/** + * Class to wrap a single document from a yaml test file + * + * @constructor + * @class ActionRunner + * @param actions {Array} - The array of actions directly from the Yaml file + */ function ActionRunner(actions) { this._actions = []; @@ -319,8 +380,15 @@ ActionRunner.prototype = { return from; }, + /** + * Do a skip operation, setting the skipping flag to true if the version matches + * the range defined in args.version + * + * @param args + * @param done + */ do_skip: function (args, done) { - rangeMatchesCurrentVersion(args.version, function (match) { + rangeMatchesCurrentVersion(args.version, _.bind(function (match) { if (match) { this.skipping = true; console.log('skipping the rest of these actions' + (args.reason ? ' because ' + args.reason : '')); @@ -328,18 +396,17 @@ ActionRunner.prototype = { this.skipping = false; } done(); - }.bind(this)); + }, this)); }, /** * Do a request, as outlined in the args + * * @param {[type]} args [description] * @param {Function} done [description] * @return {[type]} [description] */ do_do: function (args, done) { - this._last_requests_response = null; - var catcher; // resolve the catch arg to a value used for matching once the request is complete @@ -374,9 +441,7 @@ ActionRunner.prototype = { var action = Object.keys(args).pop() , clientActionName = _.map(action.split('.'), _.camelCase).join('.') , clientAction = this.get(clientActionName, client) - , response - , error - , params = _.map(args[action], function (val) { + , params = _.map(args[action], function (val, name) { if (typeof val === 'string' && val[0] === '$') { return this.get(val); } @@ -391,35 +456,27 @@ ActionRunner.prototype = { catcher = null; } - clientAction.call(client, params) - .then(function (resp) { - response = resp; - }) - .fail(function (err, resp) { - error = err; - response = resp; - }) - .finally(function () { - this._last_requests_response = response; + clientAction.call(client, params, _.bind(function (error, body, status) { + this._last_requests_response = body; - if (error){ - if (catcher) { - if (catcher instanceof RegExp) { - // error message should match the regexp - expect(error.message).to.match(catcher); - } else if (typeof catcher === 'function') { - // error should be an instance of - expect(error).to.be.a(catcher); - } else { - throw new Error('Invalid catcher '+catcher); - } + if (error){ + if (catcher) { + if (catcher instanceof RegExp) { + // error message should match the regexp + expect(error.message).to.match(catcher); + } else if (typeof catcher === 'function') { + // error should be an instance of + expect(error).to.be.a(catcher); } else { - return done(error); + throw new Error('Invalid catcher ' + catcher); } + } else { + throw error; } + } - done(); - }.bind(this)); + done(); + }, this)); } else { throw new Error('stepped in do_do, did not find a function'); } @@ -456,6 +513,7 @@ ActionRunner.prototype = { /** * Test that the specified path exists in the response and has a * false value (eg. 0, false, undefined, null or the empty string) + * * @param {string} path - Path to the response value to test * @return {undefined} */ @@ -465,6 +523,7 @@ ActionRunner.prototype = { /** * Test that the response field (arg key) matches the value specified + * * @param {Object} args - Hash of fields->values that need to be checked * @return {undefined} */ @@ -479,6 +538,7 @@ ActionRunner.prototype = { /** * Test that the response field (arg key) is less than the value specified + * * @param {Object} args - Hash of fields->values that need to be checked * @return {undefined} */ @@ -490,6 +550,7 @@ ActionRunner.prototype = { /** * Test that the response field (arg key) is greater than the value specified + * * @param {Object} args - Hash of fields->values that need to be checked * @return {undefined} */ @@ -502,6 +563,7 @@ ActionRunner.prototype = { /** * Test that the response field (arg key) has a length equal to that specified. * For object values, checks the length of the keys. + * * @param {Object} args - Hash of fields->values that need to be checked * @return {undefined} */ diff --git a/test/integration/server.js b/test/integration/server.js new file mode 100644 index 000000000..2183a37a1 --- /dev/null +++ b/test/integration/server.js @@ -0,0 +1,61 @@ +var childProc = require('child_process'), + events = require('events'), + q = require('q'), + path = require('path'), + fs = require('fs'), + _ = require('../../src/lib/utils'); + +exports.start = function (params, cb) { + + if (!fs.existsSync(params.executable)) { + return cb(new Error('unable to find elasticsearch executable')); + } + + var server = childProc.spawn( + params.executable, + [ + '-f', + '-D es.cluster.name=' + params.clusterName, + params.port ? '-D es.http.port=' + params.port : undefined, + '-D es.path.data=' + params.dataPath, + '-D es.gateway.type=none', + '-D es.index.store.type=memory', + '-D es.discovery.zen.ping.multicast.enabled=false', + ], + { + cwd: undefined, + env: process.env, + stdio: [ + 'ignore', + 'pipe', + 'pipe' + ] + } + ); + + server.stdout.on('data', function (line) { + line = line.toString(); + var match; + // console.log(_.trim(line)); + if (!params.port && (match = line.match(/bound_address \{inet\[\/?([^:]+):(\d+)\]\}/))) { + server.__hostname = match[1]; + server.__port = match[2]; + } + + if (line.match(/started\s*$/)) { + console.log('Personal ES Server started at', server.__hostname + ':' + server.__port); + server.stdout.removeAllListeners(); + server.stderr.removeAllListeners(); + cb(null, server); + } + }); + + server.stderr.on('data', function (line) { + console.error(_.trim(line)); + }); + + process.on('exit', function () { + server.kill(); + }); + +}; diff --git a/test/mocha.opts b/test/mocha.opts new file mode 100644 index 000000000..c92b4a52e --- /dev/null +++ b/test/mocha.opts @@ -0,0 +1,2 @@ +--require should +--reporter dot diff --git a/test/unit/client.test.js b/test/unit/client.test.js index 0fb9a0d25..df61afd49 100644 --- a/test/unit/client.test.js +++ b/test/unit/client.test.js @@ -1,22 +1,16 @@ -/* node transport function tests */ -'use strict'; +var es = require('../../src/elasticsearch'), + api = require('../../src/lib/utils').requireDir(module, '../../src/api'), + expect = require('expect.js'); -var Client = require('../../src/lib/client') - , _ = require('../../src/lib/toolbelt') - , api = _.requireDir(module, '../../src/api') - , c; +describe('Client instances creation', function () { + var client; -exports['Client instances creation'] = { + beforeEach(function () { + client = new es.Client(); + }); - 'setUp': function (done) { - c = new Client(); - done(); - }, - - 'api is inherited': function(test) { - test.equals(c.bulk, api.bulk); - test.equals(c.cluster.node_stats, api.cluster.node_stats); - test.done(); - } - -}; + it('inherits the api', function () { + client.bulk.should.be.exactly(api.bulk); + client.cluster.nodeStats.should.be.exactly(api.cluster.node_stats); + }); +}); diff --git a/test/unit/connection_pool.test.js b/test/unit/connection_pool.test.js new file mode 100644 index 000000000..e32fc2840 --- /dev/null +++ b/test/unit/connection_pool.test.js @@ -0,0 +1,64 @@ +var es = require('../../src/elasticsearch'); + +describe('Connection Pool', function () { + var client, pool; + beforeEach(function () { + client = new es.Client(); + pool = client.connectionPool; + }); + + describe('default settings', function () { + it('by default has one living connection and no dead connections', function () { + pool.connections.alive.should.have.lengthOf(1); + pool.connections.dead.should.have.lengthOf(0); + }); + }); + + describe('#setNodes', function () { + it('rejects anything accept an array of objects', function () { + + (function () { + pool.setNodes([ + 'string' + ]); + }).should.throw(TypeError); + + (function () { + pool.setNodes('string'); + }).should.throw(TypeError); + + }); + + it('will clear out old nodes', function () { + // set an empty set of nodes + pool.setNodes([]); + + pool.connections.alive.should.have.lengthOf(0); + pool.connections.dead.should.have.lengthOf(0); + }); + + it('will accept a new node list', function () { + var conns = pool.connections; + + // set a list of 3 nodes + pool.setNodes([ + { + hostname: 'es-cluster.us', + port: '9200' + }, + { + hostname: 'es-cluster-1.us', + port: '9200' + }, + { + hostname: 'es-cluster-2.us', + port: '9200' + } + ]); + + conns.alive.should.have.lengthOf(3); + conns.dead.should.have.lengthOf(0); + }); + + }); +}); diff --git a/test/unit/log.test.js b/test/unit/log.test.js! similarity index 100% rename from test/unit/log.test.js rename to test/unit/log.test.js! diff --git a/test/unit/node_http_transport.test.js b/test/unit/node_http_transport.test.js! similarity index 100% rename from test/unit/node_http_transport.test.js rename to test/unit/node_http_transport.test.js! diff --git a/test/unit/stdioLogger.test.js b/test/unit/stdioLogger.test.js deleted file mode 100644 index aad4b90dc..000000000 --- a/test/unit/stdioLogger.test.js +++ /dev/null @@ -1,72 +0,0 @@ - -var Log = require('../../src/lib/log') - , log = new Log([]) - , Stdio = require('../../src/lib/loggers/stdio') - , _ = require('../../src/lib/toolbelt') - , warningLogger; - -exports['Stdio Logger'] = { - - setUp: function (done) { - if (warningLogger) { - warningLogger.cleanUpListeners(); - } - - // new logger in warning mode - warningLogger = new Stdio({ - levels: ['error', 'warning'] - }, log); - - done(); - }, - - 'logs error messages': function (test) { - test.expect(3); - - warningLogger.write = function (to, label, colorize, what) { - test.equal(label, 'ERROR'); - test.ok(_.isArray(what), 'Messages logged from calls to error should be an array'); - test.equal(what[0], 'Test Error Message'); - test.done(); - }; - - log.error('Test Error Message'); - }, - - 'should log warnings': function (test) { - test.expect(2); - - warningLogger.write = function (to, label, colorize, what) { - test.equal(label, 'WARNING'); - test.equal(what, 'Test Warning Message'); - test.done(); - }; - - log.warning('Test Warning', 'Message'); - }, - - 'should NOT log info messages': function (test) { - if (log.info('Info')) { - test.ok(false, 'There shouldn\'t be listeners for info logs'); - } else { - test.done(); - } - }, - - 'should NOT log debug messages': function (test) { - if (log.debug('Debug')) { - test.ok(false, 'There shouldn\'t be listeners for debug logs'); - } else { - test.done(); - } - }, - - 'should NOT log trace messages': function (test) { - if (log.trace('curl "http://localhost:9200" -d "{ \"query\": ... }"')) { - test.ok(false, 'There shouldn\'t be listeners for trace logs'); - } else { - test.done(); - } - } - -}; diff --git a/test/unit/stdio_logger.test.js b/test/unit/stdio_logger.test.js new file mode 100644 index 000000000..fb565962a --- /dev/null +++ b/test/unit/stdio_logger.test.js @@ -0,0 +1,66 @@ + +var es = require('../../src/elasticsearch'), + Stdio = require('../../src/lib/loggers/stdio'), + _ = require('../../src/lib/utils'), + expect = require('expect.js'); + +describe('Stdio Logger listening to levels warning and error', function () { + var client, logger; + + before(function () { + client = new es.Client({ + log: [] + }); + }); + + beforeEach(function () { + if (logger) { + logger.cleanUpListeners(); + } + + // new logger in warning mode + logger = new Stdio({ + levels: ['error', 'warning'] + }, client.log); + }); + + it('logs error messages', function (done) { + logger.write = function (to, label, colorize, what) { + label.should.eql('ERROR'); + what.should.have.type('string'); + what.should.match(/^Error: Test Error Message/); + done(); + }; + + client.log.error('Test Error Message'); + }); + + it('logs warning messages', function (done) { + logger.write = function (to, label, colorize, what) { + expect(label).to.be('WARNING'); + expect(what).to.be('Test Warning Message'); + done(); + }; + + client.log.warning('Test Warning', 'Message'); + }); + + it('does not log info messages', function () { + if (client.log.info('Info')) { + throw new Error('There shouldn\'t be listeners for info logs'); + } + }); + + it('does not log debug messages', function () { + if (client.log.debug('Debug')) { + throw new Error('There shouldn\'t be listeners for debug logs'); + } + }); + + it('does not log trace messages', function () { + if (client.log.trace('curl "http://localhost:9200" -d "{ \"query\": ... }"')) { + throw new Error('There shouldn\'t be listeners for trace logs'); + } + }); + +}); diff --git a/test/unit/toolbelt.test.js b/test/unit/toolbelt.test.js index 1c4ecc12c..56415a823 100644 --- a/test/unit/toolbelt.test.js +++ b/test/unit/toolbelt.test.js @@ -1,4 +1,4 @@ -var _ = require('../../src/lib/toolbelt') +var _ = require('../../src/lib/utils') , expect = require('expect.js'); describe('Utils', function () { @@ -46,43 +46,43 @@ describe('Utils', function () { describe('#isNumeric', function () { it('likes Infinity', function () { - expect(_.isNumeric(Infinity)).to.eq(true); + expect(_.isNumeric(Infinity)).to.be.true; }); it('likes strings', function () { - expect(_.isNumeric('100')).to.eq(true); + expect(_.isNumeric('100')).to.be.true; }); it('likes integers', function () { - expect(_.isNumeric(100)).to.eq(true); + expect(_.isNumeric(100)).to.be.true; }); it('likes floats', function () { - expect(_.isNumeric(100.1)).to.eq(true); + expect(_.isNumeric(100.1)).to.be.true; }); it('likes exponentials', function () { - expect(_.isNumeric(100e1)).to.eq(true); + expect(_.isNumeric(100e1)).to.be.true; }); it('likes hexidecimals', function () { - expect(_.isNumeric(0x100)).to.eq(true); + expect(_.isNumeric(0x100)).to.be.true; }); it('likes imaginary numbers', function () { - expect(_.isNumeric('yeah right')).to.eq(false); + expect(_.isNumeric('yeah right')).to.be.false; }); it('dislikes strings with words', function () { - expect(_.isNumeric('100heat')).to.eq(false); + expect(_.isNumeric('100heat')).to.be.false; }); it('dislikes strings with words even if they are seperate', function () { - expect(_.isNumeric('100 pasta')).to.eq(false); + expect(_.isNumeric('100 pasta')).to.be.false; }); it('dislikes null', function () { - expect(_.isNumeric(null)).to.eq(false); + expect(_.isNumeric(null)).to.be.false; }); }); @@ -119,14 +119,14 @@ describe('Utils', function () { describe('#map', function () { it('returns an object when passed an object', function () { var out = _.map({a:1, b:2}, function (val) { return val * 2; }); - expect(out).to.deep.eq({a:2, b:4}); + expect(out).to.eql({a:2, b:4}); }); it('returns an array for anything else', function () { var std = _.map([1, 2, 3], function (val) { return val * 2; }); expect(std) .to.be.a('array') - .and.to.deep.eq(_.map('123', function (val) { return val * 2; })); + .and.to.eql(_.map('123', function (val) { return val * 2; })); }); }); @@ -137,41 +137,41 @@ describe('Utils', function () { describe('#camelCase', function () { it('find spaces, underscores, and other natural word breaks', function () { - expect(_.camelCase('Neil PatRICK hArris-is_a.dog')).to.eq('neilPatrickHarrisIsADog'); + expect(_.camelCase('Neil PatRICK hArris-is_a.dog')).to.eql('neilPatrickHarrisIsADog'); }); it('ignores abreviations', function () { - expect(_.camelCase('JSON_parser')).to.eq('jsonParser'); + expect(_.camelCase('JSON_parser')).to.eql('jsonParser'); }); }); describe('#studlyCase', function () { it('find spaces, underscores, and other natural word breaks', function () { - expect(_.studlyCase('Neil PatRICK hArris-is_a.dog')).to.eq('NeilPatrickHarrisIsADog'); + expect(_.studlyCase('Neil PatRICK hArris-is_a.dog')).to.eql('NeilPatrickHarrisIsADog'); }); it('ignores abreviations', function () { - expect(_.studlyCase('JSON_parser')).to.eq('JsonParser'); + expect(_.studlyCase('JSON_parser')).to.eql('JsonParser'); }); }); describe('#toLowerString', function () { it('transforms normal strings', function () { - expect(_.toLowerString('PASTA')).to.eq('pasta'); + expect(_.toLowerString('PASTA')).to.eql('pasta'); }); it('ignores long form empty vals (null, false, undef)', function () { - expect(_.toLowerString(null)).to.eq(''); - expect(_.toLowerString(false)).to.eq(''); - expect(_.toLowerString(void 0)).to.eq(''); + expect(_.toLowerString(null)).to.eql(''); + expect(_.toLowerString(false)).to.eql(''); + expect(_.toLowerString(void 0)).to.eql(''); }); it('uses the objects own toString', function () { - expect(_.toLowerString(['A', 'B'])).to.eq('a,b'); + expect(_.toLowerString(['A', 'B'])).to.eql('a,b'); }); it('sorta kinda works on objects', function () { - expect(_.toLowerString({a: 'thing'})).to.eq('[object object]'); + expect(_.toLowerString({a: 'thing'})).to.eql('[object object]'); }); }); }); @@ -183,7 +183,7 @@ describe('Utils', function () { var obj = { foo:'bar' }; - expect(_.deepMerge(obj, { bar: 'baz' })).to.eq(obj); + expect(_.deepMerge(obj, { bar: 'baz' })).to.eql(obj); }); it('concats arrays', function () { diff --git a/test/unit/transport.test.js b/test/unit/transport.test.js new file mode 100644 index 000000000..8e32f41b8 --- /dev/null +++ b/test/unit/transport.test.js @@ -0,0 +1,45 @@ +var es = require('../../src/elasticsearch'), + sinon = require('sinon'), + expect = require('expect.js'); + +describe('transport', function () { + + describe('#sniff', function () { + it('does a head request to "/"', function (done) { + var c = new es.Client(); + // stub the tranports request method, arg 1 is a callback + sinon.stub(c.transport, 'request').callsArgAsync(1); + + c.transport.sniff(function (err, resp) { + var spy = c.transport.request.getCall(0), + params = spy.args[0]; + + params.should.have.type('object'); + params.should.have.property('path', '/_cluster/nodes'); + if (params.method) { + params.should.be('GET'); + } + done(); + }); + }); + + describe('when sniffOnStart === true', function () { + + describe('and the cluster is down', function () { + before(function (done) { + var c = new es.Client({ + sniffOnStart: true, + hosts: [ + 'intentionally-not-a-real-cluster.com:9200' + ] + }); + c.on('sniff complete', done); + }); + + it('should not have any connections in the connection pool', function () { + + }); + }); + }); + }); +});