-
Notifications
You must be signed in to change notification settings - Fork 5
Query Format
Dan Stoner edited this page Apr 22, 2015
·
28 revisions
The iDigBio query format is intended to be an easy to write query format for our APIs. Its basic structure consists of a JSON dictionary, with zero or more top-level keys that reference fields in our indexes. (See: Index Fields)
A basic multi-field query looks like this:
{
"scientificname": {
"type": "exists"
},
"family": "asteraceae"
}
That query will look for anything in the family Asteraceae that also has the scientific name field populated.
Multiple fields are combined with the "AND" operator.
More details on the query types supported below. Note, the query types under all fields should work on any field in the index, including the non-string fields. The query types under the other sections will only work with fields of the matching type.
{
"scientificname": {
"type": "exists"
}
}
{
"scientificname": {
"type": "missing"
}
}
{
"data": {
"type": "fulltext",
"value": "aster"
}
}
{
"family": "asteraceae"
}
{
"family": [
"asteraceae",
"fagaceae"
]
}
{
"family": {
"type": "prefix",
"value": "aster"
}
}
{
"hasImage": true
}
{
"minelevation": {
"type": "range",
"gte": "100",
"lte": "200"
}
}
{
"datecollected": {
"type": "range",
"gte": "1800-01-01",
"lte": "1900-01-01"
}
}
{
"geopoint": {
"type": "geo_bounding_box",
"top_left": {
"lat": 19.23,
"lon": -130
},
"bottom_right": {
"lat": -45.1119,
"lon": 179.99999
}
}
}
{
"geopoint": {
"type": "geo_distance",
"distance": "100km",
"lat": -41.1119,
"lon": 145.323
}
}