Hi,
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: npmjs.com
Error:
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: 'http://xx.xxx.xxx.xx//elasticsearch',
protocol: 'http',
apiVersion,
httpAuth:'user:xxxxxxxxxxxxx',
plugins: [ deleteByQuery ],
log: 'error'
});
return esClient.deleteByQuery({
index: 'products',
body: {
query: {
term: { product_name: 'test1' }
}
}
}, function (error, response) {
console.trace(error);
});