{"id":20703885,"url":"https://github.com/euiyounghwang/go-search_engine","last_synced_at":"2026-04-07T20:31:18.520Z","repository":{"id":213877914,"uuid":"735143238","full_name":"euiyounghwang/go-search_engine","owner":"euiyounghwang","description":"go-search_engine","archived":false,"fork":false,"pushed_at":"2024-02-27T03:08:40.000Z","size":62133,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T04:32:53.905Z","etag":null,"topics":["docker","docker-compose","elasticsearch","gin-framework","goconvey","golang","swagger-ui","unit-test"],"latest_commit_sha":null,"homepage":"","language":"Go","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/euiyounghwang.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":"support-diagnostics-8.0.3/diagnostics.bat","governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-12-23T20:21:51.000Z","updated_at":"2024-02-10T05:11:08.000Z","dependencies_parsed_at":"2024-02-27T04:37:49.375Z","dependency_job_id":null,"html_url":"https://github.com/euiyounghwang/go-search_engine","commit_stats":null,"previous_names":["euiyounghwang/go-search_engine"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/euiyounghwang/go-search_engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euiyounghwang%2Fgo-search_engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euiyounghwang%2Fgo-search_engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euiyounghwang%2Fgo-search_engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euiyounghwang%2Fgo-search_engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/euiyounghwang","download_url":"https://codeload.github.com/euiyounghwang/go-search_engine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euiyounghwang%2Fgo-search_engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31528262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["docker","docker-compose","elasticsearch","gin-framework","goconvey","golang","swagger-ui","unit-test"],"created_at":"2024-11-17T01:10:03.334Z","updated_at":"2026-04-07T20:31:18.479Z","avatar_url":"https://github.com/euiyounghwang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-search_engine\n\n\n#### Go Env\n```bash\nxcode-select --install\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)\"\nbrew install go\ngo env\ngo version\n```\n\n\n#### Run Go\n```bash\ngo mod init go-search_engine\ngo run ./sample/hello.go\ngo build ./sample/hello.go \u0026\u0026 ./sample/hello\n```\n\n\n#### Run Docker with sample\n```bash\ngo get github.com/labstack/echo/v4\ngo get github.com/labstack/echo/v4/middleware\n\ngo mod tidy\n\ngo-search_engine git:(master) ✗ go run ./main.go                             \n\n   ____    __\n  / __/___/ /  ___\n / _// __/ _ \\/ _ \\\n/___/\\__/_//_/\\___/ v4.11.4\nHigh performance, minimalist Go web framework\nhttps://echo.labstack.com\n____________________________________O/_______\n                                    O\\\n⇨ http server started on [::]:9080\n\n\ncurl http://localhost:9080/\ncurl http://localhost:9080/health\n\n{\"time\":\"2023-12-23T14:39:42.970473-06:00\",\"id\":\"\",\"remote_ip\":\"127.0.0.1\",\"host\":\"localhost:9080\",\"method\":\"GET\",\"uri\":\"/\",\"user_agent\":\"curl/7.78.0\",\"status\":200,\"error\":\"\",\"latency\":1875,\"latency_human\":\"1.875µs\",\"bytes_in\":0,\"bytes_out\":13}\n{\"time\":\"2023-12-23T14:40:07.332221-06:00\",\"id\":\"\",\"remote_ip\":\"127.0.0.1\",\"host\":\"localhost:9080\",\"method\":\"GET\",\"uri\":\"/health\",\"user_agent\":\"curl/7.78.0\",\"status\":200,\"error\":\"\",\"latency\":70208,\"latency_human\":\"70.208µs\",\"bytes_in\":0,\"bytes_out\":14}\n```\n\n\n#### Build Swagger\n- Gin is a HTTP web framework (\u003ci\u003ehttps://github.com/gin-gonic/gin\u003c/i\u003e) written in Golang. It features a Martini-like API, but with performance up to 40 times faster than Martini. If you need performance and productivity, you will love Gin.\n- Gin is a high-performance micro-framework that can be used to build web applications and microservices. It makes it simple to build a request handling pipeline from modular, reusable pieces. It does this by allowing you to write middleware that can be plugged into one or more request handlers or groups of request handlers.\n\n```bash\n\n1) \n# https://wookiist.dev/103\n\nexport PATH=$(go env GOPATH)/bin:$PATH\n\n\n# http://localhost:9080/swagger/index.html\n\n$ go get github.com/swaggo/swag/cmd/swag\n$ go get github.com/swaggo/echo-swagger\n\n# https://github.com/swaggo/swag/issues/197\ngo install github.com/swaggo/swag/cmd/swag@latest\n\n$ swag \n\n# or $ swag init -g something.go\n$ swag init \n\n# You can see directory like docs\ndocs\n├── docs.go\n├── swagger.json\n└── swagger.yaml\n\n0 directories, 3 files\n\n\n2) \n\n# https://github.com/swaggo/gin-swagger\n# https://santoshk.dev/posts/2022/how-to-integrate-swagger-ui-in-go-backend-gin-edition/\n# https://dadev.tistory.com/entry/GO-RESTAPI-%EB%AC%B8%EC%84%9C%ED%99%94-%EB%8F%84%EA%B5%AC-Swagger-Gin-Framework-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0\n\n# http://localhost:9081/docs/index.html\n\ngo get -u github.com/swaggo/swag/cmd/swag\n\n$ swag \n# or $ swag init -g something.go\n$ swag init \n\ngo get -u github.com/swaggo/gin-swagger\ngo get -u github.com/swaggo/files\n\ngo mod tidy\n```\n![Alt text](./screenshot/Golang-Swagger-API.png)\n\n\n#### Elasticsearh Cluster Diagnostics (Support by Elasticsearch)\n- The support diagnostic utility is a Java application that can interrogate a running Elasticsearch cluster or Logstash process to obtain data about the state of the cluster at that point in time. It is compatible with all versions of Elasticsearch (including alpha, beta and release candidates), and for Logstash versions greater than 5.0, and for Kibana v6.5+. The release version of the diagnostic is independent of the Elasticsearch, Kibana or Logstash version it is being run against.\n- `Diagnostics Guide` \u003ci\u003e(https://olamideolajide.medium.com/how-to-collect-diagnostics-for-a-cloud-elasticsearch-cluster-4a20841a815a, https://github.com/elastic/support-diagnostics/releases/tag/8.0.3)\u003c/i\u003e\n```bash\npython-elasticsearch git:(master) ✗ ./support-diagnostics-8.0.3/diagnostics.sh --host localhost --port 9209\nUsing /usr/bin/java as Java Runtime\nUsing -Xms256m -Xmx2000m  for options.\nProcessing diagnosticInputs...\n\nCreating temp directory: /Users/euiyoung.hwang/ES/Python_Workspace/python-elasticsearch/local-diagnostics\nConfiguring log file.\nChecking for diagnostic version updates.\nIssue encountered while checking diagnostic version for updates.\nFailed to get current diagnostic version from Github.\nIf Github is not accessible from this environemnt current supported version cannot be confirmed.\nGetting Elasticsearch Version.\nChecking the supplied hostname against the node information retrieved to verify location. This may take some time.\n...\nResults written to: /Users/euiyoung.hwang/ES/Python_Workspace/python-elasticsearch/local-diagnostics/commercial/watcher_stack.json\nResults written to: /Users/euiyoung.hwang/ES/Python_Workspace/python-elasticsearch/local-diagnostics/commercial/xpack.json\nWriting diagnostic manifest.\nClosing logger.\nArchiving diagnostic results.\nArchive: /Users/euiyoung.hwang/ES/Python_Workspace/python-elasticsearch/local-diagnostics-20231215-160457.tar.gz was created\nDeleted directory: /Users/euiyoung.hwang/ES/Python_Workspace/python-elasticsearch/local-diagnostics.\n```\n\n\n#### Go Testing Framework\n\n![Alt text](./screenshot/go_testing_framework.png)\n\nGoConvey(\u003ci\u003ehttps://github.com/smartystreets/goconvey\u003c/i\u003e) supports Go's native testing package. Neither the web UI nor the DSL are required; you can use either one independently.\nDirectly integrates with go test; Fully-automatic web UI (works with native Go tests, too)\n- Directly integrates with go test\n- Fully-automatic web UI (works with native Go tests, too)\n- Huge suite of regression tests\n- Shows test coverage\n- Readable, colorized console output (understandable by any manager, IT or not)\n- Test code generator\n- Desktop notifications (optional)\n- Immediately open problem lines in Sublime Text (some assembly required)\n```bash\ngo get github.com/smartystreets/goconvey\ngo install github.com/smartystreets/goconvey\n\ncd /Users/euiyoung.hwang/go/pkg/mod/github.com/smartystreets/goconvey@v1.8.1\n\ngo-search_engine git:(master) ✗ /Users/euiyoung.hwang/go/bin/goconvey --workDir=$SCRIPTDIR/tests\ngo-search_engine git:(master) ✗ ./go_convey.sh                                                                                              \n2023/12/27 14:07:14 goconvey.go:116: GoConvey server: \n2023/12/27 14:07:14 goconvey.go:121:   version: v1.8.1\n2023/12/27 14:07:14 goconvey.go:122:   host: 127.0.0.1\n2023/12/27 14:07:14 goconvey.go:123:   port: 8080\n...\n```\n- GoConvey : http://127.0.0.1:7090/\n- /Users/euiyoung.hwang/go/bin/goconvey --workDir=$SCRIPTDIR/tests --port=7090\n\n![Alt text](./screenshot/Go-Convey.png)\n\n\n## Docker build\n```\ndocker build \\\n  -f \"$(dirname \"$0\")/Dockerfile\" \\\n  -t go-search_engine-api:es \\\n  --target runtime \\\n  \"$(dirname \"$0\")/.\"\n```\n\n## Docker run\n```\ndocker run --rm -it -d \\\n  --name go-search_engine-api --publish 9077:9081 --expose 9081 \\\n  --network bridge \\\n  -e ES_HOST=http://host.docker.internal:9209 \\\n  -v \"$SCRIPTDIR:/app\" \\\n  go-search_engine-api:es\n```\n\n![Alt text](./screenshot/Docker-go-search-engine.png)\n\n\n#### Unit-Test\n```bash\n go-search_engine git:(master) ✗ ./unit_test.sh\n2024/01/04 22:07:35 Set_Env :  http://localhost:9209\n=== RUN   TestHealthCheckHandler\n\u0026{GET /health HTTP/1.1 1 1 map[Tracing-Id:[123]] {} \u003cnil\u003e 0 [] false example.com map[] map[] \u003cnil\u003e map[] 192.0.2.1:1234 /health \u003cnil\u003e \u003cnil\u003e \u003cnil\u003e \u003cnil\u003e}\n\u0026{200 map[Content-Type:[application/json] Tracing-Id:[123]] {\"alive\": true} false \u003cnil\u003e map[Tracing-Id:[123]] true}\n--- PASS: TestHealthCheckHandler (0.00s)\n=== RUN   TestCreateUser\n=== RUN   TestCreateUser/should_return_200_status_ok\n\u0026{0x1400012e300 0x140000a6420  [] [] map[] 0x102833150 map[] 0x140000dcb40 \u003cnil\u003e {{0 0} 0 0 {{} 0} {{} 0}}}\n--- PASS: TestCreateUser (0.00s)\n    --- PASS: TestCreateUser/should_return_200_status_ok (0.00s)\n=== RUN   Test_elasticsearch_instance_status\n2024/01/04 22:07:35 [200 OK] {\n  \"name\" : \"b3abf1a35c5e\",\n  \"cluster_name\" : \"docker-cluster\",\n  \"cluster_uuid\" : \"jOgcAwsGR0OXuS-C-x-Ung\",\n  \"version\" : {\n    \"number\" : \"8.8.0\",\n    \"build_flavor\" : \"default\",\n    \"build_type\" : \"docker\",\n    \"build_hash\" : \"c01029875a091076ed42cdb3a41c10b1a9a5a20f\",\n    \"build_date\" : \"2023-05-23T17:16:07.179039820Z\",\n    \"build_snapshot\" : false,\n    \"lucene_version\" : \"9.6.0\",\n    \"minimum_wire_compatibility_version\" : \"7.17.0\",\n    \"minimum_index_compatibility_version\" : \"7.0.0\"\n  },\n  \"tagline\" : \"You Know, for Search\"\n}\n\n--- PASS: Test_elasticsearch_instance_status (0.00s)\n=== RUN   Test_elasticsearch_configuration_to_local\n2024/01/04 22:07:35 [200 OK] \n2024/01/04 22:07:35 [200 OK] \n2024/01/04 22:07:35 try_create_index - {\n    \"acknowledged\": true,\n    \"shards_acknowledged\": true,\n    \"index\": \"test_ngram_v1\"\n}\n2024/01/04 22:07:35 ioUtil  \n2024/01/04 22:07:35 res.Body type -  *http.gzipReader\n2024/01/04 22:07:35 body type -  []uint8\n2024/01/04 22:07:35 Uint8_to_Map type -  map[string]interface {}\n2024/01/04 22:07:35 Json : map[acknowledged:%!s(bool=true) index:test_ngram_v1 shards_acknowledged:%!s(bool=true)], parsing : test_ngram_v1, %!s(bool=true)\n2024/01/04 22:07:35 try_create_index - {\n    \"acknowledged\": true,\n    \"shards_acknowledged\": true,\n    \"index\": \"test_performance_metrics_v1\"\n}\n2024/01/04 22:07:35 ioUtil  \n2024/01/04 22:07:35 res.Body type -  *http.gzipReader\n2024/01/04 22:07:35 body type -  []uint8\n2024/01/04 22:07:35 Uint8_to_Map type -  map[string]interface {}\n2024/01/04 22:07:35 Json : map[acknowledged:%!s(bool=true) index:test_performance_metrics_v1 shards_acknowledged:%!s(bool=true)], parsing : test_performance_metrics_v1, %!s(bool=true)\n2024/01/04 22:07:35 [200 OK] {\"acknowledged\":true}\n2024/01/04 22:07:35 Index_with_document - {\n    \"_index\": \"test_performance_metrics_v1\",\n    \"_id\": \"111\",\n    \"_version\": 1,\n    \"result\": \"created\",\n    \"forced_refresh\": true,\n    \"_shards\": {\n        \"total\": 1,\n        \"successful\": 1,\n        \"failed\": 0\n    },\n    \"_seq_no\": 0,\n    \"_primary_term\": 1\n}\n--- PASS: Test_elasticsearch_configuration_to_local (0.21s)\n=== RUN   Test_elasticsearch_api\n2024/01/04 22:07:35 Test_elasticsearch_api  [200 OK] {\"_index\":\"test_performance_metrics_v1\",\"_id\":\"111\",\"_version\":1,\"_seq_no\":0,\"_primary_term\":1,\"found\":true,\"_source\":{\n                                \"title\" :  \"performance\",\n                                \"elapsed_time\": 0.3,\n                                \"sequence\": 1,\n                                \"entity_type\": \"performance\",\n                                \"env\" :  \"dev\",\n                                \"concurrent_users\" :  \"20\",\n                                \"search_index\" :  \"test_performance_metrics_v1\",\n                                \"@timestamp\" : \"2023-01-01 00:00:00\"\n                                }} *http.gzipReader\n2024/01/04 22:07:35 response_map : map[_id:111 _index:test_performance_metrics_v1 _primary_term:%!s(float64=1) _seq_no:%!s(float64=0) _source:map[@timestamp:2023-01-01 00:00:00 concurrent_users:20 elapsed_time:%!s(float64=0.3) entity_type:performance env:dev search_index:test_performance_metrics_v1 sequence:%!s(float64=1) title:performance] _version:%!s(float64=1) found:%!s(bool=true)]\n--- PASS: Test_elasticsearch_api (0.00s)\n=== RUN   Test_elasticsearch_search\n2024/01/04 22:07:35 [200 OK] {\n  \"took\" : 0,\n  \"timed_out\" : false,\n  \"_shards\" : {\n    \"total\" : 1,\n    \"successful\" : 1,\n    \"skipped\" : 0,\n    \"failed\" : 0\n  },\n  \"hits\" : {\n    \"total\" : {\n      \"value\" : 1,\n      \"relation\" : \"eq\"\n    },\n    \"max_score\" : 1.0,\n    \"hits\" : [\n      {\n        \"_index\" : \"test_performance_metrics_v1\",\n        \"_id\" : \"111\",\n        \"_score\" : 1.0,\n        \"_source\" : {\n          \"title\" : \"performance\",\n          \"elapsed_time\" : 0.3,\n          \"sequence\" : 1,\n          \"entity_type\" : \"performance\",\n          \"env\" : \"dev\",\n          \"concurrent_users\" : \"20\",\n          \"search_index\" : \"test_performance_metrics_v1\",\n          \"@timestamp\" : \"2023-01-01 00:00:00\"\n        }\n      }\n    ]\n  }\n}\n\n2024/01/04 22:07:35 [200 OK] 1 hits; took: 0ms\n#$%% map[@timestamp:2023-01-01 00:00:00 concurrent_users:20 elapsed_time:0.3 entity_type:performance env:dev search_index:test_performance_metrics_v1 sequence:1 title:performance]\n#$%% test_performance_metrics_v1\nsimple test k 0 v map[_id:111 _index:test_performance_metrics_v1 _score:1 _source:map[@timestamp:2023-01-01 00:00:00 concurrent_users:20 elapsed_time:0.3 entity_type:performance env:dev search_index:test_performance_metrics_v1 sequence:1 title:performance]]\n--- PASS: Test_elasticsearch_search (0.00s)\n=== RUN   Test_Get_Env\n2024/01/04 22:07:35 Set_Env :  http://localhost:9209\n--- PASS: Test_Get_Env (0.00s)\n=== RUN   Test_PrettyJSon\n{\"track_total_hits\" : true,\"query\": {\"match_all\" : {}},\"size\": 2}\n--- PASS: Test_PrettyJSon (0.00s)\nPASS\nok      github.com/euiyounghwang/go-search_engine/tests 0.341s\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuiyounghwang%2Fgo-search_engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feuiyounghwang%2Fgo-search_engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuiyounghwang%2Fgo-search_engine/lists"}