From 7f353cffd942e548a42fd1d71476c6327fc49ff7 Mon Sep 17 00:00:00 2001 From: Joep Meindertsma Date: Wed, 29 May 2019 16:06:02 +0200 Subject: [PATCH] Improve docs --- README.md | 6 +- elastic.http | 188 ------------------------------------------ example_requests.http | 142 +++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+), 189 deletions(-) delete mode 100644 elastic.http create mode 100644 example_requests.http diff --git a/README.md b/README.md index 8b20d35..663d386 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,14 @@ Semaphore tracks the master branch and deploys succesful builds to a public [doc ## Architecture -The [front-end](/front) is a typescript react application that uses [reactiveserach](https://github.com/appbaseio/reactivesearch) for elasticsearch and [link-redux] for linked data (RDF) rendering. +The [front-end](/front) is a typescript react application that uses [reactiveserach](https://github.com/appbaseio/reactivesearch) for elasticsearch and [link-redux](https://github.com/fletcher91/link-redux) for linked data (RDF) rendering. The [server](/server) is a node express application that serves as both a static file server and a proxy that forward elasticsearch queries to the elastic endpoint of open raadsinformatie. +## Using the ORI API + +Check out the `example_requests.http` file for API usage. + ## Credits - [VNG Realisatie](https://vngrealisatie.nl) for funding. diff --git a/elastic.http b/elastic.http deleted file mode 100644 index 6ddf6d1..0000000 --- a/elastic.http +++ /dev/null @@ -1,188 +0,0 @@ -# simple_query_string -# ~90ms - -POST https://api.openraadsinformatie.nl/v1/elastic/ori_*/_search? HTTP/1.1 -content-type: application/json - -{ - "query": { - "simple_query_string": { - "fields": ["text", "title", "description", "name"], - "default_operator": "or", - "query": "impressie keuzen schets" - } - }, - "highlight": { - "pre_tags": [ - "" - ], - "post_tags": [ - "" - ], - "fields": { - "text": {}, - "title": {}, - "name": {}, - "description": {} - }, - "fragment_size": 100, - "number_of_fragments": 3 - }, - "size": 10, - "_source": { - "includes": [ - "*" - ], - "excludes": [] - }, - "from": 0, - "sort": [ - { - "_score": { - "order": "desc" - } - } - ] -} - -# multi_match with bools -# ~200ms -POST https://api.openraadsinformatie.nl/v1/elastic/ori_*/_search? HTTP/1.1 -content-type: application/json - -{ - "query": { - "bool": { - "must": [ - { - "bool": { - "must": [ - { - "bool": { - "should": [ - { - "multi_match": { - "query": "impressie keuzen schets", - "fields": [ - "text", - "title", - "description", - "name" - ], - "type": "best_fields", - "operator": "or", - "fuzziness": 0 - } - }, - { - "multi_match": { - "query": "impressie keuzen schets", - "fields": [ - "text", - "title", - "description", - "name" - ], - "type": "phrase_prefix", - "operator": "or" - } - } - ], - "minimum_should_match": "1" - } - } - ] - } - } - ] - } - }, - "highlight": { - "pre_tags": [ - "" - ], - "post_tags": [ - "" - ], - "fields": { - "text": {}, - "title": {}, - "name": {}, - "description": {} - }, - "fragment_size": 100, - "number_of_fragments": 3 - }, - "size": 10, - "_source": { - "includes": [ - "*" - ], - "excludes": [] - }, - "from": 0, - "sort": [ - { - "_score": { - "order": "desc" - } - } - ] -} - -# ORI API N-Quads - -GET https://id.openraadsinformatie.nl/44477 HTTP/1.1 -content-type: application/n-quads - -# ES search in municipality using terms filter - -GET http://ori.argu.co/api/ori_*/_search? HTTP/1.1 -content-type: application/json - -{ - "query": { - "bool": { - "must": [ - [ - { - "simple_query_string": { - "fields": [ - "text", - "title", - "description", - "name" - ], - "default_operator": "or", - "query": "zoeken" - } - } - ], - { - "terms": { - "_index": [ - "ori_alkmaar_20190507105200" - ] - } - } - ] - } - }, - "size": 10 -} - -# ES single Municipality using index in URL - -GET http://ori.argu.co/api/ori_alkmaar_20190507105200/_search? HTTP/1.1 -content-type: application/json - -{ - "query": { - "simple_query_string": { - "fields": ["text", "title", "description", "name"], - "default_operator": "or", - "query": "zoek" - } - }, - "size": 10 -} diff --git a/example_requests.http b/example_requests.http new file mode 100644 index 0000000..2fb8b71 --- /dev/null +++ b/example_requests.http @@ -0,0 +1,142 @@ +### ORI API Get Resource as N-Quads + +GET https://id.openraadsinformatie.nl/44477 HTTP/1.1 +content-type: application/n-quads + +### ORI API Get Resource as Turtle + +GET https://id.openraadsinformatie.nl/44477 HTTP/1.1 +content-type: text/turtle + +### Elastic simple request + +POST https://api.openraadsinformatie.nl/v1/elastic/ori_*/_search? HTTP/1.1 +content-type: application/json + +{ + "query": { + "simple_query_string": { + "fields": ["text", "title", "description", "name"], + "default_operator": "or", + "query": "zoek" + } + }, + "size": 10, + "_source": { + "includes": [ + "*" + ], + "excludes": [] + }, + "from": 0, + "sort": [ + { + "_score": { + "order": "desc" + } + } + ] +} + +### ES - Filter Municipality using terms + +GET http://ori.argu.co/api/ori_*/_search? HTTP/1.1 +content-type: application/json + +{ + "query": { + "bool": { + "must": [ + [ + { + "simple_query_string": { + "fields": [ + "text", + "title", + "description", + "name" + ], + "default_operator": "or", + "query": "zoeken" + } + } + ], + { + "terms": { + "_index": [ + "ori_alkmaar_20190507105200" + ] + } + } + ] + } + }, + "size": 10 +} + +### ES - single Municipality using index with wildcard in URL + +GET http://ori.argu.co/api/ori_alkmaar_*/_search? HTTP/1.1 +content-type: application/json + +{ + "query": { + "simple_query_string": { + "fields": ["text", "title", "description", "name"], + "default_operator": "or", + "query": "zoek" + } + }, + "size": 10 +} + +### ES - filter by date + +POST https://api.openraadsinformatie.nl/v1/elastic/ori_*/_search? HTTP/1.1 +content-type: application/json + +{ + "query": { + "bool": { + "must": [ + [ + { + "simple_query_string": { + "fields": [ + "text", + "title", + "description", + "name" + ], + "default_operator": "or", + "query": "zoek" + } + } + ], + { + "range": { + "date_modified": { + "gte": "2019-01-01", + "lte": "2019-05-24" + } + } + } + ] + } + }, + "size": 10, + "_source": { + "includes": [ + "*" + ], + "excludes": [] + }, + "from": 0, + "sort": [ + { + "_score": { + "order": "desc" + } + } + ] +}