{"id":29595650,"url":"https://github.com/snetsystems/dsl-builder","last_synced_at":"2026-02-08T01:32:11.836Z","repository":{"id":301125101,"uuid":"1008226508","full_name":"snetsystems/dsl-builder","owner":"snetsystems","description":"This module is what convert from KQL or Lucene language to DSL.","archived":false,"fork":false,"pushed_at":"2025-09-10T00:48:12.000Z","size":207,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-10T04:02:27.995Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snetsystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-25T08:12:36.000Z","updated_at":"2025-09-10T00:48:18.000Z","dependencies_parsed_at":"2025-09-10T02:19:46.996Z","dependency_job_id":"151ebc15-3b04-42f4-a9dd-539be261d2d7","html_url":"https://github.com/snetsystems/dsl-builder","commit_stats":null,"previous_names":["snetsystems/dsl-builder"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/snetsystems/dsl-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snetsystems%2Fdsl-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snetsystems%2Fdsl-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snetsystems%2Fdsl-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snetsystems%2Fdsl-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snetsystems","download_url":"https://codeload.github.com/snetsystems/dsl-builder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snetsystems%2Fdsl-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29216084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T00:10:47.190Z","status":"ssl_error","status_checked_at":"2026-02-08T00:10:43.589Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-20T08:40:21.478Z","updated_at":"2026-02-08T01:32:11.831Z","avatar_url":"https://github.com/snetsystems.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenSearch Query Builder\n\nA library extracted from OpenSearch Dashboard for Query DSL conversion. This package provides core functionality for OpenSearch/Elasticsearch query builder.\n\n**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.\n\n**Module Support:** This package supports both CommonJS and ES Module imports for maximum compatibility.\n\n## 📦 Installation\n\n```bash\nnpm install dsl-builder\n```\n\n```bash\nyarn add dsl-builder\n```\n\n## 🚀 Key Features\n\n### Query DSL Conversion\n- KQL (Kibana Query Language) parsing and conversion\n- Filter query creation and management\n- OpenSearch/Elasticsearch query DSL generation\n\n### Field Type System\n- Support for various field types (string, number, date, geo, etc.)\n- Specialized query processing for each field type\n\n### Module Support\n- **CommonJS**: `const { buildOpenSearchQuery } = require('dsl-builder');`\n- **ES Modules**: `import { buildOpenSearchQuery } from 'dsl-builder';`\n\n## 📖 Usage\n\n### KQL Query Conversion\n\n```typescript\n// ES Module import\nimport { buildOpenSearchQuery } from 'dsl-builder';\n\n// CommonJS import\n// const { buildOpenSearchQuery } = require('dsl-builder');\n\nconst indexPattern = {\n  title: 'logs-*',\n  fields: [\n    { name: 'status', type: 'string' },\n    { name: 'response_time', type: 'number' },\n    { name: '@timestamp', type: 'date' }\n  ]\n};\n\n// Convert KQL query to OpenSearch DSL\nconst dsl = buildOpenSearchQuery(indexPattern, [\n  {\n    query: 'status:error AND response_time:\u003e500',\n    language: 'kuery'\n  }\n]);\n\nconsole.log(JSON.stringify(dsl, null, 2));\n```\n\n## 🔧 API Reference\n\n### buildOpenSearchQuery\n\nConverts query objects to OpenSearch DSL.\n\n```typescript\nfunction buildOpenSearchQuery(\n  indexPattern: IndexPattern,\n  queries: Query[],\n  filters: Filter[] = [],\n  config: QueryState = {}\n): OpenSearchQuery\n```\n\n## 📁 Project Structure\n\n```\nsrc/\n├── index_patterns/          # Index pattern related functionality\n│   ├── fields/             # Field types and mapping\n│   ├── index_patterns/     # Index pattern service\n│   ├── lib/               # Utility library\n│   └── errors/            # Error handling\n├── opensearch_query/       # Query DSL conversion\n│   ├── kuery/             # KQL parser and converter\n│   ├── filters/           # Filter processing\n│   └── opensearch_query/  # Main query builder\n├── query/                 # Query types and interfaces\n├── osd_field_types/       # Field type system\n└── utils/                 # Common utilities\n```\n\n## 🧪 Testing\n\n```bash\n# Run tests\nnpm test\n\n# Test watch mode\nnpm run test:watch\n```\n\n## 📦 Build\n\n```bash\n# TypeScript compilation\nnpm run build\n\n# Prepare for deployment\nnpm run prepare\n```\n\n## 🤝 Contributing\n\nThis project was extracted from the `src/plugins/data/common/index_patterns` module of OpenSearch Dashboard. \n\n## 📄 License\n\nThis project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\nThis library was extracted from the OpenSearch Dashboard project. Thanks to the OpenSearch community.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnetsystems%2Fdsl-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnetsystems%2Fdsl-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnetsystems%2Fdsl-builder/lists"}