collectiveaccess / providence

Cataloguing and data/media management application
GNU General Public License v3.0
295 stars 168 forks source link

Error with ElasticSearch Bulk Delete on Develop Branch (ES <= 6) #1351

Open psdantonio opened 2 years ago

psdantonio commented 2 years ago

Note: I recently upgraded to ES 6.8, and moved to the latest develop branch last week. But also had this issue when I was on ES 5.

Whenever attempting to save records with certain empty attributes, the app would throw a "type is missing" error from the ElasticSearch plugin. The fix (for me) was to add '_type' into the $va_bulk_params array. I'm assuming this affects anyone using ES < 7.

Below starts at line 589 in /app/lib/Plugins/SearchEngine/ElasticSearch.php. I added '_type' into the array. // delete docs foreach(self::$delete_buffer as $table => $va_rows) { foreach(array_unique($va_rows) as $vn_row_id) { $va_bulk_params['body'][] = array( 'delete' => array( '_index' => $this->getIndexName($table), '_id' => $vn_row_id, '_type' => '_doc' ) );

collectiveaccess commented 2 years ago

We have been made aware of a number of problems with ES support in 6.x and 7.x. We are intending to refactor this code soon (in the next three months).