Permalink
Browse files

Merge pull request #8 from gsf/type-inconsistency

Delete type "doc" if no type specified
  • Loading branch information...
2 parents 3c2b0c1 + eeaa574 commit af70f979fc00ce87497681b43da3a5f177022b47 @ncb000gt committed Mar 28, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/elasticsearch.js
View
@@ -43,7 +43,7 @@ ElasticSearch.prototype.add = function(opts, doc, cb) {
}
var def = {
method: ((opts.id)?'PUT':'POST'),
- path: '/' + this.index + '/' + (opts.type || 'doc') + '/' + (opts.id || '') + ((opts.refresh)?'?refresh=true':'')
+ path: '/' + this.index + '/' + (opts.type || 'doc') + '/' + (opts.id || '') + (opts.refresh?'?refresh=true':'')
};
utils.request(utils.mapConfig(def, utils.default_config, opts), doc, cb);
@@ -56,7 +56,7 @@ ElasticSearch.prototype.delete = function(opts, cb) {
}
var def = {
method: 'DELETE',
- path: '/' + this.index + '/' + ((opts.type)?(''+opts.type+((opts.id)?'/'+opts.id:'')):'') + ((opts.refresh)?'?refresh=true':'')
+ path: '/' + this.index + '/' + (opts.type || 'doc') + (opts.id?'/'+opts.id:'') + (opts.refresh?'?refresh=true':'')
};
utils.request(utils.mapConfig(def, utils.default_config, opts), undefined, cb);

0 comments on commit af70f97

Please sign in to comment.