search_api_elasticsearch icon indicating copy to clipboard operation
search_api_elasticsearch copied to clipboard

Validation Failed: 1: type is missing

Open agilmore opened this issue 7 years ago • 0 comments

Hi, was getting this error when trying to indexing content: Elastica\Exception\ResponseException: Validation Failed: 1: type is missing; in Elastica\Transport\Http->exec() (line 172 of drupal/sites/all/vendor/ruflin/elastica/lib/Elastica/Transport/Http.php).

The following change fixed it for me:

diff --git a/includes/SearchApiElasticsearchIndex.inc b/includes/SearchApiElasticsearchIndex.inc
index 204dae1..0bf56b7 100644
--- a/includes/SearchApiElasticsearchIndex.inc
+++ b/includes/SearchApiElasticsearchIndex.inc
@@ -143,7 +143,8 @@ class SearchApiElasticsearchIndex {
       $documents[] = new Document($id);
     }
     $index = $this->getRealIndex();
-    $index->deleteDocuments($documents);
+    $type = $index->getType($this->search_api_index->machine_name);
+    $type->deleteDocuments($documents);
   }

agilmore avatar Mar 13 '17 11:03 agilmore