Talk:IDigBio API: Difference between revisions

Jump to navigation Jump to search
Line 211: Line 211:
According to the [http://www.elasticsearch.org/overview/elasticsearch/ Elasticsearch project site], Elasticsearch is a "flexible and powerful open source, distributed, real-time search and analytics engine."
According to the [http://www.elasticsearch.org/overview/elasticsearch/ Elasticsearch project site], Elasticsearch is a "flexible and powerful open source, distributed, real-time search and analytics engine."


The iDigBio search index provides two document types to query on: '''Records''' (specimen records) and '''Media Records''' (media metadata). Search results are returned as JSON-formatted documents. Each type can be queried through the following respective URLs:
The iDigBio search index provides two document types to query on: '''Records''' (specimen records) and '''Media Records''' (media metadata). Search results are returned as JSON-formatted documents.  


{| class="wikitable"
More detailed information is available in [[iDigBio API v1 Specification#Search]].
!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.


See [[iDigBio API Examples#Elasticsearch_Examples]] page for Elasticsearch examples that are specific to iDigBio.
See [[iDigBio API Examples#Elasticsearch_Examples]] page for Elasticsearch examples that are specific to iDigBio.
1,554

edits

Navigation menu