Fixed XFES 2.0 Beta1 error "Rebuild search index"

Affected version
XFES 2.0 Beta1
#1
Hi,

when I go to "rebuild search index", I get the message:

XFES\Elasticsearch\RequestException: java.util.ArrayList cannot be cast to java.util.Map in src/addons/XFES/Elasticsearch/Api.php at line 367
  1. XFES\Elasticsearch\Api->request() in src/addons/XFES/Elasticsearch/Api.php at line 279
  2. XFES\Elasticsearch\Api->createIndex() in src/addons/XFES/Service/Optimizer.php at line 87
  3. XFES\Service\Optimizer->optimize() in src/addons/XFES/Search/Source/Elasticsearch.php at line 139
  4. XFES\Search\Source\Elasticsearch->truncate() in src/XF/Search/Search.php at line 129
  5. XF\Search\Search->truncate() in src/XF/Job/SearchRebuild.php at line 25
  6. XF\Job\SearchRebuild->run() in src/XF/Job/Manager.php at line 193
  7. XF\Job\Manager->runJobInternal() in src/XF/Job/Manager.php at line 140
  8. XF\Job\Manager->runJobEntry() in src/XF/Admin/Controller/Tools.php at line 92
  9. XF\Admin\Controller\Tools->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 232
  10. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 85
  11. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
  12. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1771
  13. XF\App->run() in src/XF.php at line 319
  14. XF::runApp() in admin.php at line 13
 

Mike

XenForo developer
Staff member
#2
To confirm, which version of Elasticsearch are you running?

You can likely get by this if you don't empty the index.
 
#7
Hi Mike,

after installing the version Elasticsearch 5.5.2, I can not make a "rebuild search index". With the xF1.5.14 it goes without problems:

Server error log
XFES\Elasticsearch\BulkRequestException: Elasticsearch indexing error: Elasticsearch bulk action error (first error: [thread-18] failed to parse [prefix])
  • src/addons/XFES/Elasticsearch/Api.php:394

Stack trace
#0 /var/www/xf2test.rpg-foren.com/htdocs/src/addons/XFES/Elasticsearch/Api.php(171): XFES\Elasticsearch\Api->bulkRequest('{"index":{"_ind...')
#1 /var/www/xf2test.rpg-foren.com/htdocs/src/addons/XFES/Search/Source/Elasticsearch.php(82): XFES\Elasticsearch\Api->indexBulk(Array)
#2 /var/www/xf2test.rpg-foren.com/htdocs/src/addons/XFES/Search/Source/Elasticsearch.php(57): XFES\Search\Source\Elasticsearch->flushBulkIndexing()
#3 /var/www/xxxx/htdocs/src/XF/Search/Search.php(40): XFES\Search\Source\Elasticsearch->index(Object(XF\Search\IndexRecord))
#4 /var/www/xxx/htdocs/src/XF/Search/Search.php(59): XF\Search\Search->index('post', Object(XFMG\XF\Entity\Post))
#5 /var/www/xxx/htdocs/src/XF/Search/Search.php(85): XF\Search\Search->indexEntities('post', Object(XF\Mvc\Entity\ArrayCollection))
#6 /var/www/xxx/htdocs/src/XF/Job/SearchRebuild.php(57): XF\Search\Search->indexRange('post', 0, '500')
#7 /var/www/xxx/htdocs/src/XF/Job/Manager.php(193): XF\Job\SearchRebuild->run(8)
#8 /var/www/xxx/htdocs/src/XF/Job/Manager.php(140): XF\Job\Manager->runJobInternal(Array, 8)
#9 /var/www/xxx/htdocs/src/XF/Admin/Controller/Tools.php(92): XF\Job\Manager->runJobEntry(Array, 8)
#10 /var/www/xxx/htdocs/src/XF/Mvc/Dispatcher.php(232): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#11 /var/www/xxx/htdocs/src/XF/Mvc/Dispatcher.php(85): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', 'html', Object(XF\Mvc\ParameterBag), 'tools')
#12 /var/www/xxx/htdocs/src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#13 /var/www/xxx/htdocs/src/XF/App.php(1771): XF\Mvc\Dispatcher->run()
#14 /var/www/xxx/htdocs/src/XF.php(319): XF\App->run()
#15 /var/www/xxx/htdocs/admin.php(13): XF::runApp('XF\\Admin\\App')
#16 {main}

Request state
array(3) {
["url"] => string(24) "/admin.php?tools/run-job"
["_GET"] => array(1) {
["tools/run-job"] => string(0) ""
}
["_POST"] => array(4) {
["_xfRedirect"] => string(63) "https://xf2test.rpg-foren.com/admin.php?tools/rebuild&success=1"
["_xfToken"] => string(8) "********"
["only"] => string(23) "RebuildXF:SearchRebuild"
["only_id"] => string(1) "0"
}
}
 

