
Product
Introducing Supply Chain Attack Campaigns Tracking in the Socket Dashboard
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.
@cortec/opensearch
Advanced tools
@cortec/opensearch provides a wrapper for managing connections to OpenSearch clusters. It supports multiple client instances, configuration via code or environment, and secure connections using CA certificates. The module is designed for use in service-oriented architectures and integrates with the Cortec context and lifecycle.
Where to put config:
Place your Opensearch config in config/default.yml (or your environment-specific config file).
Schema:
opensearch:
main:
connection:
user: 'admin' # Username for authentication (required)
password: 'secret' # Password for authentication (required)
host: 'opensearch.example.com' # Hostname of the OpenSearch node (required)
port: 9200 # Port number (required)
caFile: '/etc/ssl/certs/opensearch-ca.pem' # Optional path to CA certificate file for SSL
analytics:
connection:
user: 'readonly'
password: 'readonlypass'
host: 'analytics.example.com'
port: 9200
Field-by-field explanation:
opensearch: Root key for Opensearch config.main, analytics: Identity/name for each client (can be any string).connection: Connection options for each client.
user: Username for authentication.password: Password for authentication.host: Hostname or IP address of the OpenSearch node.port: Port number for the OpenSearch node.caFile: (Optional) Path to CA certificate file for SSL connections.How config is loaded:
The config is loaded automatically by the @cortec/config module and validated at runtime.
Access it in code via:
const config = ctx.provide<IConfig>('config');
const opensearchConfig = config?.get<any>('opensearch');
If config is missing or invalid, an error is thrown at startup.
Example YAML configuration:
opensearch:
main:
connection:
user: 'admin'
password: 'secret'
host: 'opensearch.example.com'
port: 9200
caFile: '/etc/ssl/certs/opensearch-ca.pem'
analytics:
connection:
user: 'readonly'
password: 'readonlypass'
host: 'analytics.example.com'
port: 9200
import { Opensearch } from '@cortec/opensearch';
// Instantiate the module (usually handled by Cortec context)
const opensearch = new Opensearch();
// After context.load()...
const client = opensearch.client('main');
// Use the OpenSearch client as per the official API
const result = await client.search({
index: 'my-index',
body: {
query: {
match: { title: 'example' },
},
},
});
console.log(result.body.hits.hits);
client.ping()zodclient(identity: string): Client
Returns the OpenSearch client for the given identity. Throws if not found or not enabled.For more details, see the source code in src/index.ts or the OpenSearch JS client documentation.
FAQs
Opensearch module for Cortec
We found that @cortec/opensearch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.

Security News
Node.js 25.4.0 makes require(esm) stable, formalizing CommonJS and ESM compatibility across supported Node versions.