module.exports = function(sequelize, DataTypes) {
var User = sequelize.define('User', {
id: DataTypes.INTEGER,
username: DataTypes.STRING,
password: DataTypes.STRING
}, {
tableName: 'Users',
timestamps: false,
classMethods: {
associate: function(models) {
// associations can be defined here
}
}
});
return User;
};
router.post('/', function(req, res, next) {
models.User.findAll({
where: {
username:req.body.username
}
}).then(function(user) {
console.log(user);
res.render('login');
}).catch(function(err){
console.error(err);
});
});
{
"multi_match" : {
"query": "hello world",
"fields": [ "some_field_1", "some_field_2" ],
"type": "phrase"
}
}
{"_index":"<ваш_индекс>", "_type":"<ваш_type>", "_id":"1", "_source":{"key":"строка 1"}}
{"_index":"<ваш_индекс>", "_type":"<ваш_type>", "_id":"2", "_source":{"key":"строка 2"}}
Один документ - одна строка.