IDigBio API v1 Specification: Difference between revisions

move details here from overview page
(stub search section)
(move details here from overview page)
Line 218: Line 218:


== Search ==
== Search ==
Each type can be queried through the following respective URLs:
{| class="wikitable"
!Query Type
!Description
!Search URL
|-
|Records
|specimen records
|https://search.idigbio.org/idigbio/records/_search
|-
|Media Records
|media metadata records
|https://search.idigbio.org/idigbio/mediarecords/_search
|}
The [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html Elasticsearch Query Domain Specific Language (DSL)] and [http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/search-uri-request.html Elasticsearch URI Search] documents will likely be useful.
There is also an [https://groups.google.com/forum/?fromgroups#!forum/elasticsearch elasticsearch Google Group] available.
=== Elasticsearch - Records ===
Specimen Records Query URL:
<pre>
https://search.idigbio.org/idigbio/records/_search
</pre>
The following terms are currently available in the indexes for '''Records''' type of queries to Elasticsearch:
<pre>
"barcodevalue"
"catalognumber"
"class"
"collectioncode"
"collectionid"
"collectionname"
"collector"
"commonname"
"continent"
"country"
"county"
"datecollected"
"datemodified"
"etag"
"family"
"fieldnumber"
"genus"
"geopoint"
"hasImage"
"highertaxon"
"infraspecificepithet"
"institutioncode"
"institutionid"
"institutionname"
"kingdom"
"locality"
"maxdepth"
"maxelevation"
"mediarecords"
"mindepth"
"minelevation"
"municipality"
"occurenceid"
"order"
"phylum"
"recordset"
"scientificname"
"specificepithet"
"stateprovince"
"typestatus"
"uuid"
"verbatimlocality"
"version"
"waterbody"
</pre>
The values stored in these terms are converted to lowercase, so searches based on terms should use the all-lowercase version of the string.
For example, searching for "Arkansas" in stateprovince will return no records.
<pre>
$ curl -s "http://search.idigbio.org/idigbio/records/_search?q=stateprovince:Arkansas" | json_pp | grep scientificname | wc -l
0
</pre>
Searching for "arkansas" will return multiple records.
<pre>
$ curl -s "http://search.idigbio.org/idigbio/records/_search?q=stateprovince:arkansas" | json_pp | grep scientificname | wc -l
10
</pre>
See [[iDigBio API Examples#Elasticsearch_Examples]] page for more Elasticsearch examples that are specific to iDigBio.
=== Elasticsearch - Media Records ===
Media Records Query URL:
<pre>
https://search.idigbio.org/idigbio/mediarecords/_search
</pre>
There are no useful terms for '''Media Records''' queries using Elasticsearch at this time.
1,554

edits