Golang API that returns search results from Elasticsearch.
go 1.13.5^
Elasticsearch v7.5.1^
Requires an config yaml in conf
.
For instance:
Path: /conf/local.yml
elasticsearch:
endpoint: http://localhost:9200
password: changeme
username: elastic
appsearch:
endpoint: http://localhost:3002
api: /api/as/v1/
token: private-pq7aaoSDFapSADosdnfns
server:
port: 8080
readHeaderTimeoutMillis: 3000
To run locally: go run $(go list github.com/wambozi/elastic-search-api/... | grep -v /vendor/)
To test locally: make test-local
Example: http://localhost:8080/healthcheck
- returns the HTTP statusCode of the API. i.e.
200, 403, 502
Example: http://localhost:8080/search?q=r2d2&i=droids
{
"Total": {
"value": 1,
"relation": "eq"
},
"max_score": 0.2876821,
"hits": [
{
"_index": "droids",
"_type": "_doc",
"_id": "1234",
"_score": 0.2876821,
"Source": {
"Name": "R2D2",
"Species": "Robot"
}
}
]
}
Docker Hub: https://hub.docker.com/repository/docker/wambozi/elastic-search-api
To run:
docker run --rm -it -p 8080:8080 wambozi/elastic-search-api:latest
- Adam Bemiller
- Adam provided most of the high level project and server/routes framework for this project. Huge thanks to him!
MIT License