
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
dsl-builder
Advanced tools
A library extracted from OpenSearch Dashboard for Query DSL conversion. This package provides core functionality for OpenSearch/Elasticsearch query builder.
Version Compatibility: This library is extracted from OpenSearch-Dashboards version 3.1.0 (as of 2025.7.20) and maintains compatibility with that version's query DSL structure and features.
Module Support: This package supports both CommonJS and ES Module imports for maximum compatibility.
npm install dsl-builder
yarn add dsl-builder
const { buildOpenSearchQuery } = require('dsl-builder');
import { buildOpenSearchQuery } from 'dsl-builder';
// ES Module import
import { buildOpenSearchQuery } from 'dsl-builder';
// CommonJS import
// const { buildOpenSearchQuery } = require('dsl-builder');
const indexPattern = {
title: 'logs-*',
fields: [
{ name: 'status', type: 'string' },
{ name: 'response_time', type: 'number' },
{ name: '@timestamp', type: 'date' }
]
};
// Convert KQL query to OpenSearch DSL
const dsl = buildOpenSearchQuery(indexPattern, [
{
query: 'status:error AND response_time:>500',
language: 'kuery'
}
]);
console.log(JSON.stringify(dsl, null, 2));
Converts query objects to OpenSearch DSL.
function buildOpenSearchQuery(
indexPattern: IndexPattern,
queries: Query[],
filters: Filter[] = [],
config: QueryState = {}
): OpenSearchQuery
src/
├── index_patterns/ # Index pattern related functionality
│ ├── fields/ # Field types and mapping
│ ├── index_patterns/ # Index pattern service
│ ├── lib/ # Utility library
│ └── errors/ # Error handling
├── opensearch_query/ # Query DSL conversion
│ ├── kuery/ # KQL parser and converter
│ ├── filters/ # Filter processing
│ └── opensearch_query/ # Main query builder
├── query/ # Query types and interfaces
├── osd_field_types/ # Field type system
└── utils/ # Common utilities
# Run tests
npm test
# Test watch mode
npm run test:watch
# TypeScript compilation
npm run build
# Prepare for deployment
npm run prepare
This project was extracted from the src/plugins/data/common/index_patterns
module of OpenSearch Dashboard.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
This library was extracted from the OpenSearch Dashboard project. Thanks to the OpenSearch community.
FAQs
OpenSearch Query Builder - Extract from OpenSearch Dashboards
The npm package dsl-builder receives a total of 1 weekly downloads. As such, dsl-builder popularity was classified as not popular.
We found that dsl-builder 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.