Aggregates all document information relevant for your platform.
./gradlew build -x test
(Note: If you want to run the tests, you need Docker)elasticsearch
java -jar build/libs/pivio-server-1.1.0.jar
http://localhost:9123/{document|changeset}
(see below)./gradlew build
docker-compose up
- this will run Elasticsearch and pivio-server as Docker containershttp://localhost:9123/{document|changeset}
(see below)If you need to rebuild the Docker images (e.g. when you patched the sources) run:
./gradlew [clean] build
docker-compose up [-d] --build
bin/elasticsearch-start.sh
The container can be stopped via bin/elasticsearch-stop.sh
.
curl -H 'Content-Type: application/json' -X POST http://localhost:9123/document -d '{
"id": "JustSomeId",
"name": "Awesome Microservice",
"type": "service",
"owner": "lambda",
"description": "Simple microservice"
}'
curl -H 'Content-Type: application/json' -X GET http://localhost:9123/document/JustSomeId
Everytime document is changed a new changeset will be generated.
curl -H 'Content-Type: application/json' -X GET http://localhost:9123/changeset
curl -H 'Content-Type: application/json' -X GET http://localhost:9123/changeset?since=7d
curl -H 'Content-Type: application/json' -X GET http://localhost:9123/changeset?since=4w
curl -H 'Content-Type: application/json' -X GET http://localhost:9123/document/JustSomeId/changeset
curl -H 'Content-Type: application/json' -X GET http://localhost:9123/document/JustSomeId/changeset?since=7d
For searching, a query
URL parameter can be passed (see examples below). Its value is a JSON string that needs to be URL encoded.
That is, at least the following JSON characters need to be replaced:
{
needs to be replaced by %7B
"
needs to be replaced by %22
:
needs to be replaced by %3A
}
needs to be replaced by %7D
curl -H 'Content-Type: application/json' -X GET 'http://localhost:9123/document?query={"match":{"owner":"lambda"}}&fields=talks_to'
Encoded:
curl -H 'Content-Type: application/json' -X GET 'http://localhost:9123/document?query=%7B%22match%22%3A%7B%22owner%22%3A%22lambda%22%7D%7D'
curl -H 'Content-Type: application/json' -X GET 'http://localhost:9123/document?query={"match":{"owner":"lambda"}}&fields=talks_to'
Encoded:
curl -H 'Content-Type: application/json' -X GET 'http://localhost:9123/document?query=%7B%22match%22%3A%7B%22owner%22%3A%22lambda%22%7D%7D&fields=talks_to'
curl -H 'Content-Type: application/json' -X GET 'http://localhost:9123/document?query={"match":{"owner":"lambda"}}&sort=lastUpdate:asc'
Encoded:
curl -H 'Content-Type: application/json' -X GET 'http://localhost:9123/document?query=%7B%22match%22%3A%7B%22owner%22%3A%22lambda%22%7D%7D&sort=lastUpdate:asc'
You can sort descending with desc instead of asc. You can also sort by multiple fields, just truncate them via comma. Order is important in this case, e.g. lastUpdate:asc,owner:desc would first sort ascending by field lastUpdate and afterwards descending by field owner if two entries have same lastUpdate value.
You can use the whole query types of Elasticsearch Search API (Search API Documentation).