Error when using the delete-by-query plugin for Elasticsearch on Bitnami


I am working on Firebase along with Elasticsearch and I am getting the error below when I try to delete an index from Elasticsearch using delete-by-query. The index creation works well using a cloud function so the connection should be ok.

Is deleteByQuery somehow not supported by Elasticsearch on bitnami?

Documentation about the deletebyquery:


Trace: { Error: Incorrect HTTP method for uri [/products/_query] and method [DELETE], allowed: [POST]
    at respond (/user_code/node_modules/elasticsearch/src/lib/transport.js:307:15)
    at checkRespForFailure (/user_code/node_modules/elasticsearch/src/lib/transport.js:266:7)
    at HttpConnector.<anonymous> (/user_code/node_modules/elasticsearch/src/lib/connectors/http.js:159:7)
    at IncomingMessage.bound (/user_code/node_modules/elasticsearch/node_modules/lodash/dist/lodash.js:729:21)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)
  status: 405,
  displayName: 'MethodNotAllowed',

Code executed:

const apiVersion = '6.x';
const esClient = new elasticsearch.Client({
	host: '',
	protocol: 'http',
	plugins: [ deleteByQuery ],
	log: 'error'
return esClient.deleteByQuery({
index: 'products',
  body: {
	query: {
		term: { product_name: 'test1' }
}, function (error, response) {

I don't know but I thought it is worth noticing that delete by query moved from a plugin to an actual feature. May be the client you are using has not been updated?

I spent several days on this issue and you just solved it with your very helpful answer.

Thanks a lot

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.