{"id":19185941,"url":"https://github.com/beameryedge/querycraft-to-elasticsearch","last_synced_at":"2026-05-01T00:31:41.139Z","repository":{"id":65478430,"uuid":"113174312","full_name":"BeameryEdge/queryCraft-to-elasticsearch","owner":"BeameryEdge","description":"Converts a QueryCraft Filter Builder object into an Elasticsearch query","archived":false,"fork":false,"pushed_at":"2024-09-05T16:57:41.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T13:53:04.877Z","etag":null,"topics":["elasticsearch","querycraft","querycraft-filter-builder"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BeameryEdge.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}},"created_at":"2017-12-05T11:36:56.000Z","updated_at":"2021-11-10T20:13:16.000Z","dependencies_parsed_at":"2024-11-09T11:12:44.572Z","dependency_job_id":"28e77e62-845a-4c4b-aa2f-0a2b8702b546","html_url":"https://github.com/BeameryEdge/queryCraft-to-elasticsearch","commit_stats":null,"previous_names":["beameryhq/querycraft-to-elasticsearch"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/BeameryEdge/queryCraft-to-elasticsearch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeameryEdge%2FqueryCraft-to-elasticsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeameryEdge%2FqueryCraft-to-elasticsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeameryEdge%2FqueryCraft-to-elasticsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeameryEdge%2FqueryCraft-to-elasticsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeameryEdge","download_url":"https://codeload.github.com/BeameryEdge/queryCraft-to-elasticsearch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeameryEdge%2FqueryCraft-to-elasticsearch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32481553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: 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":["elasticsearch","querycraft","querycraft-filter-builder"],"created_at":"2024-11-09T11:12:33.807Z","updated_at":"2026-05-01T00:31:41.112Z","avatar_url":"https://github.com/BeameryEdge.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QueryCraft-To-Elasticsearch\nConverts a [QueryCraft](https://github.com/BeameryHQ/QueryCraft) Filter Builder object into the body of an Elasticsearch query.\n\n\n[![NPM](https://nodei.co/npm/querycraft-to-elasticsearch.png)](https://npmjs.org/package/querycraft-to-elasticsearch)\n\n[![npm version](https://badge.fury.io/js/querycraft-to-elasticsearch.svg)](https://badge.fury.io/js/querycraft-to-elasticsearch)\n[![CircleCI](https://circleci.com/gh/BeameryHQ/QueryCraft-To-Elasticsearch.svg?style=shield)](https://circleci.com/gh/BeameryHQ/QueryCraft-To-Elasticsearch)\n[![codecov](https://codecov.io/gh/BeameryHQ/QueryCraft-To-Elasticsearch/branch/master/graph/badge.svg)](https://codecov.io/gh/BeameryHQ/QueryCraft-To-Elasticsearch)\n[![David deps](https://david-dm.org/BeameryHQ/QueryCraft-To-Elasticsearch.svg)](https://david-dm.org/BeameryHQ/QueryCraft-To-Elasticsearch)\n[![Known Vulnerabilities](https://snyk.io/test/github/beameryhq/querycraft-to-elasticsearch/badge.svg)](https://snyk.io/test/github/beameryhq/querycraft-to-elasticsearch)\n\n## Installation\n\n```sh\nnpm install --save 'querycraft-to-elasticsearch'\n```\n\n## Examples\n\nSuppose we have a collection of data that satisfies the interface\n\n```ts\ninterface Contact {\n    id: string\n    'list': { id: string }[]\n    firstName: string\n    lastName: string\n    email: string\n    createdAt: Date\n    customFields: { id: string, value: number }[]\n    assignedTo?: string\n}\n```\n\nIf we want a query the describes the logic:-\n```\n    first 50 items where\n        fistName is bob\n        lastName is doyle OR is not set\n        assignedTo is anything\n        list has an item where id is item1\n    sorted (in ascending order) by the value property of the customField where id is custom1\n    created less than 5 days ago\n```\n\nWe can build build it as easily as:-\n\n```ts\nimport { FilterBuilder, eq, lt, neq, any, find, where } from 'querycraft'\nimport toElastic from 'querycraft-to-elasticsearch'\nimport { Client } from 'elasticsearch'\n\nconst client = new Client({ host: 'http://localhost:9200/'})\n        \nasync function getContacts(filter: FilterBuilder){\n    const result = await client.search({\n        explain: true,\n        index: testIndexName,\n        body: toElastic(filter, fieldIdMapFn)\n    })\n\n    return  result.hits.hits.map(prop('_source')) as Contact[]\n    // -\u003e filtered list of contacts\n}\n\nconst filter = new FilterBuilder()\n.where('firstName', eq('bob'))\n.where('list', find(where('id', eq('item1'))))\n.where('lastName', any([\n    eq('doyle'),\n    eq(null)\n]))\n.where('createdAt', lt({ daysAgo: 5 }))\n.where('assignedTo', neq(null))\n.setSortFieldId('customFields', 'custom1', 'value')\n.setSortDirection('ASC')\n.setLimit(50)\n\ngetContacts(filter)\n.then(console.log)\n// -\u003e filtered list of contacts\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeameryedge%2Fquerycraft-to-elasticsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeameryedge%2Fquerycraft-to-elasticsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeameryedge%2Fquerycraft-to-elasticsearch/lists"}