{"id":16410221,"url":"https://github.com/perkss/clojure-elasticsearch-examples","last_synced_at":"2026-04-30T20:31:58.472Z","repository":{"id":107101058,"uuid":"197964744","full_name":"perkss/clojure-elasticsearch-examples","owner":"perkss","description":"Clojure ElasticSearch examples using Rest Java API Interop and Testcontainers","archived":false,"fork":false,"pushed_at":"2020-03-22T11:32:23.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-06T00:06:12.673Z","etag":null,"topics":["clojure","clojure-elasticsearch","docker-image","elasticsearch","jest","kafka","testcontainers","testcontainers-junit-jupiter"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perkss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-07-20T17:56:34.000Z","updated_at":"2020-03-22T11:32:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"a10f2acb-935c-4e00-a400-4d32bebd48cc","html_url":"https://github.com/perkss/clojure-elasticsearch-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/perkss/clojure-elasticsearch-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perkss%2Fclojure-elasticsearch-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perkss%2Fclojure-elasticsearch-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perkss%2Fclojure-elasticsearch-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perkss%2Fclojure-elasticsearch-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perkss","download_url":"https://codeload.github.com/perkss/clojure-elasticsearch-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perkss%2Fclojure-elasticsearch-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32476682,"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":["clojure","clojure-elasticsearch","docker-image","elasticsearch","jest","kafka","testcontainers","testcontainers-junit-jupiter"],"created_at":"2024-10-11T06:23:33.123Z","updated_at":"2026-04-30T20:31:58.453Z","avatar_url":"https://github.com/perkss.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clojure-elasticsearch-examples\n\nA Clojure project showing how to use the Elastic Search API. \nFun times!!\n\n## Getting Started\nNow using `docker-compose` we can start and expose elastic search on port `9200` and also start `kibana` and navigate to \nits UI at `http://localhost:5601`.\n\nBy running the command in the root directory `docker-compose up -d`\n\nIf you have errors please check the logs `docker-compose logs` or `docker logs [container-id]`, I saw `exit code 78` and \nhad to increase the `docker daemons` memory size. \n\n## Building our app into a Docker image\n\nNow lets get ready to build our docker image by building an uberjar first and then creating a docker image from our \n`DockerFile`. This `DockerFile` is fancy as it will create our `Uberjar` and then build our docker image. \n\n    $ docker build -t elasticsearch-example .\n\nNow its going to run the image we just created with the tag name `elasticsearch-example`\n\n    $ docker run -it elasticsearch-example \n    \n## Running Test Containers\n\n[Testcontainers](https://www.testcontainers.org/) make it easy to run tests which use Docker containers. In this example we can \nsimply run `lein test` and as long as Docker instance is running then it will fire up Elasticsearch and run our applicaiton test \nagainst it. Simple.\n\n## Rest High Level Client Tutorial\n\nCreate the RestHighLevelClient in Clojure using Java interop.\n```clojure\n(defn rest-client ^RestHighLevelClient\n  ([^String host ^Integer port] (rest-client host port \"http\"))\n  ([^String host ^Integer port ^String scheme]\n   (-\u003e (RestHighLevelClient. (RestClient/builder (into-array HttpHost [(HttpHost. host port scheme)]))))))\n```\n\nCreate a IndexRequest document to be indexed by the rest client.\n```clojure\n(requests/index-request index \"2\" (json/write-str\n                                                      {:user      \"perkss\"\n                                                       :post-date (t/format (tick/now))\n                                                       :message   \"Clojure and Elasticsearch\"}))\n```\n\nFunction defined to execute the document IndexRequest\n```clojure\n(defn execute ^IndexResponse\n  [^RestHighLevelClient client\n   ^IndexRequest request\n   ^RequestOptions request-options]\n  (.index client request request-options))\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperkss%2Fclojure-elasticsearch-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperkss%2Fclojure-elasticsearch-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperkss%2Fclojure-elasticsearch-examples/lists"}