Skip to content

Instantly share code, notes, and snippets.

@mrfelton
Created July 3, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrfelton/c28f6c54735628b20f81 to your computer and use it in GitHub Desktop.
Save mrfelton/c28f6c54735628b20f81 to your computer and use it in GitHub Desktop.
diff --git a/lib/esConnector.js b/lib/esConnector.js
index 99318ac..3aa48db 100644
--- a/lib/esConnector.js
+++ b/lib/esConnector.js
@@ -175,19 +175,20 @@ ESConnector.prototype.setupMappings = function (modelNames, callback) {
return !modelNames || _.includes(modelNames, mapping.name);
});
log('ESConnector.prototype.setupMappings', 'mappingsToSetUp', _.pluck(mappingsToSetUp, 'name'));
-
Promise.map(
mappingsToSetUp,
function (mapping) {
+ var mappingName = mapping.name;
+ delete mapping.name;
return db.indices.putMapping(
{
index: settings.index,
- type: mapping.name,
- body: {properties: mapping.properties}
+ type: mappingName,
+ body: mapping
}
).then(
function (body) {
- log('ESConnector.prototype.setupMappings', mapping.name, body);
+ log('ESConnector.prototype.setupMappings', mappingName, body);
return Promise.resolve();
},
function (err) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment