NGSIv2 filtering capabilities are based on the following operation:
GET /v2/entities?q=<query_string>
where query_string indicates the query string defined in the NGSIv2 specification document . For example, to get all objects for which temperature less than 24, which humidity is in the range from 75 to 90 and which status "works", uses the following operation:
GET /v2/entities?q=temperature<24;humidity==75..90;status=running
You can also make queries using the "traditional" NGSIv1, using the scope field in the POST /v1/queryContext . The same request will be executed as follows:
POST /v1/queryContext { "entities": [ { "type": "", "isPattern": "true", "id": ".*" } ], "restriction": { "scopes": [ { "type": "FIWARE::StringQuery", "value": "q=temperature<24;humidity==75..90;status=running" } ] } }
The following link contains additional information.
Note that some filters (e.g., large / smaller, ranges, etc.) assume that the attribute's native value type is a number. Note that NGISv1 operations for creating / updating attributes always convert values ββto strings (due to XML compilation no longer supported by NGSIv2). Thus, if you need to save attribute values ββas a number in order to apply filters of larger or smaller sizes, ranges, etc., Then use NGSIv2 operations to create / update these attributes. The disclaimer is described in more detail in the following piece of documentation .
source share