1

Express を使用して ElasticJS のインデックスを更新しようとしているときに、この奇妙なエラーが発生しました。

router.put('/update/:id', async (req, res) => {
  try {
    console.log('Entered updateuser', req.params.id);
    const salt = await bcrypt.genSalt(10);
    let password = await bcrypt.hash(req.body.password, salt);

    const data = {
      email: req.body.email,
      firstName: req.body.firstName,
      lastName: req.body.lastName,
      phone: req.body.phone,
      password
    };

    await client.update({
      index: 'users',
      type: 'mytype',
      id: req.params.id,
      body: data
    });
    res.json({ msg: 'Updated Successfully' });
  } catch (err) {
    // res.status(500).send(err.message);
    console.log(err);
  }
});

すべてのパラメータがそこにあることを確認しましたが、エラーが発生します:

use the endpoint /{index}/_update/{id} instead."' ],

[0]      meta:
[0]       { context: null,
[0]         request: [Object],
[0]         name: 'elasticsearch-js',
[0]         connection: [Object],
[0]         attempts: 0,
[0]         aborted: false } } }
[0] Entered updateuser GIt7NW0BKLEzmnN0prT2
[0] { ResponseError: x_content_parse_exception
[0]         request: [Object],
[0]         name: 'elasticsearch-js',
[0]         connection: [Object],
[0]         attempts: 0,
[0]         aborted: false } } }

誰が問題を知っていますか?

4

1 に答える 1