Is saveObject action available for use in batch update

I’m doing a batch update and getting an error message about an invalid action in Batch. I’m wondering if saveObject isn’t the right action.

I’ve been staring at the structure and can’t see a problem. Virtually this same structure (minus the deleteBy) works when adding the object the first time with addObject, which works perfectly.

Here is the payload.

[{
	action: 'saveObject',
	indexName: 'rooms',
	body: {
		_geoloc: [Object],
		about: 'About this thing.',
		address: [Object],
		objectID: '-L8huXqIhDGpXOtJJsdW'
	}
}, {
	action: 'deleteBy',
	indexName: 'roomavailability',
	body: {
		filters: 'parentID:-L8huXqIhDGpXOtJJsdW'
	}
}, {
	action: 'addObject',
	indexName: 'roomavailability',
	body: {
		_id: 'rJbdWvY9M',
		from: 1522195200,
		to: 1522799999,
		parentID: '-L8huXqIhDGpXOtJJsdW'
	}
}, {
	action: 'addObject',
	indexName: 'roomavailability',
	body: {
		_id: 'r1H_-vKqz',
		from: 1523923200,
		to: 1524268799,
		parentID: '-L8huXqIhDGpXOtJJsdW'
	}
}]

Here is the error:

AlgoliaSearchError: Invalid action in batch: saveObject near line:1 column:974
    at success (/user_code/node_modules/algoliasearch/src/AlgoliaSearchCore.js:361:32)
    at process._tickDomainCallback (internal/process/next_tick.js:135:7)
  name: 'AlgoliaSearchError',
  message: 'Invalid action in batch: saveObject near line:1 column:974'

And here is how I’m calling the batch update:

return algolia
      .batch(batchUpdatesForAlgolia)
      .then(() => {
        console.log('Firebase object updated in Algolia');
      })
      .catch(error => {
        console.error('Error when indexing and updating object into Algolia', error);
      });

Thanks for taking a look!

Well I solved it. Instead of deleting this I’ll just post the solution here in case someone else hits the same snag.

saveObject and updateObject are the same thing. But Batch only accepts updateObject. I guess if I had been smarter reading the docs I would’ve understood that!