USNVC Examples
This document shows some basic query examples for using the USNVC API
Sample queries
Default USNVC search
Searches 'Scientific Name', 'Colloquial Name', 'Translated Name', 'Synonomy', 'Floristics', 'Concept Type' and 'Database Code' for 'forest'
{ "multi_match":{ "query":"forest", "fields":[ "data.Overview.Scientific Name", "data.Overview.Colloquial Name", "data.Overview.Translated Name", "data.Synonymy.Synonymy", "data.Vegetatioin.Floristics", "data.Overview.Type Concept", "data.Identifiers.Database Code" ] }}
Single field searches
A query will find all items with a Database Code of 'CEGL006190'
{ "match": { "data.Identifiers.Database Code": "CEGL006190" }}
To find all items with a given parent_id
{ "match": { "data.Hierarchy.parent_id":"871069" }}
Match query documentation: https://www.elastic.co/guide/en/elasticsearch/reference/6.8/query-dsl-match-query.html
Multi field searches
This query searches the Conservation Status Rank, or Description for G1G2
{ "multi_match":{ "query":"G1G2", "fields":[ "data.Conservation Status.*Rank", "*Description" ] }}
The query below will return results where Black and Pine are found in the Translated Name or Colloquial Name. Note that the words do not need to be in the order given.
{ "multi_match": { "query": "Black Pine", "fields": [ "data.Overview.Translated Name", "data.Overview.Colloquial Name" ], "operator": "And" }}
Multi Match Query documentation: https://www.elastic.co/guide/en/elasticsearch/reference/6.8/query-dsl-multi-match-query.html
Examples of searching on a Scientific Name
(partial name)
{ "match_phrase": { "data.Overview.Scientific Name":"Pinus rigida" }}
{ "match_phrase": { "data.Overview.Scientific Name":"Pinus contorta var. murrayana" }}
(full Scientific Name)
{ "match_phrase": { "data.Overview.Scientific Name":"Pinus rigida / (Quercus ilicifolia) / Aronia melanocarpa / Deschampsia flexuosa Woodland" }}
Where this query will only return results where the Translated Name contains the phrase 'Black Pine'
{ "match_phrase": { "data.Overview.Translated Name":"Black Pine" }}
These queries will find the results that contain the indicated phrase the Floristics field"
{ "match_phrase": { "data.Vegetation.Floristics":"open mixture of pines" }}
{ "match_phrase": { "data.Vegetation.Floristics":"Graminoids dominate the herbaceous stratum" }}
Match Phrase Query documentation: https://www.elastic.co/guide/en/elasticsearch/reference/6.8/query-dsl-match-query-phrase.html