I want to update few posts in Elastic has stale contents. I made following script, but it seems that it's not updating in Elastic.
PHP:
<?php
$startTime = microtime(true);
$fileDir = dirname(__FILE__);
require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);
// select query to make mapping of IPs
$db = XenForo_Application::getDb();
// live IDs
$arrIds=array(132);
foreach ($arrIds as $id) {
$model=XenForo_Model::create('XenForo_Model_Post');
$obj = $model->getPostById($id);
$dw = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post');
$dw->setExistingData($id);
$dw->set('message', $obj['message']);
$dw->save();
}