Elasticsearch/8/Migrate Plugins Extended

/icons/calendar.svg

Last update

Aug 20, 2024

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