{"id":15044620,"url":"https://github.com/elastic/workplace-search-node","last_synced_at":"2025-10-19T21:30:34.696Z","repository":{"id":40400749,"uuid":"95803367","full_name":"elastic/workplace-search-node","owner":"elastic","description":"Elastic Workplace Search Official Node.js Client","archived":false,"fork":false,"pushed_at":"2024-08-08T11:19:43.000Z","size":90,"stargazers_count":8,"open_issues_count":0,"forks_count":8,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-02-03T09:35:43.350Z","etag":null,"topics":["api-client","elastic","elastic-enterprise-search","elastic-workplace-search","javascript","node","node-client","search","swiftype"],"latest_commit_sha":null,"homepage":"https://www.elastic.co/workplace-search","language":"JavaScript","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/elastic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-06-29T17:39:11.000Z","updated_at":"2022-09-28T08:49:10.000Z","dependencies_parsed_at":"2024-09-25T01:54:09.425Z","dependency_job_id":"cd01d2e7-96e6-4a2c-9cef-0b4b05f4f1f9","html_url":"https://github.com/elastic/workplace-search-node","commit_stats":{"total_commits":42,"total_committers":9,"mean_commits":4.666666666666667,"dds":0.5476190476190477,"last_synced_commit":"cdf2dd0a511b552eabcc2e014f7d940cdd79bf2b"},"previous_names":["elastic/enterprise-search-node","swiftype/swiftype-enterprise-node"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fworkplace-search-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fworkplace-search-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fworkplace-search-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastic%2Fworkplace-search-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elastic","download_url":"https://codeload.github.com/elastic/workplace-search-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237215747,"owners_count":19273550,"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":["api-client","elastic","elastic-enterprise-search","elastic-workplace-search","javascript","node","node-client","search","swiftype"],"created_at":"2024-09-24T20:50:48.849Z","updated_at":"2025-10-19T21:30:29.143Z","avatar_url":"https://github.com/elastic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e **⚠️ This client is deprecated ⚠️**\n\u003e\n\u003e As of Enterprise Search version 8.2.0, we are directing users to the new [Enterprise Search Node Client](https://github.com/elastic/enterprise-search-js) and\n\u003e deprecating this client.\n\u003e\n\u003e Our development effort on this project will be limited to bug fixes.\n\u003e All future enhancements will be focused on the Enterprise Search Node Client.\n\u003e\n\u003e Thank you! - Elastic\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://circleci.com/gh/elastic/workplace-search-node\"\u003e\u003cimg src=\"https://circleci.com/gh/elastic/workplace-search-node.svg?style=svg\" alt=\"CircleCI build\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n\u003e A first-party Node.js client for [Elastic Workplace Search](https://www.elastic.co/workplace-search).\n\n## Contents\n\n- [Getting started](#getting-started-)\n- [Usage](#usage)\n- [FAQ](#faq-)\n- [Contribute](#contribute-)\n- [License](#license-)\n\n---\n\n## Getting started 🐣\n\nWith npm:\n\n```bash\nnpm install @elastic/workplace-search-node\n```\n\nor clone locally:\n\n```bash\ngit clone git@github.com:elastic/workplace-search-node.git\ncd workplace-search-node\nnpm install\n```\n\n## Usage\n\nCreate a new instance of the Elastic Workplace Search Client with your access token:\n\n```javascript\nconst WorkplaceSearchClient = require('@elastic/workplace-search-node')\nconst accessToken = '' // your access token\nconst client = new WorkplaceSearchClient(accessToken)\n```\n\n### Change API endpoint\n\n```javascript\nconst client = new WorkplaceSearchClient(\n  accessToken,\n  'https://your-server.example.com/api/ws/v1'\n)\n```\n\n### Indexing Documents\n\nThis example shows how to use the indexDocuments method:\n\n```javascript\nconst contentSourceKey = '' // your content source key\nconst documents = [\n  {\n    id: 1234,\n    title: '5 Tips On Finding A Mentor',\n    body:\n      'The difference between a budding entrepreneur who merely shows promise and one who is already enjoying some success often comes down to mentoring.',\n    url: 'https://www.shopify.com/content/5-tips-on-finding-a-mentor'\n  },\n  {\n    id: 1235,\n    title: 'How to Profit from Your Passions',\n    body:\n      'Want to know the secret to starting a successful business? Find a void and fill it.',\n    url: 'https://www.shopify.com/content/how-to-profit-from-your-passions'\n  }\n]\n\nclient\n  .indexDocuments(contentSourceKey, documents)\n  .then(results =\u003e {\n    // handle results\n  })\n  .catch(error =\u003e {\n    // handle error\n  })\n```\n\n### Destroying Documents\n\n```javascript\nconst contentSourceKey = '' // your content source key\nconst documentIds = [1234, 1235]\n\nclient\n  .destroyDocuments(contentSourceKey, documentIds)\n  .then(destroyDocumentsResults =\u003e {\n    // handle destroy documents results\n  })\n  .catch(error =\u003e {\n    // handle error\n  })\n```\n\n### Listing all permissions\n\n```javascript\nconst contentSourceKey = '' // your content source key\nconst pageParams = { currentPage: 2, pageSize: 20 } // optional argument\n\nclient\n  .listAllPermissions(contentSourceKey, pageParams)\n  .then(response =\u003e {\n    // handle response\n  })\n  .catch(error =\u003e {\n    // handle error\n  })\n```\n\n### Getting user permissions\n\n```javascript\nconst contentSourceKey = '' // your content source key\nconst user = 'enterprise_search' // username\n\nclient\n  .getUserPermissions(contentSourceKey, user)\n  .then(response =\u003e {\n    // handle response\n  })\n  .catch(error =\u003e {\n    // handle error\n  })\n```\n\n### Updating user permissions\n\n```javascript\nconst contentSourceKey = '' // your content source key\nconst user = 'enterprise_search' // username\nconst permissions = { permissions: ['permission1', 'permission2'] } // permissions to assign to the user\n\nclient\n  .updateUserPermissions(contentSourceKey, user, permissions)\n  .then(response =\u003e {\n    // handle response\n  })\n  .catch(error =\u003e {\n    // handle error\n  })\n```\n\n### Adding user permissions\n\n```javascript\nconst contentSourceKey = '' // your content source key\nconst user = 'enterprise_search' // username\nconst permissions = { permissions: ['permission2'] } // permissions to add to the user\n\nclient\n  .addUserPermissions(contentSourceKey, user, permissions)\n  .then(response =\u003e {\n    // handle response\n  })\n  .catch(error =\u003e {\n    // handle error\n  })\n```\n\n### Remove user permissions\n\n```javascript\nconst contentSourceKey = '' // your content source key\nconst user = 'enterprise_search' // username\nconst permissions = { permissions: ['permission2'] } //permissions to remove from the user\n\nclient\n  .removeUserPermissions(contentSourceKey, user, permissions)\n  .then(response =\u003e {\n    // handle response\n  })\n  .catch(error =\u003e {\n    // handle error\n  })\n```\n\n## Running tests\n\nRun tests via npm:\n\n```bash\n$ npm test\n```\n\n## FAQ 🔮\n\n### Where do I report issues with the client?\n\nIf something is not working as expected, please open an [issue](https://github.com/elastic/workplace-search-node/issues/new).\n\n## Contribute 🚀\n\nWe welcome contributors to the project. Before you begin, a couple notes...\n\n- Before opening a pull request, please create an issue to [discuss the scope of your proposal](https://github.com/elastic/workplace-search-node/issues).\n- Please write simple code and concise documentation, when appropriate.\n\n## License 📗\n\n[Apache 2.0](https://github.com/elastic/workplace-search-node/blob/master/LICENSE.txt) © [Elastic](https://github.com/elastic)\n\nThank you to all the [contributors](https://github.com/elastic/workplace-search-node/graphs/contributors)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastic%2Fworkplace-search-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felastic%2Fworkplace-search-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastic%2Fworkplace-search-node/lists"}