Rudy

Well-known member
#10
I am having some issues with this myself--I am getting a similar error when attempting a rebuild. Elasticsearch 2.4.3 is present on the server.

I enabled the advanced options, as I want to use stemming, and also deal with the accented characters. When I go to empty and rebuild the index, I hop right to this error page:

Code:
XFES\Elasticsearch\RequestException: java.util.ArrayList cannot be cast to java.util.Map in src/addons/XFES/Elasticsearch/Api.php at line 367
XFES\Elasticsearch\Api->request() in src/addons/XFES/Elasticsearch/Api.php at line 279
XFES\Elasticsearch\Api->createIndex() in src/addons/XFES/Service/Optimizer.php at line 87
XFES\Service\Optimizer->optimize() in src/addons/XFES/Search/Source/Elasticsearch.php at line 139
XFES\Search\Source\Elasticsearch->truncate() in src/XF/Search/Search.php at line 129
XF\Search\Search->truncate() in src/XF/Job/SearchRebuild.php at line 25
XF\Job\SearchRebuild->run() in src/XF/Job/Manager.php at line 193
XF\Job\Manager->runJobInternal() in src/XF/Job/Manager.php at line 140
XF\Job\Manager->runJobEntry() in src/XF/Admin/Controller/Tools.php at line 92
XF\Admin\Controller\Tools->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 232
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 85
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1771
XF\App->run() in src/XF.php at line 319
XF::runApp() in admin.php at line 13
If I hit the "back" button in the browser, it begins indexing, and continues to completion.

When I go back to the same Enhanced Search configuration page, I find that stemming is still not selected, and neither is the handling of accented characters.

1505275927921.png

If I choose only the stemming option, it still ends up at the same error page.

I am now repeating the rebuild for the third time, using the back button in the browser.

Verifying the stemming option, I searched on the word "warn" and it matched anything with "warn" in it. However, searching on "warning" only revealed results for the word "warning."


Code:
#0 /........../src/addons/XFES/Elasticsearch/Api.php(279): XFES\Elasticsearch\Api->request('put', 'shtv_xfstaff', Array)
#1 /........../src/addons/XFES/Service/Optimizer.php(87): XFES\Elasticsearch\Api->createIndex(Array)
#2 /........../src/addons/XFES/Search/Source/Elasticsearch.php(139): XFES\Service\Optimizer->optimize(Array, true)
#3 /........../src/XF/Search/Search.php(129): XFES\Search\Source\Elasticsearch->truncate('')
#4 /........../src/XF/Job/SearchRebuild.php(25): XF\Search\Search->truncate('')
#5 /........../src/XF/Job/Manager.php(193): XF\Job\SearchRebuild->run(8)
#6 /........../src/XF/Job/Manager.php(140): XF\Job\Manager->runJobInternal(Array, 8)
#7 /........../src/XF/Admin/Controller/Tools.php(92): XF\Job\Manager->runJobEntry(Array, 8)
#8 /........../src/XF/Mvc/Dispatcher.php(232): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#9 /........../src/XF/Mvc/Dispatcher.php(85): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'run-job', 'html', Object(XF\Mvc\ParameterBag), 'tools')
#10 /........../src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#11 /........../src/XF/App.php(1771): XF\Mvc\Dispatcher->run()
#12 /........../src/XF.php(319): XF\App->run()
#13 /........../admin.php(13): XF::runApp('XF\\Admin\\App')
#14 {main}

Code:
array(3) {
  ["url"] => string(24) "/admin.php?tools/run-job"
  ["_GET"] => array(1) {
    ["tools/run-job"] => string(0) ""
  }
  ["_POST"] => array(4) {
    ["_xfRedirect"] => string(64) "http://............/admin.php?tools/rebuild&success=1"
    ["_xfToken"] => string(8) "********"
    ["only"] => string(23) "RebuildXF:SearchRebuild"
    ["only_id"] => string(1) "0"
  }
}
 

Mike

XenForo developer
Staff member
#11
@Rudy, based on your stack trace, you don't appear to be using XFES 2.0.0 beta 2, where this is fixed. The line numbers don't match with beta 2.
 

Rudy

Well-known member
#12
Thank you, @Mike. I hadn't realized there was a beta 2 release so soon (I had downloaded beta 1 just a couple of days ago). I remedied that just now and the indexing works perfectly. (Imagine that? ;) )
 
Top