{"id":13650073,"url":"https://github.com/dimitrov-adrian/directus-extension-searchsync","last_synced_at":"2026-01-12T11:53:00.598Z","repository":{"id":37497969,"uuid":"330154555","full_name":"dimitrov-adrian/directus-extension-searchsync","owner":"dimitrov-adrian","description":"Simple Directus 9 extension that sync content with remote search engine.","archived":false,"fork":false,"pushed_at":"2024-02-07T19:16:12.000Z","size":81,"stargazers_count":113,"open_issues_count":13,"forks_count":25,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-04-25T08:20:18.171Z","etag":null,"topics":["algolia","directus","directus-extension","elasticsearch","meilisearch"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/dimitrov-adrian.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}},"created_at":"2021-01-16T12:10:49.000Z","updated_at":"2024-03-19T15:53:06.000Z","dependencies_parsed_at":"2024-04-14T16:58:38.077Z","dependency_job_id":"daff9183-a25d-4c12-a504-b3f5d21cdd34","html_url":"https://github.com/dimitrov-adrian/directus-extension-searchsync","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimitrov-adrian%2Fdirectus-extension-searchsync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimitrov-adrian%2Fdirectus-extension-searchsync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimitrov-adrian%2Fdirectus-extension-searchsync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimitrov-adrian%2Fdirectus-extension-searchsync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimitrov-adrian","download_url":"https://codeload.github.com/dimitrov-adrian/directus-extension-searchsync/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223903038,"owners_count":17222480,"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":["algolia","directus","directus-extension","elasticsearch","meilisearch"],"created_at":"2024-08-02T02:00:33.385Z","updated_at":"2026-01-12T11:53:00.584Z","avatar_url":"https://github.com/dimitrov-adrian.png","language":"JavaScript","funding_links":[],"categories":["Extensions"],"sub_categories":["Community"],"readme":"# Simple search engine indexer\n\n## Supported engines\n\n- MeiliSearch\n- ElasticSearch\n- Algolia\n\n## How to install\n\nIn your Directus installation root\n\n```\nnpm install dimitrov-adrian/directus-extension-searchsync\n```\n\nor yarn\n\n```\nyarn add https://github.com/dimitrov-adrian/directus-extension-searchsync\n```\n\nRestart directus\n\n## CLI Commands\n\nUsage: `npx directus extension:searchsync \u003csubdommand\u003e`\n\nSubcommands:\n\n- `index` - Reindex all documents from configuration\n\n## Configuration\n\nThe extension uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig#cosmiconfig) for configuration loader with\n`searchsync` block or if `EXTENSION_SEARCHSYNC_CONFIG_PATH` is set will try to use the file.\n\nSo, configuration should comes from one of next files:\n\n- package.json `\"searchsync\":{...}`\n- .searchsyncrc\n- .searchsyncrc.json\n- .searchsyncrc.yaml\n- .searchsyncrc.yml\n- .searchsyncrc.js\n- .searchsyncrc.cjs\n- searchsync.config.js\n- searchsync.config.cjs\n\n### Environment variables\n\n### References\n\n- `server: object` Holds configuration for the search engine\n- `batchLimit: number` Batch limit when performing index/reindex (defaults to 100)\n- `reindexOnStart: boolean` Performs full reindex of all documents upon Directus starts\n- `collections: object` Indexing data definition\n- `collections.\u003ccollection\u003e.filter: object` The filter query in format like Directus on which item must match to be\n  indexed (check [Filter Rules ](https://docs.directus.io/reference/filter-rules/#filter-rules))\n- `collections.\u003ccollection\u003e.fields: array\u003cstring\u003e` Fields that will be indexed in Directus format\n- `collections.\u003ccollection\u003e.transform: function` (Could be defined only if config file is .js) A callback to return\n  transformed/formatted data for indexing.\n- `collections.\u003ccollection\u003e.indexName: string` Force collection name when storing in search index\n- `collections.\u003ccollection\u003e.collectionField: string` If set, such field with value of the collection name will be added\n  to the indexed document. Useful with conjuction with the _indexName_ option\n\n### Examples\n\n#### `.searchsyncrc.json`\n\n```json\n{\n\t\"server\": {\n\t\t\"type\": \"meilisearch\",\n\t\t\"host\": \"http://search:7700/myindex\",\n\t\t\"key\": \"the-private-key\"\n\t},\n\t\"batchLimit\": 100,\n\t\"reindexOnStart\": false,\n\t\"collections\": {\n\t\t\"products\": {\n\t\t\t\"filter\": {\n\t\t\t\t\"status\": \"published\",\n\t\t\t\t\"stock\": \"inStock\"\n\t\t\t},\n\t\t\t\"fields\": [\"title\", \"image.id\", \"category.title\", \"brand.title\", \"tags\", \"description\", \"price\", \"rating\"]\n\t\t},\n\t\t\"posts\": {\n\t\t\t\"indexName\": \"blog_posts\",\n\t\t\t\"collectionField\": \"_collection\",\n\n\t\t\t\"filter\": {\n\t\t\t\t\"status\": \"published\"\n\t\t\t},\n\t\t\t\"fields\": [\"title\", \"teaser\", \"body\", \"thumbnail.id\"]\n\t\t}\n\t}\n}\n```\n\n#### `.searchsyncrc.js`\n\n```javascript\nconst config = {\n\tserver: {\n\t\ttype: 'meilisearch',\n\t\thost: 'http://search:7700',\n\t\tkey: 'the-private-key',\n\t},\n\treindexOnStart: false,\n\tbatchLimit: 100,\n\tcollections: {\n\t\tpages: {\n\t\t\tfilter: {\n\t\t\t\tstatus: 'published',\n\t\t\t},\n\t\t\tfields: ['title', 'teaser', 'body', 'thumbnail.id'],\n\t\t\ttransform: (item, { flattenObject, striptags }) =\u003e {\n\t\t\t\treturn {\n\t\t\t\t\t...flattenObject(item),\n\t\t\t\t\tbody: striptags(item.body),\n\t\t\t\t\tsomeCustomValue: 'Hello World!',\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t},\n};\n\n// Use as object.\nmodule.exports = config;\n```\n\n##### Collection transformation callback description\n\n```javascript\n/**\n * @param {Object} item\n * @param {{striptags, flattenObject, objectMap}} utils\n * @param {String} collectionName\n * @returns {Object}\n */\nfunction (item, { striptags, flattenObject, objectMap }, collectionName) {\n\treturn item\n}\n```\n\n#### Search engines config references\n\n##### Meilisearch\n\n```json\n{\n\t\"type\": \"meilisearch\",\n\t\"host\": \"http://search:7700\",\n\t\"key\": \"the-private-key\"\n}\n```\n\n##### Algolia\n\n```json\n{\n\t\"type\": \"algolia\",\n\t\"appId\": \"Application-Id\",\n\t\"key\": \"secret-api-key\"\n}\n```\n\n##### ElasticSearch\n\nNew typeless behaviour, use collection names as index name.\n\n```json\n{\n\t\"type\": \"elasticsearch\",\n\t\"host\": \"http://search:9200/\"\n}\n```\n\nUse Authentification.\n\n```json\n{\n\t\"type\": \"elasticsearch\",\n\t\"host\": \"http://search:9200/\",\n\t\"username\": \"elastic\",\n\t\"password\": \"somepassword\"\n}\n```\n\nIgnore ssl-certificate-error.\n\n```json\n{\n\t\"type\": \"elasticsearch\",\n\t\"host\": \"http://search:9200/\",\n\t\"ignore_cert\": true,\n}\n```\n\n##### ElasticSearch for 5.x and 6.x\n\nOld type behaviour, use collection names as types.\n\n```json\n{\n\t\"type\": \"elasticsearch_legacy\",\n\t\"host\": \"http://search:9200/projectindex\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimitrov-adrian%2Fdirectus-extension-searchsync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimitrov-adrian%2Fdirectus-extension-searchsync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimitrov-adrian%2Fdirectus-extension-searchsync/lists"}