const addmappingToIndex = async function(indexName, mappingType, mapping){ console.log(mapping); return await esClient.indices.putMapping({ index: indexName, type: mappingType, body: mapping }); }
var addMapping = function (indexName, typeName) { client.indices.putMapping({ index: indexName, type: typeName, body: mapping }, function(err, resp) { if (err) { console.log(err); return; } if (resp) { console.log(resp); console.log('Added Mapping') process.exit(0) return; } return; }); }
/** * Add mapping to specified type * @param {Object} data - mapping data * @param {Function} [callback] - only in case callback style is used * @return {Promise} */ addMapping (data, callback) { return this.client.indices.putMapping({ index: this.index, type: this.type, body: data }).catch(err => { if (callback && typeof callback === 'function') { return callback(err); } throw err; }); }
var putMapping = function() { client.indices.putMapping({ index: 'world', type: 'country', body: { properties: { 'id': { 'type': 'text' } } } }, function(err, resp, status) { if (err) { console.log(err); } else { console.log(resp); } }); }