Elasticsearch/8/Migrate Plugins Extended

1.0.1Last update Aug 20, 2024
by@35c4n0r

This codemod migrates the plugins option to client.extend() calls.

What Changed

Previously, you could pass plugins as an option to the Client constructor. Now, plugins need to be added using the client.extend() method.

Before

const { Client } = require('elasticsearch');
const client = new Client({
node: 'http://localhost:9200',
plugins: ['pluginA', 'pluginB']
});

After

const { Client } = require('@elastic/elasticsearch');
const client = new Client({
node: 'http://localhost:9200'
});
client.extend('pluginA');
client.extend('pluginB');

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now