{"id":20170236,"url":"https://github.com/fabrix-app/spool-elasticsearch","last_synced_at":"2026-05-15T07:03:40.916Z","repository":{"id":48031460,"uuid":"145611934","full_name":"fabrix-app/spool-elasticsearch","owner":"fabrix-app","description":"Spool: Elasticsearch implementation for Fabrix","archived":false,"fork":false,"pushed_at":"2022-12-30T17:48:57.000Z","size":296,"stargazers_count":2,"open_issues_count":7,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-13T15:27:11.947Z","etag":null,"topics":["elasticsearch","fabrix","nodejs","spools","typescript"],"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/fabrix-app.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-21T19:46:40.000Z","updated_at":"2019-11-01T23:23:04.000Z","dependencies_parsed_at":"2023-01-31T12:25:19.170Z","dependency_job_id":null,"html_url":"https://github.com/fabrix-app/spool-elasticsearch","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrix-app%2Fspool-elasticsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrix-app%2Fspool-elasticsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrix-app%2Fspool-elasticsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabrix-app%2Fspool-elasticsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabrix-app","download_url":"https://codeload.github.com/fabrix-app/spool-elasticsearch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241605820,"owners_count":19989612,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","fabrix","nodejs","spools","typescript"],"created_at":"2024-11-14T01:17:47.602Z","updated_at":"2026-05-15T07:03:35.898Z","avatar_url":"https://github.com/fabrix-app.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spool-elasticsearch\n:package: Elasticsearch Spool [https://www.elastic.co/products/elasticsearch](https://www.elastic.co/products/elasticsearch)\n\n[![Gitter][gitter-image]][gitter-url]\n[![NPM version][npm-image]][npm-url]\n[![Build Status][ci-image]][ci-url]\n[![Test Coverage][coverage-image]][coverage-url]\n[![Dependency Status][daviddm-image]][daviddm-url]\n[![Follow @FabrixApp on Twitter][twitter-image]][twitter-url]\n\nProvides a simple integration with elasticsearch\n\n## Usage\n\n###Configure\n\n```js\n// config/main.ts\nimport { ElasticsearchSpool } from '@fabirx/spool-elasticsearch'\nexport const main = {\n\n  // ...\n  spools: [\n    ElasticsearchSpool\n  ]  \n}\n```\n\n### Configure connection\n\nConfiguration file for Elasticsearch spool is: `config/elasticsearch.ts`\nOtherwise you could use `config/env/{env}.ts` files with `elasticsearch` property\n\n```js\n\n// config/elasticsearch.ts\n\nexport const elasticsearch = {\n\n  connection: {\n    // List of hosts for elastic cluster\n    // hosts: [],\n\n    // One elastic instance host\n    host: 'localhost:9200',\n    // Log level\n    log: 'trace'\n  },\n\n  // Will validate if elastic connection is alive on Fabrix app start\n  validateConnection: true\n}\n```\n\n### Using Elasticsearch API\n\nThis spool creates an app propertry with elasticseach client. `app.elasticClient`\nSo you could use it whatever you want\n\n```js\n// api/controller/SomeController.ts\n\nexport class SomeController extends Controller {\n\n  someAction (request, reply) {\n    // Perform an action\n    this.app.elasticClient\n      .search({\n        q: 'something'\n      })\n      .then(function (body) {\n        const hits = body.hits.hits;\n      }, function (error) {\n        console.trace(error.message);\n      })\n  }\n}\n```\n\nMore information about Elasticsearch client could be found here: [Elasticsearch-js](https://github.com/elastic/elasticsearch-js)\n\n## License\n[MIT](https://github.com/fabrix-app/spool-elasticsearch/blob/master/LICENSE)\n\n\n\n[npm-image]: https://img.shields.io/npm/v/@fabrix/spool-elasticsearch.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@fabrix/spool-elasticsearch\n[ci-image]: https://img.shields.io/circleci/project/github/fabrix-app/spool-elasticsearch/master.svg\n[ci-url]: https://circleci.com/gh/fabrix-app/spool-elasticsearch/tree/master\n[daviddm-image]: http://img.shields.io/david/fabrix-app/spool-elasticsearch.svg?style=flat-square\n[daviddm-url]: https://david-dm.org/fabrix-app/spool-elasticsearch\n[gitter-image]: http://img.shields.io/badge/+%20GITTER-JOIN%20CHAT%20%E2%86%92-1DCE73.svg?style=flat-square\n[gitter-url]: https://gitter.im/fabrix-app/fabrix\n[twitter-image]: https://img.shields.io/twitter/follow/FabrixApp.svg?style=social\n[twitter-url]: https://twitter.com/FabrixApp\n[coverage-image]: https://img.shields.io/codeclimate/coverage/github/fabrix-app/spool-elasticsearch.svg?style=flat-square\n[coverage-url]: https://codeclimate.com/github/fabrix-app/spool-elasticsearch/coverage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabrix-app%2Fspool-elasticsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabrix-app%2Fspool-elasticsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabrix-app%2Fspool-elasticsearch/lists"}