From ee4cc8e7ef8760e53ce78081f9a4604be85fa453 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 5 Jul 2021 13:49:06 +1200 Subject: [PATCH 1/2] Add an aggregation query for organs --- .../map-core-competency-searches.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/sparc-metadata-elasticsearch/map-core-competency-searches.md b/sparc-metadata-elasticsearch/map-core-competency-searches.md index 986f30f..b1dabfa 100644 --- a/sparc-metadata-elasticsearch/map-core-competency-searches.md +++ b/sparc-metadata-elasticsearch/map-core-competency-searches.md @@ -317,3 +317,81 @@ https://scicrunch.org/api/1/elastic/SPARC_PortalDatasets_dev/_search?api_key=### }, ... ``` + +## Get list of organs for species + +This search looks for a dataset by title. + +### POST + +```yaml +https://scicrunch.org/api/1/elastic/SPARC_PortalDatasets_dev/_search?api_key=#### +``` + +### JSON Body Example + +```yaml +{ + "from": 0, + "size": 0, + "query": { + "query_string": { + "fields": [ + "*species.name" + ], + "query": "human" + } + }, + "aggregations": { + "organ": { + "composite": { + "sources": [ + {"id": {"terms": {"field": "anatomy.organ.curie.aggregate"}}}, + {"name": {"terms": {"field": "anatomy.organ.name.aggregate"}}} + ], + "size": 200 + } + } + } +} + +``` + +### Result + +```yaml +{ + "took": 13, + "timed_out": false, + "_shards": { + "total": 2, + "successful": 2, + "skipped": 0, + "failed": 0 + }, + "hits": { + "total": 13, + "max_score": 0.0, + "hits": [] + }, + "aggregations": { + "organ": { + "after_key": { + "id": "uberon:0002048", + "name": "lung" + }, + "buckets": [ + { + "key": { + "id": "uberon:0000945", + "name": "stomach" + }, + "doc_count": 1 + }, + { + "key": { + "id": "uberon:0000948", + "name": "heart" + }, + "doc_count": 1 + }, ... From 5df01297d49f378831c1864c2ad035f4f1ab4778 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 5 Jul 2021 13:50:33 +1200 Subject: [PATCH 2/2] Update map-core-competency-searches.md --- sparc-metadata-elasticsearch/map-core-competency-searches.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sparc-metadata-elasticsearch/map-core-competency-searches.md b/sparc-metadata-elasticsearch/map-core-competency-searches.md index b1dabfa..8e9f0c4 100644 --- a/sparc-metadata-elasticsearch/map-core-competency-searches.md +++ b/sparc-metadata-elasticsearch/map-core-competency-searches.md @@ -318,7 +318,7 @@ https://scicrunch.org/api/1/elastic/SPARC_PortalDatasets_dev/_search?api_key=### ``` -## Get list of organs for species +## Get a list of organs for species This search looks for a dataset by title.