Duplicate Error After Enabling Search Suggestions - XFES Elasticsearch Configuration Issue

EnesCihan

Member
Affected version
2.3 Beta 5
Hello,

I recently activated the search suggestions feature in the XFES (XenForo Enhanced Search) add-on on my XenForo 2.3 Beta 5 site. After enabling this feature, I was prompted to optimize the search index. However, when I attempted to optimize, I encountered the following error:

Code:
XFES\Elasticsearch\RequestException: Failed to parse mapping: analyzer [suggest] has not been configured in mappings in src/addons/XFES/Elasticsearch/Api.php at line 464
XFES\Elasticsearch\Api->request() in src/addons/XFES/Elasticsearch/Api.php at line 361
XFES\Elasticsearch\Api->createIndex() in src/addons/XFES/Service/Optimizer.php at line 74
XFES\Service\Optimizer->optimize() in src/addons/XFES/Admin/Controller/EnhancedSearch.php at line 185
XFES\Admin\Controller\EnhancedSearch->actionOptimize() in src/XF/Mvc/Dispatcher.php at line 352
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 258
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2592
XF\App->run() in src/XF.php at line 532
XF::runApp() in admin.php at line 13

  1. Enabled search suggestions in XFES.
  2. Clicked on 'Optimize' as recommended.
  3. Received the error regarding the missing 'suggest' analyzer in the Elasticsearch mappings.
I believe this issue might be related to the Elasticsearch configuration, specifically missing settings for the 'suggest' analyzer in the mappings. Has anyone else encountered this issue after enabling search suggestions, and if so, how did you resolve it? Any guidance on configuring the 'suggest' analyzer appropriately would be greatly appreciated.
 
This error appeared once a day, requiring search optimization, I thought there was not enough RAM, there were 5 gigabytes, I moved to another VPS server, RAM 10 gigabytes, but after a week everything repeated itself again, optimization is required again, the search stopped working and it is necessary to reconfigure the search again. Why does this happen, what is not enough? When there were 5 gigabytes of memory, the error appeared once a day, now 10 gigabytes, the error once a week...

Xenforo v2.3.6

Elasticsearch server http://localhost:9200
Version 8.17.2 (elasticsearch 8.17.2)
Stats:
Documents 313,955 (333.5 MB)
Index updates 324,515
Searches 188 (5 milliseconds average)
Allocated memory 0 bytes

Code:
[LIST]
[*]XFES\Elasticsearch\RequestException: Failed to parse mapping: analyzer [suggest] has not been configured in mappings
[*]src/addons/XFES/Elasticsearch/Api.php:481
[*]Generated by: Admin
[*]Mar 3, 2025 at 2:56 PM
[/LIST]
[HEADING=2]Stack trace[/HEADING]
#0 src/addons/XFES/Elasticsearch/Api.php(363): XFES\Elasticsearch\Api->request('put', 'my_xf', '{
    "mappings...')
#1 src/addons/XFES/Service/Optimizer.php(79): XFES\Elasticsearch\Api->createIndex(Array)
#2 src/addons/XFES/Admin/Controller/EnhancedSearch.php(196): XFES\Service\Optimizer->optimize(Array, true)
#3 src/XF/Mvc/Dispatcher.php(362): XFES\Admin\Controller\EnhancedSearch->actionOptimize(Object(XF\Mvc\ParameterBag))
#4 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('XFES:EnhancedSe...', 'Optimize', Object(XF\Mvc\RouteMatch), Object(XFES\Admin\Controller\EnhancedSearch), NULL)
#5 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XFES\Admin\Controller\EnhancedSearch), NULL)
#6 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#7 src/XF/App.php(2826): XF\Mvc\Dispatcher->run()
#8 src/XF.php(806): XF\App->run()
#9 admin.php(15): XF::runApp('XF\\Admin\\App')
#10 {main}
[HEADING=2]Request state[/HEADING]
array(4) {
  ["url"] => string(35) "/admin.php?enhanced-search/optimize"
  ["referrer"] => string(48) "https://site.com/admin.php?enhanced-search/"
  ["_GET"] => array(1) {
    ["enhanced-search/optimize"] => string(0) ""
  }
  ["_POST"] => array(1) {
    ["_xfToken"] => string(8) "********"
  }
}
 
Last edited:
This won't be a sporadic issue. Once you've followed the work-around, it should stick. If that's not the case then something has changed your Elasticsearch mappings, whether an add-on or something else.
 
This won't be a sporadic issue. Once you've followed the work-around, it should stick. If that's not the case then something has changed your Elasticsearch mappings, whether an add-on or something else.
What workaround do you mean?
I don't have any third party addons.
 
Sorry for the stupid question, but where can I turn these settings on and off?
Do you mean Word stemming?
 
The error was resolved after: I gave the database a name and came up with a password, then rebuilt the search index.
Then I rebooted the server.
And now the error has been gone for 3 weeks.

Снимок экрана 2025-03-22 в 17.53.56.webpСнимок экрана 2025-03-22 в 17.53.05.webp
 
This method also does not solve the problem, everything worked fine for 3 weeks, but errors started again and today I simply disabled this addon.

I can't imagine how to work with this addon further, there are no precise settings from its creators, or these settings do not raise questions only among professional programmers.
 
Last edited:
Could the reboot be corrupting the database? Are you shutting it down via a service or just a hard reset? Could use a dedicated instance (VPS) for the build. Might help.
 
Could the reboot be corrupting the database?
There are no answers to this from its manufacturer, it is not clear how to install it so that it definitely works. There are many instructions and they are all different.
I installed it according to these instructions:

Are you shutting it down via a service or just a hard reset?
As I understand it, any server reboot can damage the database of this search, it immediately crashes and gives errors.
Now I have turned on the regular search, because I am tired of reading messages from users once a day that the search has failed again. It can work for a day, or 3 days or even 3 weeks and then it will still fail.
 
Last edited:
Back
Top Bottom