Query Example

Here is an example of a QueryRequest object with multiple clauses. This example defines the following query conditions:

  • { "age" <=18 OR "age" > 65 } AND { "gender" is equal to "Female" }
  • Sort the results using "age" in descending order.
  • Limit the number of KiiObjects in a query response to 100.
{
 "bucketQuery": {
  "clause": {
   "type": "and",
   "clauses": [
    {"type": "or",
     "clauses" : [
       {"type": "range", "field": "age", "upperLimit": 18, "upperIncluded": true},
       {"type": "range", "field": "age", "lowerLimit": 65, "lowerIncluded": false}
     ]
    },
    {"type": "eq", "field": "gender", "value": "Female" }
   ]
  },
  "orderBy" : "age",
  "descending" : true
 },
 "bestEffortLimit" : 100
}