You should configure it in the body of the API call, as documented here :)
But how do I add in npm package configuration, This is my code :
const elasticsearch = require('elasticsearch')
const client = new elasticsearch.Client({ host: { host, port } })
await client.indices.create({ index })
As you can see in the docs, you just need to pass the body to the API method.
client.indices.create({
index: 'my-index',
body: {
settings: {
index: {
number_of_shards: 1,
number_of_replicas: 1
}
}
}
}, console.log)
Thanks