Elasticsearch indexing failed

Sunka

Well-known member
Installed xfes 1.1.8, xenforo 1.5.16, and elasticsearch 6
Reindex failed.
This is server logs:

Code:
Server Error Log
Error Info
XenForo_Exception: Elasticsearch indexing failed. See the server error log for more details. - library/XenES/Search/SourceHandler/ElasticSearch.php:1195
Generated By: Sunka, 2 minutes ago
Stack Trace
#0 /home/nginx/domains/pijanitvor.com/public/library/XenES/Search/SourceHandler/ElasticSearch.php(81): XenES_Search_SourceHandler_ElasticSearch->_triggerFailedIndexError(Object(stdClass), Array)
#1 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Search/Indexer.php(125): XenES_Search_SourceHandler_ElasticSearch->finalizeRebuildSet()
#2 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Deferred/SearchIndex.php(76): XenForo_Search_Indexer->finalizeRebuildSet()
#3 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Model/Deferred.php(295): XenForo_Deferred_SearchIndex->execute(Array, Array, 6.2101969718933, '')
#4 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Model/Deferred.php(429): XenForo_Model_Deferred->runDeferred(Array, 6.2101969718933, '', false)
#5 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Model/Deferred.php(374): XenForo_Model_Deferred->_runInternal(Array, 6.2101979255676, '', false)
#6 /home/nginx/domains/pijanitvor.com/public/library/XenForo/ViewRenderer/Abstract.php(354): XenForo_Model_Deferred->run(true, 6.2101979255676)
#7 /home/nginx/domains/pijanitvor.com/public/library/XenForo/ViewRenderer/HtmlAdmin.php(131): XenForo_ViewRenderer_Abstract::hasManualDeferredToRun(true)
#8 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(662): XenForo_ViewRenderer_HtmlAdmin->renderContainer(Object(XenForo_Template_Admin), Array)
#9 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(176): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_Error), Object(XenForo_ViewRenderer_HtmlAdmin), Array)
#10 /home/nginx/domains/pijanitvor.com/public/admin.php(13): XenForo_FrontController->run()
#11 {main}
Request State
array(3) {
  ["url"] => string(55) "https://www.pijanitvor.com/admin.php?tools/run-deferred"
  ["_GET"] => array(1) {
    ["tools/run-deferred"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["redirect"] => string(60) "https://www.pijanitvor.com/admin.php?tools/rebuild&success=1"
    ["execute"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
  }
}
Code:
Server Error Log
Error Info
XenForo_Exception: Elasticsearch indexing failed for report-1 Elasticsearch error: failed to parse [is_report] - library/XenES/Search/SourceHandler/ElasticSearch.php:1062
Generated By: Sunka, 1 minute ago
Stack Trace
#0 /home/nginx/domains/pijanitvor.com/public/library/XenES/Search/SourceHandler/ElasticSearch.php(1185): XenES_Search_SourceHandler_ElasticSearch->_logSearchResponseError(Object(stdClass), true, 'Elasticsearch i...')
#1 /home/nginx/domains/pijanitvor.com/public/library/XenES/Search/SourceHandler/ElasticSearch.php(81): XenES_Search_SourceHandler_ElasticSearch->_triggerFailedIndexError(Object(stdClass), Array)
#2 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Search/Indexer.php(125): XenES_Search_SourceHandler_ElasticSearch->finalizeRebuildSet()
#3 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Deferred/SearchIndex.php(76): XenForo_Search_Indexer->finalizeRebuildSet()
#4 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Model/Deferred.php(295): XenForo_Deferred_SearchIndex->execute(Array, Array, 8, '')
#5 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Model/Deferred.php(429): XenForo_Model_Deferred->runDeferred(Array, 8, '', false)
#6 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Model/Deferred.php(374): XenForo_Model_Deferred->_runInternal(Array, 8, '', false)
#7 /home/nginx/domains/pijanitvor.com/public/library/XenForo/ControllerAdmin/Tools.php(159): XenForo_Model_Deferred->run(true, NULL, '', false)
#8 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(369): XenForo_ControllerAdmin_Tools->actionRunDeferred()
#9 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(152): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#10 /home/nginx/domains/pijanitvor.com/public/admin.php(13): XenForo_FrontController->run()
#11 {main}
Request State
array(3) {
  ["url"] => string(55) "https://www.pijanitvor.com/admin.php?tools/run-deferred"
  ["_GET"] => array(1) {
    ["tools/run-deferred"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["redirect"] => string(60) "https://www.pijanitvor.com/admin.php?tools/rebuild&success=1"
    ["execute"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
  }
}
 

Sunka

Well-known member
P.S.

In ElasticSearch.php, line 1195 is
// bulk action

segment of code:

Code:
        if (!empty($result->error))
        {
            if (!empty($result->_type) && !empty($result->_id))
            {
                $typeAndId = XenES_Api::getTypeAndIdFromHit($result);
                $failed[] = array($typeAndId[0], $typeAndId[1], $result->error);
            }
            else
            {
                $failed[] = array('', '', $result->error);
            }
        }
        else if (!empty($result->items))
        {
            // bulk action
            foreach ($result->items AS $item)
            {
                if (!empty($item->index))
                {
                    $record = $item->index;
                }
                else if (!empty($item->delete))
                {
                    $record = $item->delete;
                }
                else
                {
                    continue;
                }

                if (!empty($record->error))
                {
                    $typeAndId = XenES_Api::getTypeAndIdFromHit($record);
                    $failed[] = array($typeAndId[0], $typeAndId[1], $record->error);
                }
            }
        }

In ACP is notice There are manual rebuild processes that have been stopped before completion. Click here to complete them., but click on it started to continue rebuilding and next second it stops with above server error
 
Last edited:

Mike

XenForo developer
Staff member
The error appears to relate to indexing of reports which is from an add-on. Elasticsearch 6 has various changes that add-ons may need to account for, so you will need to contact the add-on author for guidance.
 

Sunka

Well-known member
@Xon
Yep.
Installed xfes, installed elasticsearch, delete index in xenforo acp, start rebuilding and after few minutes stop with this error
 

Xon

Well-known member
This is from Report Improvements + Elasticsearch Essentials, for some reason it isn't working well with ElasticSearch 6 :(
 

Xon

Well-known member
Fixed in latest Report Improvements update. single type mappings can give some confusing error messages :(
 

Biarritz64

Active member
@Xon @Sunka
i have this error
Code:
Rejecting mapping update to [elastic] as the final mapping would have more than 1 type: [elastic, xf] in
i can't rebuid or remove search index from xf2
my cluster name "elastic"
can some one help me
how can i delete my index or cluster? try many thing can't find solution
 

Xon

Well-known member
Try these curl commands;
Code:
curl -XPUT 'localhost:9200/_all/_settings?pretty' -H 'Content-Type: application/json' -d '{
    "index": {
        "blocks": {
            "read_only_allow_delete": "false"
        }
    }
}'

curl -XDELETE 'localhost:9200/elastic'
 

Biarritz64

Active member
Try these curl commands;
Code:
curl -XPUT 'localhost:9200/_all/_settings?pretty' -H 'Content-Type: application/json' -d '{
    "index": {
        "blocks": {
            "read_only_allow_delete": "false"
        }
    }
}'

curl -XDELETE 'localhost:9200/elastic'
hi @Xon thank you for your help
it return

Code:
  "error" : {
    "root_cause" : [
      {
        "type" : "index_not_found_exception",
        "reason" : "no such index",
        "resource.type" : "index_expression",
        "resource.id" : "_all"
      }
    ],
    "type" : "index_not_found_exception",
    "reason" : "no such index",
    "resource.type" : "index_expression",
    "resource.id" : "_all"
  },
  "status" : 404
}
i follow @Sunka tutorial to install elasticsearch

in this steps
Code:
nano /etc/elasticsearch/elasticsearch.yml
at the end of file add this:
Code:
cluster.name: CUSTOM NAME OF YOUR CLUSTER (same name should be inserted into your XenForo field in Admin Control Panel in field Elasticsearch Index Name)
network.host: localhost
http.port: 9200
i choose "elastic" for my custom name

First i configure xfes and enter "elastic" in index name
i enable xfes and first it workes then i wanted to change the Word stemming setting in xfes and my problem start

here are the error
if i run optimise on xfes setting it return

Code:
XFES\Elasticsearch\RequestException: Rejecting mapping update to [elastic] as the final mapping would have more than 1 type: [elastic, xf] in src/addons/XFES/Elasticsearch/Api.php at line 387
XFES\Elasticsearch\Api->request() in src/addons/XFES/Elasticsearch/Api.php at line 287
XFES\Elasticsearch\Api->createIndex() in src/addons/XFES/Service/Optimizer.php at line 85
XFES\Service\Optimizer->optimize() in src/addons/XFES/Admin/Controller/EnhancedSearch.php at line 151
XFES\Admin\Controller\EnhancedSearch->actionOptimize() in src/XF/Mvc/Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 88
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1934
XF\App->run() in src/XF.php at line 333
XF::runApp() in admin.php at line 13
if i want to rebuid search index and checked remove the index
Code:
XFES\Elasticsearch\RequestException: Rejecting mapping update to [elastic] as the final mapping would have more than 1 type: [elastic, xf] in src/addons/XFES/Elasticsearch/Api.php at line 387
XFES\Elasticsearch\Api->request() in src/addons/XFES/Elasticsearch/Api.php at line 287
XFES\Elasticsearch\Api->createIndex() in src/addons/XFES/Service/Optimizer.php at line 85
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 127
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 241
XF\Job\Manager->runJobInternal() in src/XF/Job/Manager.php at line 187
XF\Job\Manager->runJobEntry() in src/XF/Job/Manager.php at line 103
XF\Job\Manager->runByIds() in src/XF/Admin/Controller/Tools.php at line 120
XF\Admin\Controller\Tools->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 88
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1934
XF\App->run() in src/XF.php at line 333
XF::runApp() in admin.php at line 13
when i run
Code:
curl -XGET 'localhost:9200'
it return
Code:
  "name" : "tywki3X",
  "cluster_name" : "elastic",
  "cluster_uuid" : "BpM-rmyfT6OzwObqGJC1gA",
  "version" : {
    "number" : "6.5.4",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "d2ef93d",
    "build_date" : "2018-12-17T21:17:40.758843Z",
    "build_snapshot" : false,
    "lucene_version" : "7.5.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
thank you for your help
 

Biarritz64

Active member
and when i reconfigue in xfes i have this line

Code:
Index name

elastic

This index does not exist yet.
when i run
Code:
 curl -X GET "localhost:9200/_cat/indices?v"
it return
Code:
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
 
Top