NASA-PDS / registry-api

Web API service for the PDS Registry, providing the implementation of the PDS Search API (https://github.com/nasa-pds/pds-api) for the PDS Registry.
https://nasa-pds.github.io/pds-api
Apache License 2.0
2 stars 5 forks source link

As an API user, I want to know the Collection(s) for a given Product. #451

Closed jordanpadams closed 3 years ago

jordanpadams commented 3 years ago

For more information on how to populate this new feature request, see the PDS Wiki on User Story Development:

https://github.com/NASA-PDS/nasa-pds.github.io/wiki/Issue-Tracking#user-story-development

Motivation

...so that I can know all collections a product is referenced by

Additional Details

Notional API Design:

GET /products/{lidvid}/collections

See https://github.com/NASA-PDS/registry/issues/109 and https://github.com/NASA-PDS/registry/issues/108 for how the registry ingests primary and secondary products.

Acceptance Criteria

Given I have a product LID OR LIDVID When I perform an API query by that LIDVID for its collections Then I expect the API to return the primary collection (there should be only 1) AND any secondary collections (could be many) the product belongs to

Sub-tasks

NOTE: This is now done by /products/{identifier}/member-of

tloubrieu-jpl commented 3 years ago

@al-niessner I have just tested this elasticsearch request to get the collection lidvid of a product: { "query": { "match": { "product_lidvid": "urn:nasa:pds:izenberg_pdart14_meap:data_eetable:ele_evt_12hr_orbit_2011-2012::1.0" } }, "size": 0, "aggs": { "collection_lidvid": { "terms": { "field": "collection_lidvid" } } } }

The curl command is: curl --location --request GET 'http://localhost:9200/registry-refs/_search' \ --header 'Content-Type: application/json' \ --data-raw '{ "query": { "match": { "product_lidvid": "urn:nasa:pds:izenberg_pdart14_meap:data_eetable:ele_evt_12hr_orbit_2011-2012::1.0" } }, "size": 0, "aggs": { "collection_lidvid": { "terms": { "field": "collection_lidvid" } } } }'

@tdddblog also showed interesting requests earlier to get the latest lidvid from a lid directly from elasticsearch.