{"id":25776106,"url":"https://github.com/allegro/embedded-elasticsearch","last_synced_at":"2026-08-13T04:30:16.975Z","repository":{"id":57742463,"uuid":"66922401","full_name":"allegro/embedded-elasticsearch","owner":"allegro","description":"Tool that ease up creation of integration tests with Elasticsearch","archived":true,"fork":false,"pushed_at":"2020-05-18T05:58:49.000Z","size":27732,"stargazers_count":268,"open_issues_count":28,"forks_count":78,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-02-27T06:06:06.587Z","etag":null,"topics":["elasticsearch","java","testing"],"latest_commit_sha":null,"homepage":"","language":"Java","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/allegro.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}},"created_at":"2016-08-30T08:37:10.000Z","updated_at":"2025-01-03T21:45:30.000Z","dependencies_parsed_at":"2022-09-09T11:20:24.828Z","dependency_job_id":null,"html_url":"https://github.com/allegro/embedded-elasticsearch","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/allegro/embedded-elasticsearch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allegro%2Fembedded-elasticsearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allegro%2Fembedded-elasticsearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allegro%2Fembedded-elasticsearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allegro%2Fembedded-elasticsearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allegro","download_url":"https://codeload.github.com/allegro/embedded-elasticsearch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allegro%2Fembedded-elasticsearch/sbom","scorecard":{"id":185201,"data":{"date":"2025-08-11","repo":{"name":"github.com/allegro/embedded-elasticsearch","commit":"225ad21e1af5191663207ab9504c468910113d3d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":3,"reason":"Found 10/30 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 12 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T19:40:24.808Z","repository_id":57742463,"created_at":"2025-08-16T19:40:24.808Z","updated_at":"2025-08-16T19:40:24.808Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36592705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-08-06T04:43:03.162Z","status":"online","status_checked_at":"2026-08-13T02:00:06.325Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","java","testing"],"created_at":"2025-02-27T06:01:17.951Z","updated_at":"2026-08-13T04:30:16.971Z","avatar_url":"https://github.com/allegro.png","language":"Java","funding_links":[],"categories":["测试"],"sub_categories":[],"readme":"# This project is no longer maintained. We recommend using Testcontainers instead: https://www.testcontainers.org/modules/elasticsearch/\n\n# embedded-elasticsearch\n\n[![Build Status](https://travis-ci.org/allegro/embedded-elasticsearch.svg?branch=master)](https://travis-ci.org/allegro/embedded-elasticsearch)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/pl.allegro.tech/embedded-elasticsearch/badge.svg)](http://central.maven.org/maven2/pl/allegro/tech/embedded-elasticsearch)\n\nSmall utility for creating integration tests that use Elasticsearch. Instead of using `Node` it downloads Elasticsearch in specified version and starts it in a separate process. It also allows you to install required plugins which is not possible when using `NodeBuilder`. Utility was tested with 1.x, 2.x, 5.x and 6.x versions of Elasticsearch.\n\n## Introduction\n\nAll you need to do to use this tool is create `EmbeddedElastic` instance. To do so, use provided builder:\n\n```java\nfinal embeddedElastic = EmbeddedElastic.builder()\n        .withElasticVersion(\"5.0.0\")\n        .withSetting(PopularProperties.TRANSPORT_TCP_PORT, 9350)\n        .withSetting(PopularProperties.CLUSTER_NAME, \"my_cluster\")\n        .withPlugin(\"analysis-stempel\")\n        .withIndex(\"cars\", IndexSettings.builder()\n            .withType(\"car\", getSystemResourceAsStream(\"car-mapping.json\"))\n            .build())\n        .withIndex(\"books\", IndexSettings.builder()\n            .withType(PAPER_BOOK_INDEX_TYPE, getSystemResourceAsStream(\"paper-book-mapping.json\"))\n            .withType(\"audio_book\", getSystemResourceAsStream(\"audio-book-mapping.json\"))\n            .withSettings(getSystemResourceAsStream(\"elastic-settings.json\"))\n            .build())\n        .build()\n        .start()\n```\n\nWhen you are done with creating it, you can start it real simple:\n\n```java\nembeddedElastic.start()\n```\n\nAnd that's all, you can connect to your embedded-elastic instance on specified port and use it in your tests.\n\n## Available builder options\n\n| Method | Description |\n| ------------- | ------------- |\n| `withElasticVersion(String version)` | version of Elasticsearch; based on that version download url to official Elasticsearch repository will be created |\n| `withDownloadUrl(URL downloadUrl)` | if you prefer to download Elasticsearch from a different location than official repositories you can do that using this method |\n| `withInResourceLocation(String inResourcePath)` | you can also have your Elasticsearch package inside resource directory, specify it's location with this option  |\n| `withSetting(String key, Object value)` | setting name and value as in elasticsearch.yml file |\n| `withPlugin(String expression)` | plugin that should be installed into Elasticsearch; treat expression as argument to `./elasticsearch-plugin install \u003cexpression\u003e` command; use multiple times for multiple plugins |\n| `withIndex(String indexName, IndexSettings indexSettings)` | specify index that should be created and managed by EmbeddedElastic |\n| `withTemplate(String templateName, String templateBody)` | specify a template that should be created and managed by EmbeddedElastic |\n| `withStartTimeout(long value, TimeUnit unit)` | specify timeout you give Elasticsearch to start |\n| `withInstallationDirectory(File installationDirectory)` | specify custom installation directory |\n| `withDownloadDirectory(File downloadDirectory)` | specify custom download directory where downloaded distribution packages will be saved |\n| `withCleanInstallationDirectoryOnStop(boolean cleanInstallationDirectoryOnStop)` | specify whether clean the installation directory after Elasticsearch stop |\n| `withEsJavaOpts(String javaOpts)` | value of `ES_JAVA_OPTS` variable to be set for Elasticsearch process |\n| `withJavaHome(JavaHomeOption javaHomeOption)` | select java environment to run in. For available options see below |\n| `getTransportTcpPort()` | get transport tcp port number used by Elasticsearch instance |\n| `getHttpPort()` | get http port number used by Elasticsearch instance |\n| `withDownloadProxy(Proxy proxy)` | proxy that should be used for downloading Elasticsearch package |\n| `withDownloaderConnectionTimeout(long value, TimeUnit unit)` | connection timeout that should be used by downloader |\n| `withDownloaderReadTimeout(long value, TimeUnit unit)` | socket timeout that should be used by downloader |\n\nAvailable `IndexSettings.Builder` options\n\n| Method | Description |\n| ------------- | ------------- |\n| `withType(String type, String mapping)` | specify type and it's mappings |\n| `withSettings(String settings)` | specify index settings |\n\n\nAvailabe `JavaHomeOption` options\n\n| Method | Description |\n| ------------- | ------------- |\n| `useSystem()` | default behavior, lets elasticsearch startup script determine the JRE to run in |\n| `inheritTestSuite()` | use the same JRE as the process starting it |\n| `path(String path)` | manually set the path of the JRE to execute the embedded elastic |\n\n\n## Available operations\n\n`EmbeddedElastic` provides following operations:\n\n| Method | Description |\n| ------------- | ------------- |\n| `start()` | downloads Elasticsearch and specified plugins, setups everything and finally starts your Elasticsearch instance |\n| `stop()` | stops your Elasticsearch instance and removes all data |\n| `index` | index your document, comes with variants that take only document, or document and it's id |\n| `deleteIndex(String indexName)`, `deleteIndices()`  | deletes index with name specified during EmbeddedElastic creation |\n| `createIndex(String indexName)`, `createIndices()` | creates index with name specified during EmbeddedElastic creation; note that this index is created during EmbeddedElastic startup, you will need this method only if you deleted your index using `deleteIndex` method |  \n| `recreateIndex(String indexName)`, `recreateIndices()` | combination of `deleteIndex` and `createIndex` |\n| `refreshIndices()` | refresh index; useful when you make changes in different thread, and want to check results instantly in tests |\n| `deleteTemplate(String templateName)`, `deleteTemplates()`  | deletes a template of the specified name/all templates during EmbeddedElastic creation |\n| `createTemplate(String templateName)`, `createTemplates()` | creates a template with the specified name/all templates during EmbeddedElastic creation; note that this template is created during EmbeddedElastic startup, you will need this method only if you deleted your template using `deleteTemplate` method |  \n| `recreateTemplate(String templateName)`, `recreateTemplates()` | combination of `deleteTemplate` and `createTemplate` |\n\n## Example\nIf you want to see example, look at this spec: `pl.allegro.tech.search.embeddedelasticsearch.EmbeddedElasticSpec`\n\n## Dependency\nTo start using embedded-elasticsearch in your project add it as a test dependency:\n\nGradle:\n\n```groovy\ntestCompile 'pl.allegro.tech:embedded-elasticsearch:2.7.0'\n```\n\nMaven:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003epl.allegro.tech\u003c/groupId\u003e\n    \u003cartifactId\u003eembedded-elasticsearch\u003c/artifactId\u003e\n    \u003cversion\u003e2.7.0\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nSBT:\n\n```\nlibraryDependencies ++= Seq(\"pl.allegro.tech\" % \"embedded-elasticsearch\" % \"2.7.0\" % \"test\")\n```\n\n## Known problems\nIf you build your project on Travis, you may have problems with OOM errors when using default settings. You can change Elasticsearch memory settings using `withEsJavaOpts` method. Example (from spec `pl.allegro.tech.embeddedelasticsearch.EmbeddedElasticSpec`):\n\n```java\n    static EmbeddedElastic embeddedElastic = EmbeddedElastic.builder()\n            .withElasticVersion(ELASTIC_VERSION)\n            .withSetting(TRANSPORT_TCP_PORT, TRANSPORT_TCP_PORT_VALUE)\n            .withSetting(CLUSTER_NAME, CLUSTER_NAME_VALUE)\n            .withEsJavaOpts(\"-Xms128m -Xmx512m\")\n            .withIndex(CARS_INDEX_NAME, CARS_INDEX)\n            .withIndex(BOOKS_INDEX_NAME, BOOKS_INDEX)\n            .withStartTimeout(1, MINUTES)\n            .build()\n            .start()\n```\n\n## Running more then one Elasticsearch instance\n\nThere are cases where you might want to run more than one Elasticsearch instance e.g.:\n- running tests of one project in parallel (e.g. using _gradle --parallel_ or _mvn -T1C_)\n- running tests of different projects on the same physical mashine (e.g. Jenkins jobs running on the same server)\n- running integration tests which require more than one Elasticsearch instance\n\nIn such situations you should use distinct values for following settings for each instance:\n\n- `withSetting(PopularProperties.TRANSPORT_TCP_PORT, ...)`\n- `withSetting(PopularProperties.HTTP_PORT, ...)`\n- `withInstallationDirectory(...)`\n\nWith such configuration *embedded-elasticsearch* will redownload elasticsearch installation package for every distinct\ninstallation directory. To avoid this behavior and reuse downloaded installation package you should\nset common location of downloaded files with `withDownloadDirectory(...)` for every *embedded-elasticsearch* configuration.\n\n## License\n\n*embedded-elasticsearch* is published under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallegro%2Fembedded-elasticsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallegro%2Fembedded-elasticsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallegro%2Fembedded-elasticsearch/lists"}