Problem/Motivation

Every so often, but not consistently, I go to /admin/config/search/search-api/index/MY_INDEX and index my content, and it fails with "An error occurred". In /admin/reports/dblog I see this:

#0 /path/to/web/modules/contrib/elasticsearch_connector/src/SearchAPI/BackendClient.php(222): Drupal\elasticsearch_connector\SearchAPI\BackendClient->updateFieldMapping()
#1 /path/to/web/modules/contrib/elasticsearch_connector/src/SearchAPI/BackendClient.php(270): Drupal\elasticsearch_connector\SearchAPI\BackendClient->addIndex()
#2 /path/to/web/modules/contrib/elasticsearch_connector/src/Plugin/search_api/backend/ElasticSearchBackend.php(476): Drupal\elasticsearch_connector\SearchAPI\BackendClient->clearIndex()
#3 /path/to/web/modules/contrib/search_api/src/Task/ServerTaskManager.php(157): Drupal\elasticsearch_connector\Plugin\search_api\backend\ElasticSearchBackend->deleteAllIndexItems()
#4 /path/to/web/modules/contrib/search_api/src/Task/ServerTaskManager.php(93): Drupal\search_api\Task\ServerTaskManager->executeTask()
#5 /path/to/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\search_api\Task\ServerTaskManager->processEvent()
#6 /path/to/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::{closure:Symfony\Component\EventDispatcher\EventDispatcher::optimizeListeners():241}()
#7 /path/to/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
#8 /path/to/web/modules/contrib/search_api/src/Task/TaskManager.php(181): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
#9 /path/to/web/modules/contrib/search_api/src/Task/TaskManager.php(233): Drupal\search_api\Task\TaskManager->executeSpecificTask()
#10 /path/to/web/modules/contrib/search_api/src/Task/ServerTaskManager.php(73): Drupal\search_api\Task\TaskManager->executeAllTasks()
#11 /path/to/web/modules/contrib/search_api/src/Entity/Server.php(409): Drupal\search_api\Task\ServerTaskManager->execute()
#12 /path/to/web/modules/contrib/search_api/src/Entity/Index.php(1118): Drupal\search_api\Entity\Server->indexItems()
#13 /path/to/web/modules/contrib/search_api/src/Entity/Index.php(1047): Drupal\search_api\Entity\Index->indexSpecificItems()
#14 /path/to/web/modules/contrib/search_api/src/IndexBatchHelper.php(195): Drupal\search_api\Entity\Index->indexItems()
#15 /path/to/web/core/includes/batch.inc(298): Drupal\search_api\IndexBatchHelper::process()
#16 /path/to/web/core/includes/batch.inc(139): _batch_process()
#17 /path/to/web/core/includes/batch.inc(95): _batch_do()
#18 /path/to/web/core/modules/system/src/Controller/BatchController.php(52): _batch_page()
#19 [internal function]: Drupal\system\Controller\BatchController->batchPage()
#20 /path/to/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#21 /path/to/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}()
#22 /path/to/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#23 /path/to/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#24 /path/to/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}()
#25 /path/to/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#26 /path/to/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#27 /path/to/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#28 /path/to/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#29 /path/to/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\Core\StackMiddleware\ContentLength->handle()
#30 /path/to/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#31 /path/to/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#32 /path/to/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#33 /path/to/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#34 /path/to/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#35 /path/to/web/core/lib/Drupal/Core/DrupalKernel.php(715): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#36 /path/to/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#37 {main}

As this is not consistent, I am wondering if anyone has any suggestions for next steps to debug this. Is this an Elasticsearch issue? Could more information be available on Drupal? We cannot find any logs on Elasticsearch and it works fine half the time.

Steps to reproduce

This is not reproducible consistently.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

alberto56 created an issue. See original summary.

alberto56’s picture

Status: Active » Fixed

I found the answer: I enabled detailed logging which is in the server (not the index) -- and although this gave me some indication, it is the elasticsearch logs which provided the answer: "exception: can't merge a non-nested mapping [field_x] with a nested mapping".

Based on the above, I will close this issue

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.