VeggieMeat / search_api_elasticsearch

Clone of project at drupal.org/project/search_api_elasticsearch for better CI options than what D.O offers
16 stars 8 forks source link

Validation Failed: 1: type is missing #95

Open agilmore opened 7 years ago

agilmore commented 7 years ago

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);
   }