The search API is deprecated since Release 1.3.0. Applications created before Arrow Cloud Release 1.3.0 can continue to use the deprecated search API, but new applications will need to use the query API with the
Query API overview
The query API provides an interface for applying database-style query constraints on predefined objects and custom fields.
When no query parameters are provided, all objects of the specified type are returned with default pagination. You can control pagination of queries with the
limit parameters, or by using a custom
where clause. See Query Pagination for more information.
The following parameters are available for query operations:
|Table of Content Zone|
If the query includes
The number of records to fetch. The value must be greater than 0, and no greater than 1000, or an HTTP 400 (Bad Request) error will be returned. Default value of
id and _id
query by id or _id:
Query multiple objects by using $in:
By default, ArrowDB puts no limit on the number of records that are evaluated in the database. This means, for example, that if you execute an open-ended query for all ArrowDB objects of some type, and apply a sort and filter on the results, all records in the database are evaluated, sorted and filtered in memory.
For applications that have relatively small numbers of total records (< 5000) this operation can by completed efficiently with no noticeable impact on your application's performance. However, if a table has a very large number (>= 1 million) records these kinds of operations are very inefficient, and your users will notice a performance hit.
The number of records to skip. The value must be greater than or equal to 0, and no greater than 4999, or an HTTP 400 error will be returned. To skip 5000 records or more you need to perform a range-based query. See Query Pagination for more information.
Constrains values for fields. The value should be encoded JSON. Each value in the search query needs to be less that 1024 bytes. If the value is larger than 1024 bytes, the query does not return any results.
Each type of ArrowDB object has a set of predefined fields that can be queried with the
In addition, you can query the custom fields on any object. Note, however, that you can only query simple values, such as Strings, Dates, Numbers, or Booleans. If a custom field takes an array or object as a value, you can't query any of the values stored inside the array or object.
For more information, see Supported Data Types.
Currently, ArrowDB does not support case insensitive query. To perform case insensitive query on a field, save an additional normalized copy of the original field and perform the query on the normalized field instead.
To perform an exact match on a field, for example, to search for users with
You can add more search criteria by adding them together. For example, to search for users with
For non-exact matches,
For querying geographic coordinates, the following operators are supported:
You can combine any of the above to build a more complex query.
If you want to find users with age older than 28:
If you want to find users at age 28 or 38:
If you want to find users at age neither 28 nor 38:
If you want to find a user whose email is "
firstname.lastname@example.org" and type is User:
If you want to find users who have options are 2,3
If you want to find users who have location information.
If you want to find users who haven't location information.
If you have a custom array with your user object, such as a list of scores (scores:
If you have a custom array of tags, such as
If you have assigned custom coordinates to your user objects, you can search by users' coordinates. For example, if you want to find users named joe near longitude -122.1 and latitude 37.1.
To find users named joe near longitude -122.1 and latitude 37.1 with maximum distance of 5 miles (convert 5 miles to radians, 5/3959 = 0.00126)
To search for the keywords
Sort results by one or more fields. In general, you can sort based on any predefined field that you can query using the
To reverse the sorting order, simply add
Selects which fields to return from the query. Do not use this parameter if you are using the
Assign an array of field names to filter to the
If you want to display a field from the
If you want to display a field from a nested object, then both the name of the nested object and field need to be specified.
For example, if you want to only return the
Selects which fields to not return from the query. Do not use this parameter if you are using the
Assign an array of field names to filter to the
If you want to hide displaying a field from the
If you want to hide displaying a field from a nested object, then both the name of the nested object and field need to be specified.
For example, if you want to return all fields except
Starting with ArrowDB 1.1.5, we have made the following changes:
For additional examples, see Range-based Query Pagination Examples.
Range-based query pagination examples
- Query on Custom Field, Results in Ascending Order
- Query on Custom Field, Results in Descending Order
- Query for Next Page of Results, Results in Ascending Order
- Query for Previous Page of Results
Query on custom field, results in ascending order
The Search API is fixed in terms of the searchable fields; use the query API to perform more flexible searches.