Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var user = {};
- user.first_name = "John updated"
- db.update({
- index: config.index_name,
- type: 'user',
- id: req.body.user_id,
- body: {
- doc: user
- }
- }, function (err, resp) {
- if (err) {
- return next(err);
- }
- db.search({
- index: config.index_name,
- type: 'user',
- body: {
- "query": {
- "match": {
- "_id": req.body.user_id
- }
- }
- }
- }, function (err, resp) {
- if (err) {
- return next(err);
- }
- var data = {};
- data.creator_name = resp.hits.hits[0]._source.first_name
- // Here am not getting update first name "John updated" instead of getting John
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement